Symbian3/SDK/Source/GUID-294E84BB-65D0-5275-848E-1960B201A371.dita
changeset 0 89d6a7a84779
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-294E84BB-65D0-5275-848E-1960B201A371.dita	Thu Jan 21 18:18:20 2010 +0000
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
+<!-- This component and the accompanying materials are made available under the terms of the License 
+"Eclipse Public License v1.0" which accompanies this distribution, 
+and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
+<!-- Initial Contributors:
+    Nokia Corporation - initial contribution.
+Contributors: 
+-->
+<!DOCTYPE concept
+  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
+<concept xml:lang="en" id="GUID-294E84BB-65D0-5275-848E-1960B201A371"><title>Creating and Drawing to an Off-Screen Bitmap</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>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. </p> <codeblock id="GUID-E7A1651B-4F87-5156-9CDE-F8205323DB8E" xml:space="preserve">// Create a bitmap to be used off-screen.
+CFbsBitmap* offScreenBitmap = new (ELeave) CFbsBitmap();
+CleanupStack::PushL(offScreenBitmap);
+User::LeaveIfError(offScreenBitmap-&gt;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-&gt;CreateContext(bitmapContext));
+CleanupStack::PushL(bitmapContext);
+     
+// Draw something on the bitmap.
+TRect rect(0,0,100,100);
+bitmapContext-&gt;SetBrushColor(KRgbRed);
+bitmapContext-&gt;SetBrushStyle(CGraphicsContext::ESolidBrush);
+bitmapContext-&gt;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);
+...</codeblock> </conbody><related-links><link href="GUID-AFE8A9CC-E026-5396-8E0C-616338B5F5C3.dita"><linktext>BitGDI Tutorials</linktext> </link> <link href="GUID-EAAD1719-C02C-5705-A5C3-993E36441BE6.dita"><linktext>BitGDI Component</linktext> </link> </related-links></concept>
\ No newline at end of file