diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-03-15 14:35:20 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-03-15 15:24:53 +0000 |
commit | 188042ad5230e912f3149cc7ea1bb836e084069a (patch) | |
tree | c7e627a84aabb501f2d921f7110e9928e769599c /lotuswordpro | |
parent | c97aec0d2276901c20634abe53867f739f420f50 (diff) |
restore enough of XOBitmap to do fore/back color setting on escher patterns
i.e. restore the logic of setting the colors of imported escher patterns like
we always did in the past. Stripping that out seems risky in the absence of
definite test-cases.
Change-Id: I16bbb451b053fd04a5154602f8f38ed799e21286
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/source/filter/lwpbackgroundstuff.cxx | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/lotuswordpro/source/filter/lwpbackgroundstuff.cxx b/lotuswordpro/source/filter/lwpbackgroundstuff.cxx index 0c8deba1ac7f..46bd2ed88d01 100644 --- a/lotuswordpro/source/filter/lwpbackgroundstuff.cxx +++ b/lotuswordpro/source/filter/lwpbackgroundstuff.cxx @@ -65,6 +65,7 @@ #include "tools/stream.hxx" #include "vcl/bmpacc.hxx" +#include "svx/xbitmap.hxx" void LwpBackgroundStuff::Read(LwpObjectStream* pStrm) @@ -128,9 +129,37 @@ XFBGImage* LwpBackgroundStuff::GetFillPattern() pPttnArray = NULL; } - // transfer image data from Bitmap->SvStream->BYTE-Array + // create XOBitmap object from bitmap object + XOBitmap aXOBitmap( aBmp ); + aXOBitmap.Bitmap2Array(); + aXOBitmap.SetBitmapType( XBITMAP_8X8 ); + + // set back/fore-ground colors + if (m_aFillColor.IsValidColor() && m_aPatternColor.IsValidColor()) + { + Color aBackColor(static_cast<sal_uInt8>(m_aFillColor.GetRed()), + static_cast<sal_uInt8>(m_aFillColor.GetGreen()), + static_cast<sal_uInt8>(m_aFillColor.GetBlue())); + Color aForeColor(static_cast<sal_uInt8>(m_aPatternColor.GetRed()), + static_cast<sal_uInt8>(m_aPatternColor.GetGreen()), + static_cast<sal_uInt8>(m_aPatternColor.GetBlue())); + + if( aXOBitmap.GetBackgroundColor() == COL_BLACK ) + { + aXOBitmap.SetPixelColor( aBackColor ); + aXOBitmap.SetBackgroundColor( aForeColor ); + } + else + { + aXOBitmap.SetPixelColor( aForeColor ); + aXOBitmap.SetBackgroundColor( aBackColor ); + } + } + + // transfer image data from XOBitmap->SvStream->BYTE-Array SvMemoryStream aPicMemStream; - aBmp.Write(aPicMemStream); + aXOBitmap.Array2Bitmap(); + aXOBitmap.GetBitmap().Write(aPicMemStream); sal_uInt32 nSize = aPicMemStream.GetEndOfData(); sal_uInt8* pImageBuff = new sal_uInt8 [nSize]; memcpy(pImageBuff, aPicMemStream.GetData(), nSize); |