Rank: Member Groups: Member
Joined: 3/23/2006 Posts: 2 Points: 0
|
is it possible to skew an image either horizontal or vertical from a fixed end point
|
Rank: Advanced Member Groups: Administration
, Member
Joined: 8/3/2003 Posts: 587 Points: 591
|
Hello, You can implement skew transformation using ApplyMatrixTransform. The basic idea is to specify corners of source image as source points and corner points of skewed image as destination points of transformation. Here is a code sample which illustrates this idea: Code:
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(@"c:/1.jpg");
int skew = 100;
System.Drawing.PointF [] srcPoints = new System.Drawing.PointF[3];
System.Drawing.PointF [] destPoints = new System.Drawing.PointF[3];
srcPoints[0].X = 0;
srcPoints[0].Y = 0;
srcPoints[1].X = bitmap.Width - 1;
srcPoints[1].Y = 0;
srcPoints[2].X = 0;
srcPoints[2].Y = bitmap.Height - 1;
destPoints[0].X = srcPoints[0].X + skew;
destPoints[0].Y = srcPoints[0].Y = 0;
destPoints[1].X = srcPoints[1].X + skew;
destPoints[1].Y = srcPoints[1].Y;
destPoints[2].X = srcPoints[2].X;
destPoints[2].Y = srcPoints[2].Y;
Aurigma.GraphicsMill.Transforms.ApplyMatrixTransform transform = new Aurigma.GraphicsMill.Transforms.ApplyMatrixTransform();
Aurigma.GraphicsMill.Transforms.Matrix matrix = Aurigma.GraphicsMill.Transforms.Matrix.FromAffinePoints(srcPoints, destPoints);
transform.Transform = matrix;
transform.ApplyTransform(bitmap);
bitmap.Save(@"c:/1.png");
Sincerely yours, Dmitry Sevostyanov.
|