Quote:
When you use the Shear method, the 2 corners of the image are moved
together
and the image becomes a parallelogram. But how to shear the image by
moving
only a corner of the image? Or is there another method which do the job? |
You can create a TextureBrush from your image, then build a polygon of the
shape you desire and use FillPolygon.
for example:
protected override void OnPaint( PaintEventArgs e )
{
Image image = image.FromFile( "myImage.jpg" );
TextureBrush textureBrush = new TextureBrush( image );
Point[] points = new Point[ 4 ];
// Code assumes an image of 256x256 pixels...
points[ 0 ] = new Point( 32, 32 );
points[ 1 ] = new Point( 32 + 256 + 256, 32 ); // Move this one
corner
points[ 2 ] = new Point( 32 + 256, 32 + 256 );
points[ 3 ] = new Point( 32, 32 + 256 );
e.Graphics.FillPolygon( textureBrush, points );
base.OnPaint( e );
}
I'm assuming that's what you want, and I know this code would be incredibly
slow ;o Just an example.
n!