Symbian3/SDK/Source/GUID-3584C6F0-0B9E-5490-9CDB-86FA218A2E26.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 11 Jun 2010 15:24:34 +0100
changeset 9 59758314f811
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 23 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 2714, Bug 462.

<?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-3584C6F0-0B9E-5490-9CDB-86FA218A2E26"><title>Loading a Bitmap from a File</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>Bitmaps can be stored in multi-bitmap (<filepath>.mbm</filepath>) files, which can be built from <filepath>.bmp</filepath> files as part of the <codeph>abld</codeph> process. This topic provides an example of loading a multi-bitmap file. </p> <p>Loading them has four stages: </p> <ol id="GUID-48EA2A7A-CEEC-587A-A4E3-358F60369183"><li id="GUID-623ACA50-14A7-5573-87AC-BF394ABDBB65"><p>Put the name of the bitmap file into a buffer. </p> </li> <li id="GUID-064AD234-B581-5DEA-8276-DF5E78D1CCF6"><p>Create a bitmap (<codeph>CFbsBitmap</codeph>). </p> </li> <li id="GUID-BA848FFC-23C2-56B9-9AEC-D89945FD1361"><p>Load the bitmap using <codeph>CFbsBitmap::Load()</codeph>. </p> </li> <li id="GUID-48B6560D-96AC-5020-B98D-642549611792"><p>If an error is returned, leave and ensure the bitmap is cleaned up </p> </li> </ol> <codeblock id="GUID-152B03ED-E130-5F78-81AE-3795EBA48208" xml:space="preserve">// set the name of the multi-bitmap file containing the bitmaps
_LIT(KMBMFileName,"z:\\resource\\apps\\grbmap2.mbm");
    
// load the bitmap from an .mbm file
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
CleanupStack::PushL(bitmap);
User::LeaveIfError(bitmap-&gt;Load(KMBMFileName, EMbmGrbmap2Smiley));
    
// EMbmGrbmap2Smiley is the ID of a bitmap in the .mbm file
...
    
// clean up
CleanupStack::PopAndDestroy();</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>