void CSliderControl::LoadPicture() { CFbsBitmap* BitMap = new (ELeave) CFbsBitmap(); BitMap->Create(Size(),EColor16M); CAknsBasicBackgroundControlContext* iContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgAreaMain,Rect(),ETrue); CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(BitMap); CBitmapContext* bitGc = NULL; bitmapDevice->CreateBitmapContext(bitGc); /// CleanupStack::PushL(iContext); CleanupStack::PushL(bitmapDevice); CleanupStack::PushL(bitGc); AknsDrawUtils::DrawBackground(AknsUtils::SkinInstance(),iContext,NULL,*bitGc,TPoint(0,0),Rect(),0); CleanupStack::PopAndDestroy(3); iIcon=BitMap; /* CFbsBitmap* mask; CFbsBitmap* icon; _LIT(KPath,"\\resource\\apps\\TweakS_ui.mif"); AknIconUtils::CreateIconL(icon,mask,KPath,EMbmTweaks_uiButton_dlg_bg,EMbmTweaks_uiButton_dlg_bg_mask); AknIconUtils::SetSize(icon,Size(),EAspectRatioNotPreserved); AknIconUtils::SetSize(mask,Size(),EAspectRatioNotPreserved); iIcon=CGulIcon::NewL(icon,mask); */ }
void tst_NativeImageHandleProvider::bitmap() { #if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) QPixmap tmp(10, 20); if (tmp.pixmapData()->classId() == QPixmapData::OpenVGClass) { BitmapProvider prov; // This should fail because of null ptr. QPixmap pm = pixmapFromNativeImageHandleProvider(&prov); QVERIFY(pm.isNull()); pm = QPixmap(); QCOMPARE(prov.refCount, 0); prov.bmp = new CFbsBitmap; QCOMPARE(prov.bmp->Create(TSize(prov.w, prov.h), EColor16MAP), KErrNone); CFbsBitmapDevice *bitmapDevice = CFbsBitmapDevice::NewL(prov.bmp); CBitmapContext *bitmapContext = 0; QCOMPARE(bitmapDevice->CreateBitmapContext(bitmapContext), KErrNone); TRgb symbianColor = TRgb(255, 200, 100); bitmapContext->SetBrushColor(symbianColor); bitmapContext->Clear(); delete bitmapContext; delete bitmapDevice; pm = pixmapFromNativeImageHandleProvider(&prov); QVERIFY(!pm.isNull()); QCOMPARE(pm.width(), prov.w); QCOMPARE(pm.height(), prov.h); QVERIFY(prov.refCount == 1); QImage img = pm.toImage(); QVERIFY(prov.refCount == 1); QRgb pix = img.pixel(QPoint(1, 2)); QCOMPARE(qRed(pix), symbianColor.Red()); QCOMPARE(qGreen(pix), symbianColor.Green()); QCOMPARE(qBlue(pix), symbianColor.Blue()); pm = QPixmap(); // should result in calling release QCOMPARE(prov.refCount, 0); delete prov.bmp; } else { QSKIP("Not openvg", SkipSingle); } #else QSKIP("Not applicable", SkipSingle); #endif }