diff options
author | Radek Doulik <rodo@novell.com> | 2010-09-15 11:27:19 +0200 |
---|---|---|
committer | Radek Doulik <rodo@novell.com> | 2010-09-15 17:54:14 +0200 |
commit | 0f0e1c12029ade01ff1780a5f5f93bf75e16eb3a (patch) | |
tree | 2725039772048cfdfe75e6c1b02a47025f245bd9 /vcl | |
parent | acd8f4caef83c5daf8bea61ace7e5024d192b413 (diff) |
vcl-grey-alpha-unix-sal-bitmap.diff: emf+ import
support 8bit alph bitmaps vcl(unx)
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/inc/salbmp.h | 4 | ||||
-rw-r--r-- | vcl/unx/source/gdi/salbmp.cxx | 45 |
2 files changed, 43 insertions, 6 deletions
diff --git a/vcl/unx/inc/salbmp.h b/vcl/unx/inc/salbmp.h index 2d02c7d6b9b4..925d7d135a2d 100644 --- a/vcl/unx/inc/salbmp.h +++ b/vcl/unx/inc/salbmp.h @@ -57,7 +57,8 @@ private: int nScreen, long nDrawableDepth, long nX, long nY, - long nWidth, long nHeight ); + long nWidth, long nHeight, + bool bGrey ); public: @@ -78,6 +79,7 @@ private: BitmapBuffer* mpDIB; ImplSalDDB* mpDDB; + bool mbGrey; public: diff --git a/vcl/unx/source/gdi/salbmp.cxx b/vcl/unx/source/gdi/salbmp.cxx index 3f8e8de564be..a23a49a24838 100644 --- a/vcl/unx/source/gdi/salbmp.cxx +++ b/vcl/unx/source/gdi/salbmp.cxx @@ -71,7 +71,8 @@ ULONG X11SalBitmap::mnCacheInstCount = 0; X11SalBitmap::X11SalBitmap() : mpDIB( NULL ), - mpDDB( NULL ) + mpDDB( NULL ), + mbGrey( false ) { } @@ -191,7 +192,8 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, int nScreen, long nDrawableDepth, long nX, long nY, - long nWidth, long nHeight ) + long nWidth, long nHeight, + bool bGrey ) { BitmapBuffer* pDIB = NULL; @@ -302,6 +304,21 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, rPal[ 0 ] = Color( COL_BLACK ); rPal[ 1 ] = Color( COL_WHITE ); } + else if( pImage->depth == 8 && bGrey ) + { + rPal.SetEntryCount( 256 ); + pDstPal = &rPal; + + for( USHORT i = 0; i < 256; i++ ) + { + BitmapColor& rBmpCol = rPal[ i ]; + + rBmpCol.SetRed( i ); + rBmpCol.SetGreen( i ); + rBmpCol.SetBlue( i ); + } + + } else if( aSrcBuf.mnBitCount <= 8 ) { const SalColormap& rColMap = pSalDisp->GetColormap( nScreen ); @@ -345,7 +362,8 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long mpDDB->ImplGetDepth(), 0, 0, mpDDB->ImplGetWidth(), - mpDDB->ImplGetHeight() ); + mpDDB->ImplGetHeight(), + mbGrey ); } if( mpDIB && mpDIB->mnWidth && mpDIB->mnHeight ) @@ -428,6 +446,20 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long (*pPal)[ 0 ] = Color( COL_BLACK ); (*pPal)[ 1 ] = Color( COL_WHITE ); } + else if( pImage->depth == 8 && mbGrey ) + { + pPal = new BitmapPalette( 256 ); + + for( USHORT i = 0; i < 256; i++ ) + { + BitmapColor& rBmpCol = (*pPal)[ i ]; + + rBmpCol.SetRed( i ); + rBmpCol.SetGreen( i ); + rBmpCol.SetBlue( i ); + } + + } else if( pImage->depth <= 8 ) { const SalColormap& rColMap = pSalDisp->GetColormap( nScreen ); @@ -592,7 +624,8 @@ ImplSalDDB* X11SalBitmap::ImplGetDDB( Drawable aDrawable, mpDDB->ImplGetDepth(), 0, 0, mpDDB->ImplGetWidth(), - mpDDB->ImplGetHeight() ); + mpDDB->ImplGetHeight(), + mbGrey ); } delete mpDDB, const_cast<X11SalBitmap*>(this)->mpDDB = NULL; @@ -755,6 +788,8 @@ bool X11SalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::s if( xFastPropertySet->getFastPropertyValue(bMask ? 2 : 1) >>= args ) { if( ( args[1] >>= pixmapHandle ) && ( args[2] >>= depth ) ) { + + mbGrey = bMask; bool bSuccess = ImplCreateFromDrawable( pixmapHandle, 0, depth, 0, 0, (long) rSize.Width(), (long) rSize.Height() ); bool bFreePixmap; if( bSuccess && (args[0] >>= bFreePixmap) && bFreePixmap ) @@ -824,7 +859,7 @@ BitmapBuffer* X11SalBitmap::AcquireBuffer( bool ) mpDIB = ImplCreateDIB( mpDDB->ImplGetPixmap(), mpDDB->ImplGetScreen(), mpDDB->ImplGetDepth(), - 0, 0, mpDDB->ImplGetWidth(), mpDDB->ImplGetHeight() ); + 0, 0, mpDDB->ImplGetWidth(), mpDDB->ImplGetHeight(), mbGrey ); } return mpDIB; |