Kaydet (Commit) d7fa73b2 authored tarafından Armin Le Grand's avatar Armin Le Grand

i113080 added test code (in debug mode), cleanedup a small inconsistency

üst 970ff93f
...@@ -49,6 +49,9 @@ namespace drawinglayer ...@@ -49,6 +49,9 @@ namespace drawinglayer
sal_uInt32 nMaxQuadratPixels) sal_uInt32 nMaxQuadratPixels)
{ {
BitmapEx aRetval; BitmapEx aRetval;
#ifdef DBG_UTIL
static bool bDoSaveForVisualControl(false);
#endif
if(rSeq.hasElements() && nDiscreteWidth && nDiscreteHeight) if(rSeq.hasElements() && nDiscreteWidth && nDiscreteHeight)
{ {
...@@ -81,13 +84,14 @@ namespace drawinglayer ...@@ -81,13 +84,14 @@ namespace drawinglayer
// prepare vdev // prepare vdev
maContent.SetOutputSizePixel(aSizePixel, false); maContent.SetOutputSizePixel(aSizePixel, false);
maContent.SetMapMode(aMapModePixel); maContent.SetMapMode(aMapModePixel);
maContent.SetAntialiasing(true);
// set to all white // set to all white
maContent.SetBackground(Wallpaper(Color(COL_WHITE))); maContent.SetBackground(Wallpaper(Color(COL_WHITE)));
maContent.Erase(); 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( processor2d::BaseProcessor2D* pContentProcessor = processor2d::createPixelProcessor2DFromOutputDevice(
maContent, maContent,
aViewInformation2D); aViewInformation2D);
...@@ -101,21 +105,29 @@ namespace drawinglayer ...@@ -101,21 +105,29 @@ namespace drawinglayer
maContent.EnableMapMode(false); maContent.EnableMapMode(false);
const Bitmap aContent(maContent.GetBitmap(aEmptyPoint, aSizePixel)); 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 // prepare for mask creation
maContent.SetMapMode(aMapModePixel); maContent.SetMapMode(aMapModePixel);
maContent.SetAntialiasing(true);
// set alpha to all white (fully transparent) // set alpha to all white (fully transparent)
maContent.Erase(); maContent.Erase();
// embed primitives to paint them black // embed primitives to paint them black
static basegfx::BColorModifyMode aMode = basegfx::BCOLORMODIFYMODE_REPLACE;
const primitive2d::Primitive2DReference xRef( const primitive2d::Primitive2DReference xRef(
new primitive2d::ModifiedColorPrimitive2D( new primitive2d::ModifiedColorPrimitive2D(
aSequence, aSequence,
basegfx::BColorModifier( basegfx::BColorModifier(
basegfx::BColor(0.0, 0.0, 0.0), basegfx::BColor(0.0, 0.0, 0.0),
0.5, 0.5,
basegfx::BCOLORMODIFYMODE_REPLACE))); aMode)));
const primitive2d::Primitive2DSequence xSeq(&xRef, 1); const primitive2d::Primitive2DSequence xSeq(&xRef, 1);
// render // render
...@@ -124,22 +136,28 @@ namespace drawinglayer ...@@ -124,22 +136,28 @@ namespace drawinglayer
// get alpha cahannel from vdev // get alpha cahannel from vdev
maContent.EnableMapMode(false); 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 // create BitmapEx result
aRetval = BitmapEx(aContent, aAlphaMask); aRetval = BitmapEx(aContent, AlphaMask(aAlpha));
}
}
#ifdef DBG_UTIL #ifdef DBG_UTIL
static bool bDoSaveForVisualControl(false); if(bDoSaveForVisualControl)
if(bDoSaveForVisualControl) {
{ SvFileStream aNew((const String&)String(ByteString( "c:\\test_combined.png" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC);
SvFileStream aNew((const String&)String(ByteString( "c:\\test.png" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC); ::vcl::PNGWriter aPNGWriter(aRetval);
::vcl::PNGWriter aPNGWriter(aRetval); aPNGWriter.Write(aNew);
aPNGWriter.Write(aNew); }
}
#endif #endif
}
}
return aRetval; return aRetval;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment