本文整理汇总了C++中CFbsBitmap::SizeInPixels方法的典型用法代码示例。如果您正苦于以下问题:C++ CFbsBitmap::SizeInPixels方法的具体用法?C++ CFbsBitmap::SizeInPixels怎么用?C++ CFbsBitmap::SizeInPixels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFbsBitmap
的用法示例。
在下文中一共展示了CFbsBitmap::SizeInPixels方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawIconL
static void DrawIconL(CWindowGc& aGc, CGulIcon& aIcon, const TJuikLayoutItem& aL, TBool aDoCenter=ETrue)
{
CALLSTACKITEMSTATIC_N(_CL(""), _CL("DrawIconL"));
CFbsBitmap* bmp = aIcon.Bitmap();
CFbsBitmap* mask = aIcon.Mask();
aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
// center
TInt bmpW = bmp->SizeInPixels().iWidth;
TInt areaW = aL.Size().iWidth;
TInt dx = 0;
TInt dy = 0;
if ( aDoCenter && bmpW < areaW )
{
dx = (areaW - bmpW) / 2;
}
TPoint tl = aL.TopLeft();
tl += TPoint(dx,dy);
TRect r(TPoint(0,0), bmp->SizeInPixels());
if ( mask )
{
aGc.BitBltMasked( tl, bmp, r, mask, ETrue);
}
else
{
aGc.BitBlt( tl, bmp, r);
}
}
示例2: AConvolute64KBlurGauss
void AConvolute64KBlurGauss( CFbsBitmap& aTarget,
const CFbsBitmap& aSource,
const TInt aBlendFactor )
{
TInt width = aTarget.SizeInPixels().iWidth;
TInt height = aTarget.SizeInPixels().iHeight;
// CFbsBitmap::ScanLineLength returns bytes
TInt targetScanW = CFbsBitmap::ScanLineLength(
aTarget.SizeInPixels().iWidth,
aTarget.DisplayMode());
TInt sourceScanW = CFbsBitmap::ScanLineLength(
aSource.SizeInPixels().iWidth,
aSource.DisplayMode());
TInt combinedScanW = (targetScanW << 16) + sourceScanW;
// Prepare the data addresses
aTarget.LockHeap( ETrue ); // Lock the global bitmap heap
TUint* targetAddr = reinterpret_cast<TUint*>( aTarget.DataAddress() );
TUint* sourceAddr = reinterpret_cast<TUint*>( aSource.DataAddress() );
ADoConvolute64KBlurGauss(targetAddr, sourceAddr, combinedScanW, width, height, aBlendFactor);
aTarget.UnlockHeap( ETrue ); // Unlock the global bitmap heap
}
示例3: Compare
TBool CWsGceCscBase::Compare(CFbsBitmap& aBitmap1, CFbsBitmap& aBitmap2)
{
if ((aBitmap1.SizeInPixels() == aBitmap2.SizeInPixels()) &&
(aBitmap1.DisplayMode() == aBitmap2.DisplayMode()))
{
TSize size = aBitmap1.SizeInPixels();
TInt width = size.iWidth;
TInt height = size.iHeight;
TRgb color1, color2;
for (TInt i = 0; i < width; i++)
{
for (TInt j = 0; j < height; j++)
{
aBitmap1.GetPixel(color1, TPoint(i, j));
aBitmap2.GetPixel(color2, TPoint(i, j));
if (color1 != color2)
{
return EFalse;
}
}
}
return ETrue;
}
return EFalse;
}
示例4: fromNativeType
void QGLPixmapData::fromNativeType(void* pixmap, NativeType type)
{
if (type == QPixmapData::SgImage && pixmap) {
#if defined(QT_SYMBIAN_SUPPORTS_SGIMAGE) && !defined(QT_NO_EGL)
RSgImage *sgImage = reinterpret_cast<RSgImage*>(pixmap);
m_sgImage = new RSgImage;
m_sgImage->Open(sgImage->Id());
TSgImageInfo info;
sgImage->GetInfo(info);
w = info.iSizeInPixels.iWidth;
h = info.iSizeInPixels.iHeight;
d = symbianPixeFormatBitsPerPixel((TUidPixelFormat)info.iPixelFormat);
m_source = QVolatileImage();
m_hasAlpha = true;
m_hasFillColor = false;
m_dirty = true;
is_null = (w <= 0 || h <= 0);
#endif
} else if (type == QPixmapData::FbsBitmap && pixmap) {
CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap *>(pixmap);
QSize size(bitmap->SizeInPixels().iWidth, bitmap->SizeInPixels().iHeight);
if (size.width() == w && size.height() == h)
setSerialNumber(++qt_gl_pixmap_serial);
resize(size.width(), size.height());
m_source = QVolatileImage(bitmap);
if (pixelType() == BitmapType) {
m_source.ensureFormat(QImage::Format_MonoLSB);
} else if (!knownGoodFormat(m_source.format())) {
m_source.beginDataAccess();
QImage::Format format = idealFormat(m_source.imageRef(), Qt::AutoColor);
m_source.endDataAccess(true);
m_source.ensureFormat(format);
}
m_hasAlpha = m_source.hasAlphaChannel();
m_hasFillColor = false;
m_dirty = true;
d = m_source.depth();
} else if (type == QPixmapData::VolatileImage && pixmap) {
// Support QS60Style in more efficient skin graphics retrieval.
QVolatileImage *img = static_cast<QVolatileImage *>(pixmap);
if (img->width() == w && img->height() == h)
setSerialNumber(++qt_gl_pixmap_serial);
resize(img->width(), img->height());
m_source = *img;
m_hasAlpha = m_source.hasAlphaChannel();
m_hasFillColor = false;
m_dirty = true;
d = m_source.depth();
} else if (type == QPixmapData::NativeImageHandleProvider && pixmap) {
destroyTexture();
nativeImageHandleProvider = static_cast<QNativeImageHandleProvider *>(pixmap);
// Cannot defer the retrieval, we need at least the size right away.
createFromNativeImageHandleProvider();
}
}
示例5: ProcessRgbToRgb
//------------------------------------------------------------------------
static void ProcessRgbToRgb( const CFbsBitmap& aTarget,
const CFbsBitmap& aSource,
const TInt aTreshold,
const TInt aBlendFactor )
{
// ScanLineLength returns bytes, but width must match the Type
TInt width = CFbsBitmap::ScanLineLength( aSource.SizeInPixels().iWidth,
aSource.DisplayMode() ) / sizeof(Type);
TInt height = aSource.SizeInPixels().iHeight;
TInt pixelCount = width * height;
TInt shade;
TInt r,g,b;
aTarget.LockHeap( ETrue ); // Lock the global bitmap heap
Type* dataT = reinterpret_cast<Type*>( aTarget.DataAddress() );
Type* dataS = reinterpret_cast<Type*>( aSource.DataAddress() );
for( TInt index = 0; index < pixelCount; ++index )
{
r = AknsRlRgb<Type,X,R,G,B>::R8(*dataS);
g = AknsRlRgb<Type,X,R,G,B>::G8(*dataS);
b = AknsRlRgb<Type,X,R,G,B>::B8(*dataS);
// Pixel intensity = grayscale value
shade = AknsRlUtil::Grayscale( TUint8(r), TUint8(g), TUint8(b) );
// Convert to B&W
if( shade < aTreshold )
shade = 0;
else
shade = 255;
// Exposure blending
// Note: It is assumed that arithmetic shifting is supported
// -> negative values are shifted correctly
r = (shade * aBlendFactor + (255 - aBlendFactor) * r) >> 8;
g = (shade * aBlendFactor + (255 - aBlendFactor) * g) >> 8;
b = (shade * aBlendFactor + (255 - aBlendFactor) * b) >> 8;
if( r < 0 ) r = 0; else if( r > 255 ) r = 255;
if( g < 0 ) g = 0; else if( g > 255 ) g = 255;
if( b < 0 ) b = 0; else if( b > 255 ) b = 255;
AknsRlRgb<Type,X,R,G,B>::SetRgb8( dataT, TUint8(r), TUint8(g), TUint8(b) );
dataT++;
dataS++;
}
aTarget.UnlockHeap( ETrue ); // Unlock the global bitmap heap
}
示例6: fromNativeType
void QVGPixmapData::fromNativeType(void* pixmap, NativeType type)
{
if (type == QPixmapData::SgImage && pixmap) {
#if defined(QT_SYMBIAN_SUPPORTS_SGIMAGE) && !defined(QT_NO_EGL)
RSgImage *sgImage = reinterpret_cast<RSgImage*>(pixmap);
destroyImages();
prevSize = QSize();
vgImage = sgImageToVGImage(context, *sgImage);
if (vgImage != VG_INVALID_HANDLE) {
w = vgGetParameteri(vgImage, VG_IMAGE_WIDTH);
h = vgGetParameteri(vgImage, VG_IMAGE_HEIGHT);
d = 32; // We always use ARGB_Premultiplied for VG pixmaps.
}
is_null = (w <= 0 || h <= 0);
source = QVolatileImage(); // readback will be done later, only when needed
recreate = false;
prevSize = QSize(w, h);
updateSerial();
#endif
} else if (type == QPixmapData::FbsBitmap && pixmap) {
CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap *>(pixmap);
QSize size(bitmap->SizeInPixels().iWidth, bitmap->SizeInPixels().iHeight);
resize(size.width(), size.height());
source = QVolatileImage(bitmap); // duplicates only, if possible
if (source.isNull())
return;
if (!conversionLessFormat(source.format())) {
// Here we may need to copy if the formats do not match.
// (e.g. for display modes other than EColor16MAP and EColor16MU)
source.beginDataAccess();
QImage::Format format = idealFormat(&source.imageRef(), Qt::AutoColor);
source.endDataAccess(true);
source.ensureFormat(format);
}
recreate = true;
} else if (type == QPixmapData::VolatileImage && pixmap) {
QVolatileImage *img = static_cast<QVolatileImage *>(pixmap);
resize(img->width(), img->height());
source = *img;
recreate = true;
} else if (type == QPixmapData::NativeImageHandleProvider && pixmap) {
destroyImages();
nativeImageHandleProvider = static_cast<QNativeImageHandleProvider *>(pixmap);
// Cannot defer the retrieval, we need at least the size right away.
createFromNativeImageHandleProvider();
}
}
示例7: ConstructL
void CAlfPerfAppAvkonTestCaseBasic::ConstructL(
CAlfEnv& aEnv, TInt aCaseId, const TRect& aVisibleArea )
{
CAlfPerfAppBaseTestCaseControl::ConstructL( aEnv, aCaseId, aVisibleArea );
iWinRect = aVisibleArea;
iAvkonControl = new(ELeave) CAvkonTestCoeControl();
iAvkonControl->ConstructL(iWinRect);
iAnimTimer = CPeriodic::NewL(CActive::EPriorityStandard);
TFontSpec myFontSpec(_L("Arial"), 3*120);
CCoeEnv::Static()->ScreenDevice()->GetNearestFontInTwips(iFont, myFontSpec);
// Find my private path
TFileName pathWithoutDrive;
TFileName driveAndPath;
CEikonEnv::Static()->FsSession().PrivatePath( pathWithoutDrive );
driveAndPath.Copy(CEikonEnv::Static()->EikAppUi()->Application()->AppFullName().Left(2));
driveAndPath.Append(pathWithoutDrive);
// Create pictures
iPictureBm = new(ELeave) CFbsBitmap;
driveAndPath.Append(_L("alfperfapp_test1.mbm"));
User::LeaveIfError(iPictureBm->Load(driveAndPath));
iMaskBm = new(ELeave) CFbsBitmap;
User::LeaveIfError(iMaskBm->Create(iPictureBm->SizeInPixels(), EGray256));
iTestCaseStartTime_ys.UniversalTime();
iTestCaseFrameCount = 0;
}
示例8: VerifyBitmapFormatL
TBool CScreenCaptureUtil::VerifyBitmapFormatL(const CFbsBitmap& aBitmap)
{
RSurfaceManager::TInfoBuf infoBuf;
RSurfaceManager::TSurfaceInfoV01& info = infoBuf();
User::LeaveIfError(iSurfaceManager.SurfaceInfo(iLocalSurface, infoBuf));
return ((info.iSize == aBitmap.SizeInPixels()) && (EColor16MU == aBitmap.DisplayMode()));
}
示例9: Copy
// -----------------------------------------------------------------------------
// CMaskedBitmap::Copy
// -----------------------------------------------------------------------------
TInt CMaskedBitmap::Copy( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask, TBool aDuplicate )
{
Reset();
TInt bitmapHandle( aBitmap.Handle() );
TInt maskHandle( aMask.Handle() );
if( bitmapHandle && maskHandle &&
aBitmap.SizeInPixels() != aMask.SizeInPixels() )
{
return KErrArgument;
}
TInt err( KErrNone );
if( bitmapHandle )
{
if( aDuplicate )
{
err = iBitmap->Duplicate( bitmapHandle );
}
else
{
err = BitmapUtil::CopyBitmap( aBitmap, *iBitmap );
}
}
if( !err && maskHandle )
{
if( aDuplicate )
{
err = iMask->Duplicate( maskHandle );
}
else
{
err = BitmapUtil::CopyBitmap( aMask, *iMask );
}
if( err )
{
iBitmap->Reset();
}
}
return err;
}
示例10: Draw
void CPointerCursorWindow::Draw()
{
iGc->Reset();
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
iGc->DrawRect(Size());
if (iBitmap)
{
TPoint point(3,3);
if (!iTop)
point.iY=Size().iHeight-iBitmap->SizeInPixels().iHeight-3;
iGc->BitBlt(point,iBitmap);
}
}
示例11: Draw
void CUploadContainer::Draw(const TRect& aRect) const
{
CALLSTACKITEM_N(_CL("CUploadContainer"), _CL("Draw"));
CWindowGc& gc = SystemGc();
gc.SetPenStyle(CGraphicsContext::ENullPen);
gc.SetBrushColor(KRgbWhite);
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.DrawRect(aRect);
gc.SetPenStyle(CGraphicsContext::ESolidPen);
gc.SetBrushStyle(CGraphicsContext::ENullBrush);
TGulBorder border(TGulBorder::ESingleGray);
TRect edit_rect=iTagEdit->Rect();
edit_rect.Resize(4, 4);
edit_rect.Move(-2, -2);
border.Draw(gc, edit_rect);
if (iDescriptionEdit) {
edit_rect=iDescriptionEdit->Rect();
edit_rect.Resize(4, 4);
edit_rect.Move(-2, -2);
border.Draw(gc, edit_rect);
}
if (iSelected) {
TGulBorder border(TGulBorder::ESingleBlack);
//gc.SetPenColor(KRgbBlack);
TRect edit_rect=iSelected->Rect();
edit_rect.Resize(4, 4);
edit_rect.Move(-2, -2);
border.Draw(gc, edit_rect);
}
if (iActive) {
TGulBorder border(TGulBorder::EFocusedSunkenControl);
//gc.SetPenColor(KRgbBlack);
TRect edit_rect=iActive->Rect();
edit_rect.Resize(4, 4);
edit_rect.Move(-2, -2);
border.Draw(gc, edit_rect);
}
if (scaled) {
TSize s=iScaledBitmap->SizeInPixels();
TPoint lt=TPoint( (Rect().Width()-s.iWidth)/2, 4);
TRect r( lt, s);
gc.DrawBitmap(r, iScaledBitmap);
}
}
示例12: MvpuoFrameReady
void CTestStepVidPlayerDRMGetFrame::MvpuoFrameReady(CFbsBitmap& aFrame, TInt aError)
{
iError = aError;
if (aError==KErrNone)
{
if (aFrame.Handle() == NULL || aFrame.SizeInPixels() != TSize(KFrameWidth,KFrameHeight) )
iError = KErrArgument;
else
{
iError = KErrNone;
INFO_PRINTF1(_L("MvpuoFrameReady: GetFrameL() COMPLETED OK"));
}
}
CActiveScheduler::Stop();
}
示例13: CopyBitmap
// ============================ MEMBER FUNCTIONS ===============================
// -----------------------------------------------------------------------------
// CMaskedBitmap::CopyBitmap
// -----------------------------------------------------------------------------
TInt BitmapUtil::CopyBitmap( const CFbsBitmap& aSource, CFbsBitmap& aDestination )
{
TSize size( aSource.SizeInPixels() );
TDisplayMode displayMode( aSource.DisplayMode() );
TInt err( aDestination.Create( size, displayMode ) );
if( !err )
{
err = BitmapUtil::CopyBitmapData( aSource, aDestination, size, displayMode );
if( err )
{
aDestination.Reset();
}
}
return err;
}
示例14: SimpleDrawBitmapL
/**
@SYMTestCaseID
GRAPHICS-UI-BENCH-0151
@SYMPREQ PREQ39
@SYMREQ REQ9236
@SYMREQ REQ9237
@SYMTestCaseDesc
Measures the performance of DrawBitmap() for the current screen mode, for various bitmap pixel formats.
The bitmap is drawn without scaling.
@SYMTestActions
Create a copy of the bitmap, and scale to the required size, prior to running the test.
For each required source pixel format, use DrawBitmap() to tile a bitmap across the target, avoiding any
clipping or overlap.
@SYMTestExpectedResults
The performance to be logged as a pixel rate, per bitmap.
*/
void CTBitBltPerfDirectGdi::SimpleDrawBitmapL()
{
INFO_PRINTF1(_L("CTBitBltPerfDirectGdi::SimpleDrawBitmap"));
_LIT(KTestName, "DirectGdiDrawBitmap");
for (TInt source = 0; source < iBitmapImage.Count(); ++source)
{
// Use a bitmap that needs no scaling.
CFbsBitmap* bitmapBitBltImage = CopyIntoNewBitmapL(iBitmapImage[source], iBitmapImage[source]->DisplayMode());
CleanupStack::PushL(bitmapBitBltImage);
bitmapBitBltImage->Resize(KCropTo.Size());
BitBltBitmapTestL(EDrawBitmap, bitmapBitBltImage, NULL, bitmapBitBltImage->SizeInPixels(), KTestName, iContext);
CleanupStack::PopAndDestroy(1, bitmapBitBltImage);
}
}
示例15: 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
}