Symbian3/PDK/Source/GUID-4BB03B97-9AD0-50D0-AAE5-B7AB2415716E.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 13 Aug 2010 16:47:46 +0100
changeset 14 578be2adaf3e
parent 5 f345bda72bc4
permissions -rw-r--r--
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     1
<?xml version="1.0" encoding="utf-8"?>
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     2
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     3
<!-- This component and the accompanying materials are made available under the terms of the License 
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     4
"Eclipse Public License v1.0" which accompanies this distribution, 
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     5
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     6
<!-- Initial Contributors:
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     7
    Nokia Corporation - initial contribution.
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     8
Contributors: 
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     9
-->
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    10
<!DOCTYPE concept
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    11
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    12
<concept xml:lang="en" id="GUID-4BB03B97-9AD0-50D0-AAE5-B7AB2415716E"><title>Drawing Reduced and Enlarged Bitmaps</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This topic provides examples of using <codeph>CGraphicsContext::DrawBitmap()</codeph> to draw a bitmap that is stretched or compressed. </p> <p>The bitmap blitting functions of the bitmapped graphics context (<codeph>CBitmapContext</codeph>) cannot be used to perform scaling of the bitmap. They always draws the bitmap using its dimensions in pixels. The overloaded GDI <codeph>CGraphicsContext::DrawBitmap()</codeph> function, however, can be used to draw a bitmap that is: </p> <ul><li id="GUID-D3E2B3CE-2E9E-521B-8B5E-E514B37ADF05"><p>stretched or compressed to a set size in twips </p> </li> <li id="GUID-B289040F-362F-57FE-BCDE-F60D573DB925"><p>stretched and/or compressed to fit a given rectangle. </p> </li> </ul> <p> <b>Note</b>: <codeph>DrawBitmap()</codeph> is slower than <codeph>BitBlt()</codeph>. You should therefore use <codeph>BitBlt()</codeph> in preference wherever possible. </p> <p>These examples assume that <codeph>bitmap</codeph> is a pointer to a valid <codeph>CFbsBitmap</codeph> object. </p> <section><title>Draw a bitmap at a set size in twips</title> <p>A bitmap can have a real world size in twips set for it, and be drawn scaled to that size. </p> <ol id="GUID-B38123EB-5AA5-5FEB-BBDC-0B89A49E7602"><li id="GUID-0C8F50C1-BF59-5D1F-BB4C-6F86A0FAA2E2"><p>Construct a <codeph>TSize</codeph> with the required dimensions in twips. </p> </li> <li id="GUID-CF58B6F6-B983-5C17-BFFB-8971E6C1E901"><p>Set the size of the bitmap using <codeph>CFbsBitmap::SetSizeInTwips()</codeph>. The default size in twips of a bitmap when loaded is <codeph>(0,0)</codeph>. </p> </li> <li id="GUID-395B3BAE-ECE4-5AE8-A275-27F8ED2785A9"><p>Draw the bitmap using <codeph>DrawBitmap()</codeph>  </p> </li> </ol> <codeblock id="GUID-C7B72F4D-25C3-5D7C-848B-8F5359F7D40C" xml:space="preserve">// Set twips size 
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    13
TSize bmpSizeInTwips(2000,2000);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    14
bitmap-&gt;SetSizeInTwips(bmpSizeInTwips);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    15
gc.DrawBitmap(TPoint(50,50), bitmap);</codeblock> </section> <section><title>Draw a bitmap in a given rectangle</title> <p> <codeph>DrawBitmap()</codeph> can also draw a bitmap by stretching it to fit a given rectangle. </p> <codeblock id="GUID-5278E9D2-8276-590D-9E26-BFB73DBA7096" xml:space="preserve">// Draw bitmap stretched from the origin to 100,100
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    16
TRect rect(0,0,100,100);
1
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    17
gc.DrawBitmap(rect, bitmap);</codeblock> </section> </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>