diff options
author | Armin Le Grand <alg@apache.org> | 2013-04-09 08:37:28 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-17 09:23:27 +0100 |
commit | 881b79dc21560bbdb6bf0e9b50061d1507e5e165 (patch) | |
tree | 31296d17087a0d36572ef638d476246741a8e3b4 /drawinglayer | |
parent | 03427c780bd565a902cbb787b5fa2f4707382e27 (diff) |
Resolves: #i113080# added test code, cleaned up a small inconsistency
(cherry picked from commit d7fa73b25f75796291432496d9bb8d7c80e82c8b)
Conflicts:
drawinglayer/source/tools/converters.cxx
Change-Id: Ia8edda4ca2c79bfc9d4a0962f99d8db581622a7d
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/tools/converters.cxx | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/drawinglayer/source/tools/converters.cxx b/drawinglayer/source/tools/converters.cxx index 75712014a02b..76f37d5d730c 100644 --- a/drawinglayer/source/tools/converters.cxx +++ b/drawinglayer/source/tools/converters.cxx @@ -44,6 +44,9 @@ namespace drawinglayer sal_uInt32 nMaxQuadratPixels) { BitmapEx aRetval; +#ifdef DBG_UTIL + static bool bDoSaveForVisualControl(false); +#endif if(rSeq.hasElements() && nDiscreteWidth && nDiscreteHeight) { @@ -75,13 +78,14 @@ namespace drawinglayer // prepare vdev maContent.SetOutputSizePixel(aSizePixel, false); maContent.SetMapMode(aMapModePixel); - maContent.SetAntialiasing(true); // set to all white maContent.SetBackground(Wallpaper(Color(COL_WHITE))); maContent.Erase(); - // create pixel processor + // create pixel processor, also already takes care of AAing and + // checking the getOptionsDrawinglayer().IsAntiAliasing() switch. If + // not wanted, change after this call as needed processor2d::BaseProcessor2D* pContentProcessor = processor2d::createPixelProcessor2DFromOutputDevice( maContent, aViewInformation2D); @@ -95,21 +99,29 @@ namespace drawinglayer maContent.EnableMapMode(false); const Bitmap aContent(maContent.GetBitmap(aEmptyPoint, aSizePixel)); +#ifdef DBG_UTIL + if(bDoSaveForVisualControl) + { + SvFileStream aNew(OUString("c:\\test_content.png"), STREAM_WRITE|STREAM_TRUNC); + ::vcl::PNGWriter aPNGWriter(aContent); + aPNGWriter.Write(aNew); + } +#endif // prepare for mask creation maContent.SetMapMode(aMapModePixel); - maContent.SetAntialiasing(true); // set alpha to all white (fully transparent) maContent.Erase(); // embed primitives to paint them black + static basegfx::BColorModifyMode aMode = basegfx::BCOLORMODIFYMODE_REPLACE; const primitive2d::Primitive2DReference xRef( new primitive2d::ModifiedColorPrimitive2D( aSequence, basegfx::BColorModifier( basegfx::BColor(0.0, 0.0, 0.0), 0.5, - basegfx::BCOLORMODIFYMODE_REPLACE))); + aMode))); const primitive2d::Primitive2DSequence xSeq(&xRef, 1); // render @@ -118,22 +130,28 @@ namespace drawinglayer // get alpha cahannel from vdev maContent.EnableMapMode(false); - const AlphaMask aAlphaMask(maContent.GetBitmap(aEmptyPoint, aSizePixel)); + const Bitmap aAlpha(maContent.GetBitmap(aEmptyPoint, aSizePixel)); +#ifdef DBG_UTIL + if(bDoSaveForVisualControl) + { + SvFileStream aNew(OUString("c:\\test_alpha.png"), STREAM_WRITE|STREAM_TRUNC); + ::vcl::PNGWriter aPNGWriter(aAlpha); + aPNGWriter.Write(aNew); + } +#endif // create BitmapEx result - aRetval = BitmapEx(aContent, aAlphaMask); - } - } - + aRetval = BitmapEx(aContent, AlphaMask(aAlpha)); #ifdef DBG_UTIL - static bool bDoSaveForVisualControl(false); - if(bDoSaveForVisualControl) - { - SvFileStream aNew(OUString("c:\\test.png"), STREAM_WRITE|STREAM_TRUNC); - ::vcl::PNGWriter aPNGWriter(aRetval); - aPNGWriter.Write(aNew); - } + if(bDoSaveForVisualControl) + { + SvFileStream aNew(OUString("c:\\test_combined.png"), STREAM_WRITE|STREAM_TRUNC); + ::vcl::PNGWriter aPNGWriter(aRetval); + aPNGWriter.Write(aNew); + } #endif + } + } return aRetval; } |