通过指定原始图像的左上角、右上角和左下角的目标点可旋转、反射和扭曲图像。这三个目标点确定将原始矩形图像映射为平行四边形的仿射变形。例如,假设原始图像是一个矩形,其左上角、右上角和左下角分别位于 (0, 0)、(100, 0) 和 (0, 50)。现在假设我们将这三个点按以下方式映射到目标点。原始点 目标点 左上角 (0, 0) (200, 20) 右上角 (100, 0) (110, 100) 左下角 (0, 50) (250, 30) 下面的插图显示原始图像以及映射为平行四边形的图像。原始图像已被扭曲、反射、旋转和平移。沿着原始图像上边缘的 x 轴被映射到通过 (200, 20) 和 (110, 100) 的直线。沿着原始图像左边缘的 y 轴被映射到通过 (200, 20) 和 (250, 30) 的直线。 Point[] destinationPoints = { new Point(200, 20), // destination for upper-left point of // original new Point(110, 100), // destination for upper-right point of // original new Point(250, 30)}; // destination for lower-left point of // originalImage image = new Bitmap("Stripes.bmp");// Draw the image unaltered with its upper-left corner at (0, 0). e.Graphics.DrawImage(image, 0, 0);// Draw the image mapped to the parallelogram. e.Graphics.DrawImage(image, destinationPoints); 写个方法,就可以任意旋转了. 不过坐标的计算是重点.
左上角 (0, 0) (200, 20)
右上角 (100, 0) (110, 100)
左下角 (0, 50) (250, 30) 下面的插图显示原始图像以及映射为平行四边形的图像。原始图像已被扭曲、反射、旋转和平移。沿着原始图像上边缘的 x 轴被映射到通过 (200, 20) 和 (110, 100) 的直线。沿着原始图像左边缘的 y 轴被映射到通过 (200, 20) 和 (250, 30) 的直线。
Point[] destinationPoints = {
new Point(200, 20), // destination for upper-left point of
// original
new Point(110, 100), // destination for upper-right point of
// original
new Point(250, 30)}; // destination for lower-left point of
// originalImage image = new Bitmap("Stripes.bmp");// Draw the image unaltered with its upper-left corner at (0, 0).
e.Graphics.DrawImage(image, 0, 0);// Draw the image mapped to the parallelogram.
e.Graphics.DrawImage(image, destinationPoints);
写个方法,就可以任意旋转了.
不过坐标的计算是重点.
并用JS调用
rotate(x-rotation, y-rotation, z-rotation) //旋转
scale(x-scale,y-scale,z-scale) //缩放
translate(x-coordinate,y-coordinate,z-coordinate) //平移
等函数,就可使图片产生动态效果,
网上有类似JS代码和示例
对 有一个原始图片,将原始图片旋转一定角度保存成新图片,当然,原始图片还是要保留的