summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2013-04-09 08:37:28 +0000
committerArmin Le Grand <alg@apache.org>2013-04-09 08:37:28 +0000
commitd7fa73b25f75796291432496d9bb8d7c80e82c8b (patch)
tree4381bcc2fd6eec63fe458041d6681a969094ee85 /drawinglayer
parent970ff93fdf7d85b5d4f96d35aff641fe3c681668 (diff)
i113080 added test code (in debug mode), cleanedup a small inconsistency
Notes
Notes: merged as: 881b79dc21560bbdb6bf0e9b50061d1507e5e165
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/tools/converters.cxx50
1 files changed, 34 insertions, 16 deletions
diff --git a/drawinglayer/source/tools/converters.cxx b/drawinglayer/source/tools/converters.cxx
index 83b77ccaf834..9faef9730820 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -49,6 +49,9 @@ namespace drawinglayer
sal_uInt32 nMaxQuadratPixels)
{
BitmapEx aRetval;
+#ifdef DBG_UTIL
+ static bool bDoSaveForVisualControl(false);
+#endif
if(rSeq.hasElements() && nDiscreteWidth && nDiscreteHeight)
{
@@ -81,13 +84,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);
@@ -101,21 +105,29 @@ namespace drawinglayer
maContent.EnableMapMode(false);
const Bitmap aContent(maContent.GetBitmap(aEmptyPoint, aSizePixel));
+#ifdef DBG_UTIL
+ if(bDoSaveForVisualControl)
+ {
+ SvFileStream aNew((const String&)String(ByteString( "c:\\test_content.png" ), RTL_TEXTENCODING_UTF8), 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
@@ -124,22 +136,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((const String&)String(ByteString( "c:\\test_alpha.png" ), RTL_TEXTENCODING_UTF8), 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((const String&)String(ByteString( "c:\\test.png" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC);
- ::vcl::PNGWriter aPNGWriter(aRetval);
- aPNGWriter.Write(aNew);
- }
+ if(bDoSaveForVisualControl)
+ {
+ SvFileStream aNew((const String&)String(ByteString( "c:\\test_combined.png" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC);
+ ::vcl::PNGWriter aPNGWriter(aRetval);
+ aPNGWriter.Write(aNew);
+ }
#endif
+ }
+ }
return aRetval;
}