diff -r ebc84c812384 -r 46218c8b8afa Symbian3/PDK/Source/GUID-294E84BB-65D0-5275-848E-1960B201A371.dita --- a/Symbian3/PDK/Source/GUID-294E84BB-65D0-5275-848E-1960B201A371.dita Thu Mar 11 15:24:26 2010 +0000 +++ b/Symbian3/PDK/Source/GUID-294E84BB-65D0-5275-848E-1960B201A371.dita Thu Mar 11 18:02:22 2010 +0000 @@ -1,35 +1,35 @@ - - - - - -Creating and Drawing to an Off-Screen Bitmap

This topic provides an example that shows the creation of a bitmap, the creation of an off-screen graphics device and graphics context for it, and the use of that graphics context to draw to the bitmap. Once a graphics context has been established for the bitmap, any of the GDI drawing functions can be used on the bitmap, as if it were the more common graphics context—the screen.

// Create a bitmap to be used off-screen. -CFbsBitmap* offScreenBitmap = new (ELeave) CFbsBitmap(); -CleanupStack::PushL(offScreenBitmap); -User::LeaveIfError(offScreenBitmap->Create(TSize(100,100),EColor256)); - -// Create an off-screen device and context. -CGraphicsContext* bitmapContext=NULL; -CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(offScreenBitmap); -CleanupStack::PushL(bitmapDevice); -User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext)); -CleanupStack::PushL(bitmapContext); - -// Draw something on the bitmap. -TRect rect(0,0,100,100); -bitmapContext->SetBrushColor(KRgbRed); -bitmapContext->SetBrushStyle(CGraphicsContext::ESolidBrush); -bitmapContext->DrawRect(rect); // a filled red rectangle - -// Now do what you want with it, such as blitting to the screen. -gc.BitBlt(TPoint(20,20),offScreenBitmap); - -// Cleanup. -CleanupStack::PopAndDestroy(3); + + + + + +Creating and Drawing to an Off-Screen Bitmap

This topic provides an example that shows the creation of a bitmap, the creation of an off-screen graphics device and graphics context for it, and the use of that graphics context to draw to the bitmap. Once a graphics context has been established for the bitmap, any of the GDI drawing functions can be used on the bitmap, as if it were the more common graphics context—the screen.

// Create a bitmap to be used off-screen. +CFbsBitmap* offScreenBitmap = new (ELeave) CFbsBitmap(); +CleanupStack::PushL(offScreenBitmap); +User::LeaveIfError(offScreenBitmap->Create(TSize(100,100),EColor256)); + +// Create an off-screen device and context. +CGraphicsContext* bitmapContext=NULL; +CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(offScreenBitmap); +CleanupStack::PushL(bitmapDevice); +User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext)); +CleanupStack::PushL(bitmapContext); + +// Draw something on the bitmap. +TRect rect(0,0,100,100); +bitmapContext->SetBrushColor(KRgbRed); +bitmapContext->SetBrushStyle(CGraphicsContext::ESolidBrush); +bitmapContext->DrawRect(rect); // a filled red rectangle + +// Now do what you want with it, such as blitting to the screen. +gc.BitBlt(TPoint(20,20),offScreenBitmap); + +// Cleanup. +CleanupStack::PopAndDestroy(3); ...
BitGDI Tutorials BitGDI Component
\ No newline at end of file