Image Drawing
The Bitmap
class provides a method called DrawImage
that allows one bitmap to draw part or all of another bitmap on itself.
Bitmap snowflake = Resources.GetBitmap(Resources.BitmapResources.MFsnowflake); myBitmap.DrawImage( 10, 10, // destination x, y snowflake, // source bitmap 0, 0, // x, y in source snowflake.Width, snowflake.Height // source width, height 0xff); // opacity myBitmap.Flush();
This code gets a bitmap from a resource and then uses DrawImage
to render the bitmap. The entire bitmap is drawn 10 pixels down and 10 pixels from the left edge of the origin. The Width
and Height
properties of the source bitmap are used to ensure that the entire bitmap is drawn.
Figure 7-8 shows the full-size display of the snowflake image. You ...
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.