May be this is really the problem, but I am not sure if I can help you in the best way, if someone else knows more please advice!
In 3rd edition I am using
AknIconUtils::CreateIconL(bitmap, bitmapMask, KMbmFileName, aBitmapId, aBitmapMaskId)
to create bitmaps and in previous SDKs I am using BitmapMethods from Nokia examples:
C:\Symbian\7.0s\Series60_v21_CW\Series60Ex\helperfunctions\bitmapmethods.cpp
Here is the code if you don't have 21
Code:
// Copyright (c) 2000, Nokia. All rights reserved.
#include "bitmapmethods.h"
#include <eikenv.h>
#include <fbs.h>
CFbsBitGc* NBitmapMethods::CreateGraphicsContextLC(CFbsBitmapDevice& aBitmapDevice)
{
CFbsBitGc* graphicsContext = NULL;
User::LeaveIfError(aBitmapDevice.CreateContext(graphicsContext));
CleanupStack::PushL(graphicsContext);
return graphicsContext;
}
CFbsBitGc* NBitmapMethods::CreateGraphicsContextL(CFbsBitmapDevice& aBitmapDevice)
{
CFbsBitGc* gc = CreateGraphicsContextLC(aBitmapDevice);
CleanupStack::Pop(gc);
return gc;
}
CFbsBitmapDevice* NBitmapMethods::CreateBitmapDeviceLC(CFbsBitmap& aBitmap)
{
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(&aBitmap);
CleanupStack::PushL(bitmapDevice);
return bitmapDevice;
}
CFbsBitmapDevice* NBitmapMethods::CreateBitmapDeviceL(CFbsBitmap& aBitmap)
{
CFbsBitmapDevice* device = CreateBitmapDeviceLC(aBitmap);
CleanupStack::Pop(device);
return device;
}
CFbsBitmap* NBitmapMethods::CreateBitmapLC(TSize aSizeInPixels,TDisplayMode aDispMode)
{
CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
CleanupStack::PushL(bitmap);
User::LeaveIfError(bitmap->Create(aSizeInPixels,aDispMode));
ASSERT((bitmap->DisplayMode() == KColourDepth) || (bitmap->DisplayMode() == EGray2));
return bitmap;
}
CFbsBitmap* NBitmapMethods::CreateBitmapL(TSize aSizeInPixels,TDisplayMode aDispMode)
{
CFbsBitmap* bitmap = CreateBitmapLC(aSizeInPixels,aDispMode);
CleanupStack::Pop(bitmap);
return bitmap;
}
CFbsBitmap* NBitmapMethods::CreateBitmapLC(const TDesC& aFileName,TInt aId)
{
CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
CleanupStack::PushL(bitmap);
TInt loadException = bitmap->Load(aFileName,aId);
User::LeaveIfError(loadException);
if ((bitmap->DisplayMode() == KColourDepth) || (bitmap->DisplayMode() == EGray2))
{
return bitmap;
}
else
{
CFbsBitmap* newBitmap = CreateBitmapLC( bitmap->SizeInPixels(),KColourDepth);
CFbsBitmapDevice* bitmapDevice = CreateBitmapDeviceLC(*newBitmap);
CFbsBitGc* bitmapGc = CreateGraphicsContextLC(*bitmapDevice);
bitmapGc->BitBlt(TPoint(0,0),bitmap,TRect(bitmap->SizeInPixels()));
CleanupStack::PopAndDestroy(2); // gc and device
// The next three lines are here to get rid of the old bitmap but keep the new one
CleanupStack::Pop(newBitmap);
CleanupStack::PopAndDestroy(bitmap);
CleanupStack::PushL(newBitmap);
return newBitmap;
}
}
CFbsBitmap* NBitmapMethods::CreateBitmapL(const TDesC& aFileName,TInt aId)
{
CFbsBitmap* bitmap = CreateBitmapLC(aFileName, aId);
CleanupStack::Pop(bitmap);
return bitmap;
}
void NBitmapMethods::BitBltMaskedEntireBitmap(CFbsBitGc& aTargetGc,TPoint aTopLeft,
const CFbsBitmap& aBitmap,const CFbsBitmap& aBitMask)
{
PartialReset(aTargetGc);
aTargetGc.BitBltMasked(aTopLeft,&aBitmap,aBitmap.SizeInPixels(),&aBitMask,ETrue);
PartialReset(aTargetGc);
}
void NBitmapMethods::PartialReset(CFbsBitGc& aGc)
{
aGc.SetPenSize(TSize(1,1));
aGc.SetPenColor(KRgbBlack);
aGc.SetPenStyle(CFbsBitGc::ESolidPen);
aGc.SetDrawMode(CFbsBitGc::EDrawModePEN);
aGc.DiscardFont();
aGc.DiscardBrushPattern();
aGc.SetBrushColor(KRgbWhite);
aGc.SetBrushStyle(CFbsBitGc::ENullBrush);
aGc.SetCharJustification(0,0);
aGc.SetWordJustification(0,0);
aGc.SetDitherOrigin(TPoint(0,0));
aGc.SetPenStyle(CFbsBitGc::ENullPen);
aGc.SetShadowMode(EFalse);
aGc.SetStrikethroughStyle(EStrikethroughOff);
aGc.SetUnderlineStyle(EUnderlineOff);
aGc.SetUserDisplayMode(ENone);
}
h file
Code:
/* Copyright (c) 2001, Nokia. All rights reserved */
#ifndef __BITMAPMETHODS__
#define __BITMAPMETHODS__
#define KColourDepth EColor4K
//Ensure these libraries are linked against:
//LIBRARY bitgdi.lib
#include <e32base.h>
#include <gdi.h>
class CFbsBitGc;
class CFbsBitmapDevice;
class CWsBitmap;
class CFbsBitmap;
/*!
@namespace NBitmapMethods
@discussion A set of functions to make bitmap manipulation easier
*/
namespace NBitmapMethods
{
/*!
@function CreateGraphicsContextLC
@discussion Create a graphics context and leave it on the cleanup stack
@param aBitmapDevice a reference to a bitmap device
*/
CFbsBitGc* CreateGraphicsContextLC(CFbsBitmapDevice& aBitmapDevice);
/*!
@function CreateGraphicsContextL
@discussion Create a graphics context
@param aBitmapDevice a reference to a bitmap device
*/
CFbsBitGc* CreateGraphicsContextL(CFbsBitmapDevice& aBitmapDevice);
/*!
@function CreateBitmapDeviceLC
@discussion Create a bitmap device and leave it on the cleanup stack
@param aBitmap a reference to a bitmap
*/
CFbsBitmapDevice* CreateBitmapDeviceLC(CFbsBitmap& aBitmap);
/*!
@function CreateBitmapDeviceL
@discussion Create a bitmap device
@param aBitmap a reference to a bitmap
*/
CFbsBitmapDevice* CreateBitmapDeviceL(CFbsBitmap& aBitmap);
/*!
@function CreateBitmapLC
@discussion Create a bitmap and leave it on the cleanup stack
@param aSizeInPixels the size of the bitmap to be created
@param aDispMode the display mode of the bitmap
*/
CFbsBitmap* CreateBitmapLC(TSize aSizeInPixels,TDisplayMode aDispMode);
/*!
@function CreateBitmapL
@discussion Create a bitmap
@param aSizeInPixels the size of the bitmap to be created
@param aDispMode the display mode of the bitmap
*/
CFbsBitmap* CreateBitmapL(TSize aSizeInPixels,TDisplayMode aDispMode);
/*!
@function CreateBitmapLC
@discussion Create a bitmap from an mbm file bitmap and leave it on the cleanup stack
@param aFileName the name of an mbm file
@param aId the position of the bitmap in the mbm file
*/
CFbsBitmap* CreateBitmapLC(const TDesC& aFileName,TInt aId);
/*!
@function CreateBitmapLC
@discussion Create a bitmap from an mbm file bitmap
@param aFileName the name of an mbm file
@param aId the position of the bitmap in the mbm file
*/
CFbsBitmap* CreateBitmapL(const TDesC& aFileName,TInt aId);
/*!
@function BitBltMaskedEntireBitmap
@discussion Blit the entire of a bitmap with a mask onto a gc
@param aTargetGc gc to blit onto
@param aTopLeft the position at which the top left of the bitmap will be placed on the gc
@param aBitmap the bitmap to blit
@param aBitMask the mask
*/
void BitBltMaskedEntireBitmap(CFbsBitGc& aTargetGc,TPoint aTopLeft,const CFbsBitmap& aBitmap,
const CFbsBitmap& aBitMask);
/*!
@function PartialReset
@discussion Reset a gc so that it is in a sensible state.
Not all settings are reset, just some of the more useful ones
@param aGc the gc to reset
*/
void PartialReset(CFbsBitGc& aGc);
}
#endif //__BITMAPMETHODS__
and then I create the bitmap using
Code:
bitmap = NBitmapMethods::CreateBitmapL(AbsPath(KMbmFileName), EMbmBrightMoon);