Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
pxg  
#1 Posted : Thursday, March 23, 2006 3:35:05 AM(UTC)
pxg

Rank: Member

Groups: Member
Joined: 3/23/2006(UTC)
Posts: 2

is it possible to skew an image either horizontal or vertical from a fixed end point
Dmitry  
#2 Posted : Thursday, March 23, 2006 1:32:21 PM(UTC)
Dmitry

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 8/3/2003(UTC)
Posts: 1,070

Thanks: 1 times
Was thanked: 12 time(s) in 12 post(s)
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");

Edited by user Thursday, December 20, 2007 4:59:25 PM(UTC)  | Reason: Not specified

Sincerely yours, Dmitry Sevostyanov UserPostedImage Follow Aurigma on Twitter!
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.