Symbian3/PDK/Source/GUID-EF49C43F-E9ED-5B4D-B9C4-376B9A4E3FA6.dita
changeset 3 46218c8b8afa
parent 1 25a17d01db0c
child 5 f345bda72bc4
--- a/Symbian3/PDK/Source/GUID-EF49C43F-E9ED-5B4D-B9C4-376B9A4E3FA6.dita	Thu Mar 11 15:24:26 2010 +0000
+++ b/Symbian3/PDK/Source/GUID-EF49C43F-E9ED-5B4D-B9C4-376B9A4E3FA6.dita	Thu Mar 11 18:02:22 2010 +0000
@@ -1,25 +1,25 @@
-<?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-EF49C43F-E9ED-5B4D-B9C4-376B9A4E3FA6"><title>Using a Bitmap-Patterned Brush</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>If the brush style is set to a patterned brush, then a bitmap can be used for filling shapes. The following example code illustrate how this is done. The bitmap is tiled around the given origin - the top left of the window is the default - and clipped to the given shape. The second bitmapped brush example shows the effect of moving the origin. </p> <section><title>Using a bitmap patterned brush, with the default origin</title> <ol id="GUID-0F5408B2-5F0C-5810-90F0-AF53F435A809"><li id="GUID-60F09B34-5E46-5CEB-BB18-836D144AAF9A"><p>Load the bitmap file in the standard way. </p> </li> <li id="GUID-6516A6C9-161E-5E15-8F27-624E95BFF78C"><p>Use the bitmap as the graphics context’s brush pattern. </p> </li> <li id="GUID-F2AF6104-7D12-5120-AB35-267AFB4DB80E"><p>Set the brush style to <codeph>TBrushStyle::EPatternedBrush</codeph>. </p> </li> <li id="GUID-290DBDCC-8159-54F4-9587-BEA4B9EBEF9B"><p>Discard the brush pattern using <codeph>DiscardBrushPattern()</codeph>. </p> </li> <li id="GUID-23CD56E3-603E-5415-A7CE-93218B7AF9FC"><p>Destroy the bitmap. </p> </li> </ol> <p>With no brush origin set, the tiling pattern starts at the top left corner of the window. </p> <codeblock id="GUID-B2A5D6F1-A22C-5015-945E-AFBADB2D607E" xml:space="preserve">CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
-CleanupStack::PushL(bitmap);
-User::LeaveIfError(bitmap-&gt;Load(KAnMbmFile,KABitmapID));
-// set brush pattern and style to use the bitmap
-gc.UseBrushPattern(bitmap);
-gc.SetBrushStyle(CGraphicsContext::EPatternedBrush);
-// draw shape filled with bitmap pattern
-gc.DrawRect(rect);
-gc.DiscardBrushPattern();
-CleanupStack::PopAndDestroy();</codeblock> </section> <section><title>Using a bitmap patterned brush, with a set origin</title> <p>You can set the brush origin using <codeph>SetBrushOrigin()</codeph>, and tile the bitmap around this point. </p> <p>The example code is exactly the same as that in previous bitmapped brush example, except that the following line is added before the rectangle is drawn: </p> <codeblock id="GUID-2EC2ADC7-5AE0-5872-A087-BE2B949C8A7A" xml:space="preserve">...
-TPoint pos(100,100);
-gc.SetBrushOrigin(pos);
-...</codeblock> <p>For using bitmaps, see <xref href="GUID-EAAD1719-C02C-5705-A5C3-993E36441BE6.dita">BitGDI Component</xref>. </p> </section> </conbody><related-links><link href="GUID-55C8C429-1BEC-5A58-94EC-DA1E51F62867.dita"><linktext>Drawing
+<?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-EF49C43F-E9ED-5B4D-B9C4-376B9A4E3FA6"><title>Using a Bitmap-Patterned Brush</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>If the brush style is set to a patterned brush, then a bitmap can be used for filling shapes. The following example code illustrate how this is done. The bitmap is tiled around the given origin - the top left of the window is the default - and clipped to the given shape. The second bitmapped brush example shows the effect of moving the origin. </p> <section><title>Using a bitmap patterned brush, with the default origin</title> <ol id="GUID-0F5408B2-5F0C-5810-90F0-AF53F435A809"><li id="GUID-60F09B34-5E46-5CEB-BB18-836D144AAF9A"><p>Load the bitmap file in the standard way. </p> </li> <li id="GUID-6516A6C9-161E-5E15-8F27-624E95BFF78C"><p>Use the bitmap as the graphics context’s brush pattern. </p> </li> <li id="GUID-F2AF6104-7D12-5120-AB35-267AFB4DB80E"><p>Set the brush style to <codeph>TBrushStyle::EPatternedBrush</codeph>. </p> </li> <li id="GUID-290DBDCC-8159-54F4-9587-BEA4B9EBEF9B"><p>Discard the brush pattern using <codeph>DiscardBrushPattern()</codeph>. </p> </li> <li id="GUID-23CD56E3-603E-5415-A7CE-93218B7AF9FC"><p>Destroy the bitmap. </p> </li> </ol> <p>With no brush origin set, the tiling pattern starts at the top left corner of the window. </p> <codeblock id="GUID-B2A5D6F1-A22C-5015-945E-AFBADB2D607E" xml:space="preserve">CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
+CleanupStack::PushL(bitmap);
+User::LeaveIfError(bitmap-&gt;Load(KAnMbmFile,KABitmapID));
+// set brush pattern and style to use the bitmap
+gc.UseBrushPattern(bitmap);
+gc.SetBrushStyle(CGraphicsContext::EPatternedBrush);
+// draw shape filled with bitmap pattern
+gc.DrawRect(rect);
+gc.DiscardBrushPattern();
+CleanupStack::PopAndDestroy();</codeblock> </section> <section><title>Using a bitmap patterned brush, with a set origin</title> <p>You can set the brush origin using <codeph>SetBrushOrigin()</codeph>, and tile the bitmap around this point. </p> <p>The example code is exactly the same as that in previous bitmapped brush example, except that the following line is added before the rectangle is drawn: </p> <codeblock id="GUID-2EC2ADC7-5AE0-5872-A087-BE2B949C8A7A" xml:space="preserve">...
+TPoint pos(100,100);
+gc.SetBrushOrigin(pos);
+...</codeblock> <p>For using bitmaps, see <xref href="GUID-EAAD1719-C02C-5705-A5C3-993E36441BE6.dita">BitGDI Component</xref>. </p> </section> </conbody><related-links><link href="GUID-55C8C429-1BEC-5A58-94EC-DA1E51F62867.dita"><linktext>Drawing
                 to a Graphics Context Tutorials</linktext> </link> <link href="GUID-E3AC8F3E-9D5C-5E7D-9760-023B77C7C8A8.dita"><linktext>Drawing and Graphics Contexts</linktext> </link> </related-links></concept>
\ No newline at end of file