How do you copy from a rectangular source area to a non-rectangular / non-parallelogram destination area in .NET?
I know how to use the DrawImage () method of a Graphics object to copy from the source rectangular area to the destination rectangular area, and how to copy to the parallelogram area defined by the three-element Point [] array.
Is there a way in .NET to copy from a rectangular source area to a 4-sided non-rectangular destination area (which is defined by four arbitrary points)?
Update . Here is some example code that copies an image into a parallelogram area:
using (Graphic g = this.CreateGraphics())
{
List<Point> pts = new List<Point>();
pts.Add(new Point(0, 0));
pts.Add(new Point(100, 0));
pts.Add(new Point(10, 100));
g.DrawImage(pbSource.Image, pts.ToArray());
}
If I add a fourth dot, I get a Not Implemented exception.
Refresh 2 . This can be done entirely in .NET:
alt text http://www.freeimagehosting.net/uploads/a770d1e97f.jpg
but you have to do it yourself, pixel by pixel. Graphics courtesy of Jonbert .
source to share
This can be done entirely in .NET:
alt text http://www.freeimagehosting.net/uploads/a770d1e97f.jpg
but you have to do it yourself, pixel by pixel. Graphics courtesy of Jonbert .
source to share
As far as I can tell, there is no easy (built-in) way to do this kind of image conversion in .NET.
If you look at Anti Aliased Image Transformation (Aaform) on codeproject you can download a sample of it which has a pure vb implementation of the concept (as well as a vb and C ++ sample).
There is also Anti-Grain Geometry , a free-to-use (for non-commercial) C ++ graphics library, and aC # wrapper for it.
Hope it helps.
source to share