if( !rBmp.GetSystemData( aBmpSysData ) ||
!aBmpSysData.pDIB )
{ // first of all, ensure that Bitmap contains a DIB, by // acquiring a read access
BitmapScopedReadAccess pReadAcc(rBmp);
// TODO(P2): Acquiring a read access can actually // force a read from VRAM, thus, avoiding this // step somehow will increase performance // here. if( pReadAcc )
{ // try again: now, WinSalBitmap must have // generated a DIB if( rBmp.GetSystemData( aBmpSysData ) &&
aBmpSysData.pDIB )
{ return drawDIBits( rGraphics,
aBmpSysData.pDIB );
}
}
} else
{ return drawDIBits( rGraphics,
aBmpSysData.pDIB );
}
// failed to generate DIBits from vcl bitmap returnfalse;
}
/** Create a chunk of raw RGBA data GDI+ Bitmap from VCL BitmapEx
*/
RawRGBABitmap bitmapFromVCLBitmapEx( const ::BitmapEx& rBmpEx )
{ // TODO(P2): Avoid temporary bitmap generation, maybe // even ensure that created DIBs are copied back to // BmpEx (currently, every AcquireReadAccess() will // make the local bitmap copy unique, effectively // duplicating the memory used)
ENSURE_OR_THROW( rBmpEx.IsAlpha(), "::dxcanvas::tools::bitmapFromVCLBitmapEx(): " "BmpEx has no alpha" );
// convert transparent bitmap to 32bit RGBA // ========================================
// TODO(P2): Might be advantageous // to hand-formulate the following // formats, too. case ScanlineFormat::N1BitMsbPal:
{
Scanline pAScan = pAlphaReadAccess->GetScanline( y );
// using fallback for those // seldom formats for( x=0; x<nWidth; ++x )
{ // yes. x and y are swapped on Get/SetPixel
aCol = pReadAccess->GetColor(y,x);
case ScanlineFormat::N24BitTcRgb: case ScanlineFormat::N32BitTcAbgr: case ScanlineFormat::N32BitTcArgb: case ScanlineFormat::N32BitTcBgra: case ScanlineFormat::N32BitTcRgba: case ScanlineFormat::N32BitTcXbgr: case ScanlineFormat::N32BitTcXrgb: case ScanlineFormat::N32BitTcBgrx: case ScanlineFormat::N32BitTcRgbx: default:
ENSURE_OR_THROW( false, "::dxcanvas::tools::bitmapFromVCLBitmapEx(): " "Unexpected scanline format - has " "WinSalBitmap::AcquireBuffer() changed?" );
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.