当前位置: 首页>>代码示例>>C++>>正文


C++ CFbsBitGc::BitBlt方法代码示例

本文整理汇总了C++中CFbsBitGc::BitBlt方法的典型用法代码示例。如果您正苦于以下问题:C++ CFbsBitGc::BitBlt方法的具体用法?C++ CFbsBitGc::BitBlt怎么用?C++ CFbsBitGc::BitBlt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFbsBitGc的用法示例。


在下文中一共展示了CFbsBitGc::BitBlt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateBitmapL

CFbsBitmap* AknBitmapMirrorUtils::CreateBitmapL(CFbsBitmap* aSourceBitmap, TInt aMirrorDirection)
    {
    User::LeaveIfNull(aSourceBitmap);
    CFbsBitmap* destinationBitmap = new (ELeave) CFbsBitmap();
    CleanupStack::PushL(destinationBitmap);   

    TSize sourceBitmapSize = aSourceBitmap->SizeInPixels();            
    TRect sourceRect = TRect(TPoint(0,0), sourceBitmapSize);
    TSize destinationBitmapSize(sourceRect.Width(), sourceRect.Height()); 

    User::LeaveIfError(destinationBitmap->Create(destinationBitmapSize, aSourceBitmap->DisplayMode()));

    CFbsBitmapDevice* destinationDevice = CFbsBitmapDevice::NewL( destinationBitmap );
    CleanupStack::PushL(destinationDevice);

    CFbsBitGc* destinationGc;
    User::LeaveIfError( destinationDevice->CreateContext( destinationGc ) );

    switch (aMirrorDirection)
        {
        case EAknVerticalMirroring:
            {
            TRect sourceBitmapBlittingRect( sourceRect.iTl.iX,sourceRect.iTl.iY,sourceRect.iBr.iX,sourceRect.iTl.iY + 1 );  
            for ( TInt yPos=destinationBitmapSize.iHeight-1; yPos >= 0; yPos-- )
                {
                destinationGc->BitBlt( TPoint(0,yPos), aSourceBitmap, sourceBitmapBlittingRect );
                sourceBitmapBlittingRect.iTl.iY++;
                sourceBitmapBlittingRect.iBr.iY++;
                }
            break;
            }

        case EAknHorizontalMirroring:
            {
            TRect sourceBitmapBlittingRect( sourceRect.iTl.iX,sourceRect.iTl.iY,sourceRect.iTl.iX + 1,sourceRect.iBr.iY );      
            for ( TInt xPos=destinationBitmapSize.iWidth-1; xPos >= 0; xPos-- )
                {
                destinationGc->BitBlt( TPoint(xPos,0), aSourceBitmap, sourceBitmapBlittingRect );
                sourceBitmapBlittingRect.iTl.iX++;
                sourceBitmapBlittingRect.iBr.iX++;
                }
            break;
            }

        default:
            {
            destinationGc->BitBlt( TPoint(0,0), aSourceBitmap, sourceRect );
            break;
            }
        }

    delete destinationGc;  
    CleanupStack::Pop(2); // destinationBitmap, destinationDevice
    delete destinationDevice;

    return destinationBitmap;   
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:57,代码来源:AknBitmapMirrorUtils.cpp

示例2: DoBitBltAlphaBitmapTestL

/**
Bitblt test

@param aSrcMode is the source display mode
@param aDstMode is the destination display mode
@param aSession is the windows server session
@param aWindow is a reference to the window
@param aGc is the graphics context of the window
@param aNumIterations is the number of iterations to run the test
*/		
void CAlphaBlendTest::DoBitBltAlphaBitmapTestL(TDisplayMode aSrcMode,TDisplayMode aDstMode, RWsSession& aSession, RWindow& aWindow, CWindowGc* aGc, TInt aNumIterations)
	{	
	const TSize bitmapSize = aWindow.Size();
	
	CFbsBitmap* bitmapTarget = CreateSoftwareBitmapLC(bitmapSize, aDstMode);
	CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmapTarget);
	CleanupStack::PushL(bitmapDevice);
	CFbsBitGc* bitmapGc = NULL;	
	User::LeaveIfError(bitmapDevice->CreateContext(bitmapGc));	
	CleanupStack::PushL(bitmapGc);
	
	CFbsBitmap* source = CreateSoftwareBitmapLC(bitmapSize, aSrcMode);
	CFbsBitmap* sourceAlpha = CreateSoftwareBitmapLC(bitmapSize, EGray256);	// match size to src
	VerticalGradientAlphaL(sourceAlpha, TRgb(0x01010101), TRgb(0xfefefefe));
	VerticalGradientAlphaL(source, TRgb(0x00000000), TRgb(0xffffffff));

	TPoint point(0,0);
	
	bitmapGc->SetBrushStyle(CGraphicsContext::ENullBrush);
	bitmapGc->SetBrushColor(TRANSPARENT_BLACK);

	bitmapGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
	bitmapGc->Clear();
	bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
	bitmapGc->BitBlt(point, source);

	aGc->Activate(aWindow);
	aGc->BitBlt(point, bitmapTarget);
	aGc->Deactivate();
	aSession.Flush();

	iProfiler->InitResults();		
	for(TInt i=0; i<aNumIterations; i++)
	{
		bitmapGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
		bitmapGc->Clear();
		bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
		bitmapGc->BitBlt(point, source);
		iProfiler->MarkResultSetL();
	}
	
	iProfiler->ResultsAnalysis(_L("DoBitBltAlphaBitmapTestL"), 0, aSrcMode, aDstMode, aNumIterations);
	
	// copy up to screen for sanity check
	aGc->Activate(aWindow);
	aGc->BitBlt(TPoint(), bitmapTarget);
	aGc->Deactivate();
	CleanupStack::PopAndDestroy(5, bitmapTarget); //sourceAlpha, source, bitmapGc, bitmapDevice, bitmapTarget
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:59,代码来源:talphablend.cpp

示例3: CompareScreenContentWithTestBitmapL

TBool CTestContainer::CompareScreenContentWithTestBitmapL(const CBitmapFrameData& aBkgdFrame, const CBitmapFrameData& aFrame1, const TPoint& aPos)
	{
	TSize size = aFrame1.Bitmap()->SizeInPixels();

	// Create test bitmap for comparison 
	CFbsBitmap* testBitmap = new (ELeave) CFbsBitmap;
	CleanupStack::PushL(testBitmap);
	User::LeaveIfError( testBitmap->Create(size, iEikonEnv->DefaultDisplayMode()));
	CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(testBitmap);
	CleanupStack::PushL(bitmapDevice);
	CFbsBitGc* bitmapGc = CFbsBitGc::NewL();
	CleanupStack::PushL(bitmapGc);
	bitmapGc->Activate(bitmapDevice);
	// Blit the background bitmap
	bitmapGc->BitBlt(aPos, aBkgdFrame.Bitmap());
	// Blit the frame bitmap with mask
	bitmapGc->BitBltMasked(aPos, aFrame1.Bitmap(), size, aFrame1.Mask(), ETrue);
	
	// Create bitmap and blit the screen contents into it for comparing it with test bitmap created above
	TRect rect(aPos,size);
	CFbsBitmap* scrBitmap = new (ELeave) CFbsBitmap;
	CleanupStack::PushL(scrBitmap);
	User::LeaveIfError(scrBitmap->Create(size, iEikonEnv->DefaultDisplayMode()) );
	User::LeaveIfError( iEikonEnv->ScreenDevice()->CopyScreenToBitmap(scrBitmap,rect) );
	
	TBool ret=CompareBitmapsL(testBitmap,scrBitmap);	

	CleanupStack::PopAndDestroy(4);	//scrBitmap, bitmapGc, bitmapDevice, testBitmap
	return ret;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:30,代码来源:TBMPAnimStep.cpp

示例4: CopyBitmapL

/**
Copy a bitmap into another bitmap (generally in a different displaymode)
tiles destination bitmap with source
*/
void CTe_graphicsperformanceSuiteStepBase::CopyBitmapL(CFbsBitmap* aDst, CFbsBitmap* aSrc)
	{
	TSize srcSize = aSrc->SizeInPixels();
	TSize dstSize = aDst->SizeInPixels();
	CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(aDst);
	CleanupStack::PushL(dev);
	CFbsBitGc* gc = NULL;
	if ( 0 == dev->CreateContext(gc) )
		{
		CleanupStack::PushL(gc);
		TPoint point;
		gc->SetBrushColor(TRANSPARENT_BLACK);
		gc->SetBrushStyle(CGraphicsContext::ENullBrush);
		gc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
		gc->Clear();
		gc->SetDrawMode(CGraphicsContext::EDrawModePEN);
		for(point.iY=0; point.iY<dstSize.iHeight; point.iY+=srcSize.iHeight)
			{
			for(point.iX=0; point.iX<dstSize.iWidth; point.iX+=srcSize.iWidth)
				{
				gc->BitBlt(point, aSrc);
				}
			}
		CleanupStack::PopAndDestroy(gc);
		}
	CleanupStack::PopAndDestroy(dev);
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:31,代码来源:te_graphicsperformanceSuiteStepBase.cpp

示例5: End

/**
Completes a pass of this render stage.
*/
void CTestRenderStage::End()
	{
	CFbsBitGc* gc =  iBackBuffer->GetBitGcCurrent();
	gc->SetPenSize(TSize(2,2));
	gc->SetPenColor(KRgbRed);
	gc->DrawLine(TPoint(50,0),TPoint(0,50));
	gc->SetPenColor(KRgbGreen);
	gc->DrawLine(TPoint(60,0),TPoint(0,60));
	
	if (Next())
		{
		gc = Next()->Begin();
		const TRegion* region = iScreenRedraw->AnimationRegion();
		if(region && !region->IsEmpty() && !region->CheckError())
			{
			if (iBackBuffer->Observer())
				iBackBuffer->Observer()->BeforeUpdate(*iBackBuffer,*region);
			
			gc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
			gc->SetClippingRegion(region);
			gc->BitBlt(-iScreenConfig->ScaledOrigin(),iBackBuffer->GetBitmap());
			gc->SetDrawMode(CGraphicsContext::EDrawModePEN);
			gc->CancelClipping();
			
			if (iBackBuffer->Observer())
				iBackBuffer->Observer()->AfterUpdate(*iBackBuffer,*region);
			}
		Next()->End();
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:33,代码来源:t_testrenderstage.cpp

示例6: LoadPartialBitmapL

void AknBitmapMirrorUtils::LoadPartialBitmapL(CFbsBitmap* aBitmap, const TDesC& aFileName,TInt32 aId, TRect aRect, TBool aMirrorHorizontally)
    {
    CFbsBitmap* destinationBitmap = aBitmap;
    User::LeaveIfNull(destinationBitmap);

    CFbsBitmap* sourceBitmap = new (ELeave) CFbsBitmap();   
    CleanupStack::PushL(sourceBitmap);   
    User::LeaveIfError(sourceBitmap->Load(aFileName, aId, ETrue));    
    TSize sourceBitmapSize = sourceBitmap->SizeInPixels();
    
    TRect sourceRect = TRect(aRect);
    if (sourceRect == KWholeBitmapRect)
        {
        sourceRect.iTl.iX = 0;
        sourceRect.iTl.iY = 0;
        sourceRect.iBr.iX = sourceBitmapSize.iWidth;
        sourceRect.iBr.iY = sourceBitmapSize.iHeight;
        }
      
    TSize destinationBitmapSize(sourceRect.Width(), sourceRect.Height()); 
    User::LeaveIfError(destinationBitmap->Create(destinationBitmapSize, sourceBitmap->DisplayMode()));

    CFbsBitmapDevice* destinationDevice = CFbsBitmapDevice::NewL( destinationBitmap );
    CleanupStack::PushL(destinationDevice);

    CFbsBitGc* destinationGc;
    User::LeaveIfError( destinationDevice->CreateContext( destinationGc ) );

    if (aMirrorHorizontally)
        {
        TRect sourceBitmapBlittingRect( sourceRect.iTl.iX,sourceRect.iTl.iY,sourceRect.iTl.iX + 1,sourceRect.iBr.iY );  
    
        for ( TInt xPos=destinationBitmapSize.iWidth-1; xPos >= 0; xPos-- )
            {
            destinationGc->BitBlt( TPoint(xPos,0), sourceBitmap, sourceBitmapBlittingRect );
            sourceBitmapBlittingRect.iTl.iX++;
            sourceBitmapBlittingRect.iBr.iX++;
            }
        }
    else
        {
        destinationGc->BitBlt( TPoint(0,0), sourceBitmap, sourceRect );
        }

    delete destinationGc;  
    CleanupStack::PopAndDestroy(2); // sourceBitmap, destinationDevice
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:47,代码来源:AknBitmapMirrorUtils.cpp

示例7: DoDrawBitmapL

/**
Draws a stretched bitmap with or without a mask.

@param aUseMask set to ETrue to use a alpha mask. Normally used for 16MU display modes that do not store the alpha.
@param aSrcMode is the source display mode
@param aDstMode is the destination display mode
@param aSession is the windows server session
@param aWindow is a reference to the window
@param aGc is the graphics context of the window
@param aNumIterations is the number of iterations to run the test
*/
void CAlphaBlendTest::DoDrawBitmapL(TBool aUseMask, TDisplayMode aSrcMode, TDisplayMode aDstMode, RWsSession& aSession, RWindow& aWindow, CWindowGc* aGc, TInt aNumIterations)
	{		
	const TSize bitmapSize = aWindow.Size();
	
	// Construct target bitmap.
	CFbsBitmap* bitmapTarget = CreateSoftwareBitmapLC(bitmapSize, aDstMode);
	CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmapTarget);
	CleanupStack::PushL(bitmapDevice);
	
	// Construct GC.
	CFbsBitGc* bitmapGc = NULL;
	User::LeaveIfError(bitmapDevice->CreateContext(bitmapGc));
	CleanupStack::PushL(bitmapGc);
	
	// Construct source bitmap.	
	TSize smallerSize(bitmapSize.iWidth/2,  bitmapSize.iHeight/2);
	CFbsBitmap* source = CreateSoftwareBitmapLC(smallerSize, aSrcMode);
	VerticalGradientAlphaL(source, TRgb(0x00000000), TRgb(0xffffffff));	
	CFbsBitmap* sourceAlpha = CreateSoftwareBitmapLC(smallerSize, EGray256);	// match size to src
	VerticalGradientAlphaL(sourceAlpha, TRgb(0x01010101), TRgb(0xfefefefe));
		
	bitmapGc->SetBrushStyle(CGraphicsContext::ENullBrush);
	bitmapGc->SetBrushColor(TRANSPARENT_BLACK);
	bitmapGc->Clear();
	bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
	aGc->Activate(aWindow);
	TPoint point(0,0);
	bitmapGc->BitBlt(point, bitmapTarget);
	aGc->Deactivate();
	aSession.Flush();

	TBuf <20> testName;
	if (!aUseMask)
		{
		testName=_L("DrawBitmap");
		iProfiler->InitResults();
		for(int i=0; i<aNumIterations; i++)
			{
			bitmapGc->DrawBitmap(TRect(point, bitmapSize), source);
			iProfiler->MarkResultSetL();
			}
		}
	else
		{
		testName=_L("DrawBitmapMasked");
		iProfiler->InitResults();
		for(int i=0; i<aNumIterations; i++)
			{
			bitmapGc->DrawBitmapMasked(TRect(point, bitmapSize), source,TRect(point, smallerSize), sourceAlpha, EFalse);
			iProfiler->MarkResultSetL();
			}
		}
	INFO_PRINTF4(_L("%S(Stretched) with src = %S, dst = %S"), &testName, &ColorModeName(aSrcMode), &ColorModeName(aDstMode));
	iProfiler->ResultsAnalysis(testName, 0, aSrcMode, aDstMode, aNumIterations);
	// copy up to screen for sanity check
	BitBlt(aSession, aWindow, aGc, *bitmapTarget);
	CleanupStack::PopAndDestroy(5, bitmapTarget);
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:69,代码来源:talphablend.cpp

示例8: DrawBitmap

// CFepLayoutChoiceList::DrawBitmap
// Draw bitmap helper function.
// (other items were commented in a header).
// ---------------------------------------------------------------------------
//
void CFepLayoutChoiceList::DrawBitmap(const TRect& aDestRect, const TRect& aSrcRect, 
                                      CFbsBitmap* aBmp, TBool aFast)
    {
    CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc());
    if( aFast )
        {
         gc->BitBlt(aDestRect.iTl, aBmp, aSrcRect);
        }
    else
        {
        gc->DrawBitmap(aDestRect, aBmp, aSrcRect);
        }
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:18,代码来源:peninputlayoutchoicelist.cpp

示例9:

void CTap2MenuAppUi::CopyBitmapL(CFbsBitmap *aSource, CFbsBitmap *aTarget)
	{
	if(aSource != NULL && aTarget != NULL)
		{
		if(aSource->SizeInPixels() != aTarget->SizeInPixels() || aSource->DisplayMode() != aTarget->DisplayMode())
			{User::Leave(KErrArgument);}
		CFbsBitmapDevice* device = CFbsBitmapDevice::NewL(aTarget);
		CleanupStack::PushL(device);
		CFbsBitGc* gc = NULL;
		User::LeaveIfError(device->CreateContext(gc));
		CleanupStack::PushL(gc);
		gc->BitBlt(TPoint(0, 0), aSource);
		CleanupStack::PopAndDestroy(gc);
		CleanupStack::PopAndDestroy(device);
		}
	}
开发者ID:kolayuk,项目名称:Tap2Menu,代码行数:16,代码来源:Tap2MenuAppUi.cpp

示例10: CopyBitmapL

class CFbsBitmap* WFBitmapUtil::CopyBitmapL(class CFbsBitmap* aBitmap)
{
   if (!aBitmap) {
      return NULL;
   }
   class CFbsBitmap* copiedBitmap = new (ELeave) CFbsBitmap();
   copiedBitmap->Create(aBitmap->SizeInPixels(), aBitmap->DisplayMode());

   CFbsBitmapDevice* fbsdev = CFbsBitmapDevice::NewL(copiedBitmap);
   CleanupStack::PushL(fbsdev);
   CFbsBitGc* fbsgc = CFbsBitGc::NewL();
   CleanupStack::PushL(fbsgc);
   fbsgc->Activate(fbsdev);
   fbsgc->BitBlt(TPoint(0,0),aBitmap);
   CleanupStack::PopAndDestroy(2);
   return copiedBitmap;
}
开发者ID:VLjs,项目名称:Wayfinder-S60-Navigator,代码行数:17,代码来源:WFBitmapUtil.cpp

示例11: CopyIntoNewBitmapL

/**
Copy a source bitmap into a new bitmap with the specified display mode
*/
CFbsBitmap* CTe_graphicsperformanceSuiteStepBase::CopyIntoNewBitmapL(CFbsBitmap* aSrc, TDisplayMode aDisplayMode)
	{
	CFbsBitmap* dstBmp = new(ELeave) CFbsBitmap;
	CleanupStack::PushL(dstBmp);
	TInt ret=dstBmp->Create(aSrc->SizeInPixels(), aDisplayMode);
	User::LeaveIfError(ret);
	CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(dstBmp);
	CleanupStack::PushL(bitmapDevice);
	CFbsBitGc* gc;
	ret = bitmapDevice->CreateContext(gc);
	User::LeaveIfError(ret);
	CleanupStack::PushL(gc);
	gc->BitBlt(TPoint(0,0), aSrc);
	CleanupStack::PopAndDestroy(2, bitmapDevice); // gc, bitmapDevice
	CleanupStack::Pop(dstBmp);
	return dstBmp;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:20,代码来源:te_graphicsperformanceSuiteStepBase.cpp

示例12: CopyScreenToBitmapL

/**
Auxilary function called to Copy the screen to bitmap (mbm) file.
@param aHashIndex contains hashID. Bitmap is created with the aHashIndex as name
*/
EXPORT_C void CTHashReferenceImages::CopyScreenToBitmapL(const TDesC& aHashIndex)
	{
	CFbsBitmap *bitmap = new(ELeave)CFbsBitmap();
	CleanupStack::PushL(bitmap);
	User::LeaveIfError(bitmap->Create(iBitmapDevice->SizeInPixels(), iBitmapDevice->DisplayMode()));
	TRect rect = TRect(iBitmapDevice->SizeInPixels());
	CFbsBitmapDevice *device=CFbsBitmapDevice::NewL(bitmap);
	CleanupStack::PushL(device);
	CFbsBitGc *gc;
	User::LeaveIfError(device->CreateContext(gc));
	gc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
	gc->BitBlt(TPoint(), iBitmap, rect);
	TFileName mbmFile;
	mbmFile.Format(iPath->Des(), &aHashIndex);
	bitmap->Save(mbmFile);
	delete gc;
	CleanupStack::PopAndDestroy(2);
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:22,代码来源:thashreferenceimages.cpp

示例13: BitBlt

// -----------------------------------------------------------------------------
// CMaskedBitmap::BitBlt
// -----------------------------------------------------------------------------
void CMaskedBitmap::BitBlt( CFbsBitGc& aContext, const TPoint& aPoint ) const
    {
    TSize s(iBitmap->SizeInPixels());
    if (!(s.iWidth>0 && s.iHeight>0))
        {
        return;
        }
    if( iBitmap->Handle() )
        {
        if( iMask->Handle() )
            {
            aContext.BitBltMasked( aPoint, iBitmap, s, iMask, iInvertMask );
            }
        else
            {
            aContext.BitBlt( aPoint, iBitmap, s );
            }
        }
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:22,代码来源:MaskedBitmap.cpp

示例14: CreateBitmapOptimizedL

CFbsBitmap* AknBitmapMirrorUtils::CreateBitmapOptimizedL(CFbsBitmap* aSourceBitmap, TInt aMirrorDirection)
    {
    // Check if displaymode is optimized, fallback to non-optimized version if not.
    TBool fallback = ETrue;
    TDisplayMode displayMode = aSourceBitmap->DisplayMode();
    switch( displayMode )
        {
        case EGray256:
        case EColor256:
        case EColor4K:
        case EColor64K:
            fallback = EFalse;
            break;
        default:
            fallback = ETrue;
        }

    // Check if mirroring mode is supported, fallback to non-optimized version if not.
	if ((aMirrorDirection != EAknVerticalMirroring) && (aMirrorDirection != EAknHorizontalMirroring))
		{
		fallback = ETrue;	
		}

    if( fallback )
		return CreateBitmapL(aSourceBitmap, aMirrorDirection);
    
	// Prepare destination bitmap
    User::LeaveIfNull(aSourceBitmap);
    CFbsBitmap* destinationBitmap = new (ELeave) CFbsBitmap();
    CleanupStack::PushL(destinationBitmap);   

    TSize sourceBitmapSize = aSourceBitmap->SizeInPixels();            
    TRect sourceRect = TRect(TPoint(0,0), sourceBitmapSize);
    TSize destinationBitmapSize(sourceRect.Width(), sourceRect.Height()); 

    User::LeaveIfError(destinationBitmap->Create(destinationBitmapSize, aSourceBitmap->DisplayMode()));

	// Check source, if rom bitmap or compressed then create uncompressed ram bitmap
    TBool srcTemporary = EFalse;
    if( aSourceBitmap->IsRomBitmap() )
        {
        srcTemporary = ETrue;
        }
        
    // Heap lock for FBServ large chunk to prevent background
    // compression of aSrcBitmap after if IsCompressedInRAM returns EFalse
    aSourceBitmap->LockHeapLC( ETrue ); // fbsheaplock
    TBool fbsHeapLock = ETrue;        
        
    if( aSourceBitmap->IsCompressedInRAM() )
        {
        srcTemporary = ETrue;
        }
    if( aSourceBitmap->ExtendedBitmapType() != KNullUid  )
        {
        srcTemporary = ETrue;
        }

    CFbsBitmap* realSource = aSourceBitmap;
    if( srcTemporary )
        {
        CleanupStack::PopAndDestroy(); // fbsheaplock
        fbsHeapLock = EFalse;
        
        realSource = new (ELeave) CFbsBitmap();
        CleanupStack::PushL( realSource );
        User::LeaveIfError( realSource->Create( sourceBitmapSize, aSourceBitmap->DisplayMode() ) );
        CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL( realSource );
        CleanupStack::PushL( dev );
        CFbsBitGc* gc = NULL;
        User::LeaveIfError( dev->CreateContext( gc ) );
        CleanupStack::PushL( gc );
        gc->BitBlt( TPoint(0,0), aSourceBitmap );
        CleanupStack::PopAndDestroy(2); // dev, gc
        }

	// Heap lock for FBServ large chunk is only needed with large bitmaps.
    if (!fbsHeapLock)
    	{
	    if ( realSource->IsLargeBitmap() || destinationBitmap->IsLargeBitmap() )
	        {
	        destinationBitmap->LockHeapLC( ETrue ); // fbsheaplock
	        }
	    else
	        {
	        CleanupStack::PushL( (TAny*)NULL );
	        }
    	}

    TUint32* srcAddress = realSource->DataAddress();
    TUint32* trgAddress = destinationBitmap->DataAddress();

    if ( displayMode == EColor4K || displayMode == EColor64K )
        {
        TInt srcScanLen16 = CFbsBitmap::ScanLineLength(sourceBitmapSize.iWidth, displayMode) / 2;
        TInt trgScanLen16 = CFbsBitmap::ScanLineLength(destinationBitmapSize.iWidth, displayMode) / 2;
        TInt srcScanLen32 = CFbsBitmap::ScanLineLength(sourceBitmapSize.iWidth, displayMode) / 4;
        TInt trgScanLen32 = CFbsBitmap::ScanLineLength(destinationBitmapSize.iWidth, displayMode) / 4;

	    switch (aMirrorDirection)
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:101,代码来源:AknBitmapMirrorUtils.cpp

示例15: ConstructL

/*
 * Landmark objects will make use of an SVG file for rendering (demo purposes)
 */
void CLMXObject::ConstructL()
{
    _LIT(KIconFile, "\\resource\\apps\\Landmarks_0x2002E1AF.mif");

    CGulIcon* icon = CreateIconL(KIconFile, EMbmLandmarks_0x2002e1afIcon, EMbmLandmarks_0x2002e1afIcon_mask);
    CleanupStack::PushL(icon);

    CFbsBitmap* bitmap = icon->Bitmap();    // Ownership NOT transferred
    CFbsBitmap* mask   = icon->Mask();      // Ownership NOT transferred

    // Always expect 16M bitmap to make conversion to GL_RGBA easier 
    if (bitmap->DisplayMode() != EColor16M)
    {
        bitmap = new(ELeave) CFbsBitmap;
        CleanupStack::PushL(bitmap);

        User::LeaveIfError(bitmap->Create(icon->Bitmap()->SizeInPixels(), EColor16M));

        CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmap);
        CleanupStack::PushL(bitmapDevice);

        CFbsBitGc* bitmapContext = 0;
        User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext));
        CleanupStack::PushL(bitmapContext);

        bitmapContext->BitBlt(TPoint(0, 0), icon->Bitmap());

        CleanupStack::PopAndDestroy(2, bitmapDevice);

        icon->SetBitmap(bitmap);    // Ownership transferred

        CleanupStack::Pop(bitmap);
    }

    // Always expect 256 mask to make conversion to GL_RGBA easier 
    if (mask->DisplayMode() != EGray256)
    {
        mask = new(ELeave) CFbsBitmap;
        CleanupStack::PushL(mask);

        User::LeaveIfError(mask->Create(icon->Mask()->SizeInPixels(), EGray256));

        CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(mask);
        CleanupStack::PushL(bitmapDevice);

        CFbsBitGc* bitmapContext = 0;
        User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext));
        CleanupStack::PushL(bitmapContext);

        bitmapContext->BitBlt(TPoint(0, 0), icon->Mask());

        CleanupStack::PopAndDestroy(2, bitmapDevice);

        icon->SetMask(mask);    // Ownership transferred

        CleanupStack::Pop(mask);
    }

    // Now bitmap and mask point to either original or converted bitmaps, 
    // and ownership belongs to icon

    const TSize bitmapSize = bitmap->SizeInPixels();

    // sizeof(TUint32) == sizeof(RGBA)
    const TInt dataSize = bitmapSize.iWidth * bitmapSize.iHeight * sizeof(TUint32);
    TUint8* data = new(ELeave) TUint8[dataSize];

    // Perform copy and conversion from BGR(A) to RGB(A)
    bitmap->LockHeap();
    mask->LockHeap();

    // TODO: Alpha component removed, as it seems to be corrupted from
    // subsequent reads from SVG file

    TUint8* rgb = reinterpret_cast<TUint8*>(bitmap->DataAddress());
//    TUint8* alpha = reinterpret_cast<TUint8*>(mask->DataAddress());

    for(TInt i = 0, j = 0; i < dataSize; i += 4, j += 3)
    {
        data[i + 0] = rgb[j + 2];
        data[i + 1] = rgb[j + 1];
        data[i + 2] = rgb[j + 0];
        data[i + 3] = 0xc0; //alpha[i / 4];
    }

    // Generate OpenGL texture
    ::glGenTextures(1, &iTextureId); 
    ::glBindTexture(GL_TEXTURE_2D, iTextureId);

    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

    ::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bitmapSize.iWidth, bitmapSize.iHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);

    mask->UnlockHeap();
//.........这里部分代码省略.........
开发者ID:DavidCaabeiro,项目名称:openmar,代码行数:101,代码来源:Object.cpp


注:本文中的CFbsBitGc::BitBlt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。