Image Scaling
The StretchImage
method also draws one bitmap on top of another, but instead of allowing a rectangle of the source bitmap to be selected for the draw operation, the entire source rectangle is stretched or shrunk to fit a destination rectangle.
Bitmap snowflake = Resources.GetBitmap(Resources.BitmapResources.MFsnowflake); myBitmap.StretchImage( 10, 10, // destination x, y snowflake, // source bitmap 200, 100, // width and height of destination 0xff); // opacity myBitmap.Flush();
Irrespective of the size of the original, the snowflake will be drawn in a rectangle 200 pixels wide and 100 pixels high (Figure 7-9). The snowflake image doubled in width during the draw process.
Figure 7-9. The snowflake image stretched into a 200-pixel by ...
Get Embedded Programming with the Microsoft® .NET Micro Framework now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.