summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2013-11-05 16:13:12 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-11-06 11:46:04 +0000
commitf120005ea41d59caf4b7d7f6017f3549d25b4287 (patch)
tree10fffb159ac615a2c3e8cdcd2c356c60cb0d61d3 /drawinglayer
parent3476768dc52dac9ed10a204ffcf000cd042d8993 (diff)
Resolves: #i123500# redefined ColorModifiers and ColorModifierStack...
redefined GraphicAttr to be expressed as primitives if needed, enhanced render and export quality if graphic is modified using graphic attributes (cherry picked from commit 1e79e8da3f8042f7d7bd94b2c9f03cff7545b05c) Conflicts: basegfx/inc/basegfx/color/bcolor.hxx basegfx/inc/basegfx/color/bcolormodifier.hxx basegfx/source/color/bcolormodifier.cxx drawinglayer/inc/drawinglayer/primitive2d/graphicprimitivehelper2d.hxx drawinglayer/inc/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx drawinglayer/inc/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx drawinglayer/source/primitive2d/graphicprimitive2d.cxx drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx Change-Id: Ief2172efc9cc1b9838de48ec7f536c05573c7dc3
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/primitive2d/graphicprimitive2d.cxx202
-rw-r--r--drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx135
-rw-r--r--drawinglayer/source/primitive2d/metafileprimitive2d.cxx4
-rw-r--r--drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx14
-rw-r--r--drawinglayer/source/primitive2d/shadowprimitive2d.cxx9
-rw-r--r--drawinglayer/source/primitive2d/texteffectprimitive2d.cxx49
-rw-r--r--drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx14
-rw-r--r--drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx9
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx9
-rw-r--r--drawinglayer/source/tools/converters.cxx8
10 files changed, 361 insertions, 92 deletions
diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
index df69a36cdd94..cf1fd60c4690 100644
--- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
@@ -22,6 +22,8 @@
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
#include <drawinglayer/primitive2d/graphicprimitivehelper2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
+#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <vcl/svapp.hxx>
#include <vcl/outdev.hxx>
@@ -37,79 +39,151 @@ namespace drawinglayer
{
Primitive2DSequence aRetval;
- if(255L != getGraphicAttr().GetTransparency())
+ if(255L == getGraphicAttr().GetTransparency())
{
- // do not apply mirroring from GraphicAttr to the Metafile by calling
- // GetTransformedGraphic, this will try to mirror the Metafile using Scale()
- // at the Metafile. This again calls Scale at the single MetaFile actions,
- // but this implementation never worked. I reworked that implementations,
- // but for security reasons i will try not to use it.
- basegfx::B2DHomMatrix aTransform(getTransform());
-
- if(getGraphicAttr().IsMirrored())
- {
- // content needs mirroring
- const bool bHMirr(getGraphicAttr().GetMirrorFlags() & BMP_MIRROR_HORZ);
- const bool bVMirr(getGraphicAttr().GetMirrorFlags() & BMP_MIRROR_VERT);
-
- // mirror by applying negative scale to the unit primitive and
- // applying the object transformation on it.
- aTransform = basegfx::tools::createScaleB2DHomMatrix(
- bHMirr ? -1.0 : 1.0,
- bVMirr ? -1.0 : 1.0);
- aTransform.translate(
- bHMirr ? 1.0 : 0.0,
- bVMirr ? 1.0 : 0.0);
- aTransform = getTransform() * aTransform;
- }
+ // content is invisible, done
+ return aRetval;
+ }
+
+ // do not apply mirroring from GraphicAttr to the Metafile by calling
+ // GetTransformedGraphic, this will try to mirror the Metafile using Scale()
+ // at the Metafile. This again calls Scale at the single MetaFile actions,
+ // but this implementation never worked. I reworked that implementations,
+ // but for security reasons i will try not to use it.
+ basegfx::B2DHomMatrix aTransform(getTransform());
+
+ if(getGraphicAttr().IsMirrored())
+ {
+ // content needs mirroring
+ const bool bHMirr(getGraphicAttr().GetMirrorFlags() & BMP_MIRROR_HORZ);
+ const bool bVMirr(getGraphicAttr().GetMirrorFlags() & BMP_MIRROR_VERT);
+
+ // mirror by applying negative scale to the unit primitive and
+ // applying the object transformation on it.
+ aTransform = basegfx::tools::createScaleB2DHomMatrix(
+ bHMirr ? -1.0 : 1.0,
+ bVMirr ? -1.0 : 1.0);
+ aTransform.translate(
+ bHMirr ? 1.0 : 0.0,
+ bVMirr ? 1.0 : 0.0);
+ aTransform = getTransform() * aTransform;
+ }
+
+ // Get transformed graphic. Suppress rotation and cropping, only filtering is needed
+ // here (and may be replaced later on). Cropping is handled below as mask primitive (if set).
+ // Also need to suppress mirroring, it is part of the transformation now (see above).
+ // Also move transparency handling to embedding to a UnifiedTransparencePrimitive2D; do
+ // that by remembering original transparency and applying that later if needed
+ GraphicAttr aSuppressGraphicAttr(getGraphicAttr());
+
+ aSuppressGraphicAttr.SetCrop(0, 0, 0, 0);
+ aSuppressGraphicAttr.SetRotation(0);
+ aSuppressGraphicAttr.SetMirrorFlags(0);
+ aSuppressGraphicAttr.SetTransparency(0);
+
+ const GraphicObject& rGraphicObject = getGraphicObject();
+ Graphic aTransformedGraphic(rGraphicObject.GetGraphic());
+ const bool isBitmap(GRAPHIC_BITMAP == aTransformedGraphic.GetType() && !aTransformedGraphic.getSvgData().get());
+ const bool isAdjusted(getGraphicAttr().IsAdjusted());
+ const bool isDrawMode(GRAPHICDRAWMODE_STANDARD != getGraphicAttr().GetDrawMode());
+
+ if(isBitmap && (isAdjusted || isDrawMode))
+ {
+ // the pure primitive solution with the color modifiers works well, too, but when
+ // it is a bitmap graphic the old modification currently is faster; so use it here
+ // instead of creating all as in create2DColorModifierEmbeddingsAsNeeded (see below).
+ // Still, crop, rotation, mirroring and transparency is handled by primitives already
+ // (see above).
+ // This could even be done when vector graphic, but we explicitely want to have the
+ // pure primitive solution for this; this will allow vector graphics to stay vector
+ // geraphics, independent from the color filtering stuff. This will enhance e.g.
+ // SVG and print quality while reducing data size at the same time.
+ // The other way around the old modifications when only used on already bitmap objects
+ // will not loose any quality.
+ aTransformedGraphic = rGraphicObject.GetTransformedGraphic(&aSuppressGraphicAttr);
+
+ // reset GraphicAttr after use to not apply double
+ aSuppressGraphicAttr = GraphicAttr();
+ }
+
+ // create sub-content; helper takes care of correct handling of
+ // bitmap, svg or metafile content
+ aRetval = create2DDecompositionOfGraphic(
+ aTransformedGraphic,
+ aTransform);
- // Get transformed graphic. Suppress rotation and cropping, only filtering is needed
- // here (and may be replaced later on). Cropping is handled below as mask primitive (if set).
- // Also need to suppress mirroring, it is part of the transformation now (see above).
- GraphicAttr aSuppressGraphicAttr(getGraphicAttr());
- aSuppressGraphicAttr.SetCrop(0, 0, 0, 0);
- aSuppressGraphicAttr.SetRotation(0);
- aSuppressGraphicAttr.SetMirrorFlags(0);
+ if(!aRetval.getLength())
+ {
+ // content is invisible, done
+ return aRetval;
+ }
- const GraphicObject& rGraphicObject = getGraphicObject();
- const Graphic aTransformedGraphic(rGraphicObject.GetTransformedGraphic(&aSuppressGraphicAttr));
+ if(isAdjusted || isDrawMode)
+ {
+ // embed to needed ModifiedColorPrimitive2D's if necessary. Do this for
+ // adjustments and draw mode specials
+ aRetval = create2DColorModifierEmbeddingsAsNeeded(
+ aRetval,
+ aSuppressGraphicAttr.GetDrawMode(),
+ basegfx::clamp(aSuppressGraphicAttr.GetLuminance() * 0.01, -1.0, 1.0),
+ basegfx::clamp(aSuppressGraphicAttr.GetContrast() * 0.01, -1.0, 1.0),
+ basegfx::clamp(aSuppressGraphicAttr.GetChannelR() * 0.01, -1.0, 1.0),
+ basegfx::clamp(aSuppressGraphicAttr.GetChannelG() * 0.01, -1.0, 1.0),
+ basegfx::clamp(aSuppressGraphicAttr.GetChannelB() * 0.01, -1.0, 1.0),
+ basegfx::clamp(aSuppressGraphicAttr.GetGamma(), 0.0, 10.0),
+ aSuppressGraphicAttr.IsInvert());
+
+ if(!aRetval.getLength())
+ {
+ // content is invisible, done
+ return aRetval;
+ }
+ }
- aRetval = create2DDecompositionOfGraphic(
- aTransformedGraphic,
- aTransform);
+ if(getGraphicAttr().IsTransparent())
+ {
+ // check for transparency
+ const double fTransparency(basegfx::clamp(getGraphicAttr().GetTransparency() * (1.0 / 255.0), 0.0, 1.0));
- if(aRetval.getLength())
+ if(!basegfx::fTools::equalZero(fTransparency))
{
- // check for cropping
- if(getGraphicAttr().IsCropped())
- {
- // calculate scalings between real image size and logic object size. This
- // is necessary since the crop values are relative to original bitmap size
- const basegfx::B2DVector aObjectScale(aTransform * basegfx::B2DVector(1.0, 1.0));
- const basegfx::B2DVector aCropScaleFactor(
- rGraphicObject.calculateCropScaling(
- aObjectScale.getX(),
- aObjectScale.getY(),
- getGraphicAttr().GetLeftCrop(),
- getGraphicAttr().GetTopCrop(),
- getGraphicAttr().GetRightCrop(),
- getGraphicAttr().GetBottomCrop()));
-
- // embed content in cropPrimitive
- Primitive2DReference xPrimitive(
- new CropPrimitive2D(
- aRetval,
- aTransform,
- getGraphicAttr().GetLeftCrop() * aCropScaleFactor.getX(),
- getGraphicAttr().GetTopCrop() * aCropScaleFactor.getY(),
- getGraphicAttr().GetRightCrop() * aCropScaleFactor.getX(),
- getGraphicAttr().GetBottomCrop() * aCropScaleFactor.getY()));
-
- aRetval = Primitive2DSequence(&xPrimitive, 1);
- }
+ const Primitive2DReference aUnifiedTransparence(
+ new UnifiedTransparencePrimitive2D(
+ aRetval,
+ fTransparency));
+
+ aRetval = Primitive2DSequence(&aUnifiedTransparence, 1);
}
}
+ if(getGraphicAttr().IsCropped())
+ {
+ // check for cropping
+ // calculate scalings between real image size and logic object size. This
+ // is necessary since the crop values are relative to original bitmap size
+ const basegfx::B2DVector aObjectScale(aTransform * basegfx::B2DVector(1.0, 1.0));
+ const basegfx::B2DVector aCropScaleFactor(
+ rGraphicObject.calculateCropScaling(
+ aObjectScale.getX(),
+ aObjectScale.getY(),
+ getGraphicAttr().GetLeftCrop(),
+ getGraphicAttr().GetTopCrop(),
+ getGraphicAttr().GetRightCrop(),
+ getGraphicAttr().GetBottomCrop()));
+
+ // embed content in cropPrimitive
+ Primitive2DReference xPrimitive(
+ new CropPrimitive2D(
+ aRetval,
+ aTransform,
+ getGraphicAttr().GetLeftCrop() * aCropScaleFactor.getX(),
+ getGraphicAttr().GetTopCrop() * aCropScaleFactor.getY(),
+ getGraphicAttr().GetRightCrop() * aCropScaleFactor.getX(),
+ getGraphicAttr().GetBottomCrop() * aCropScaleFactor.getY()));
+
+ aRetval = Primitive2DSequence(&xPrimitive, 1);
+ }
+
return aRetval;
}
diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index 91c5cae75a5a..ca96b233c8d4 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -24,8 +24,10 @@
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
+#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/numeric/ftools.hxx>
//////////////////////////////////////////////////////////////////////////////
// helper class for animated graphics
@@ -324,4 +326,137 @@ namespace drawinglayer
} // end of namespace primitive2d
} // end of namespace drawinglayer
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence create2DColorModifierEmbeddingsAsNeeded(
+ const Primitive2DSequence& rChildren,
+ GraphicDrawMode aGraphicDrawMode,
+ double fLuminance,
+ double fContrast,
+ double fRed,
+ double fGreen,
+ double fBlue,
+ double fGamma,
+ bool bInvert)
+ {
+ Primitive2DSequence aRetval;
+
+ if(!rChildren.getLength())
+ {
+ // no child content, done
+ return aRetval;
+ }
+
+ // set child content as retval; that is what will be used as child content in all
+ // embeddings from here
+ aRetval = rChildren;
+
+ if(GRAPHICDRAWMODE_WATERMARK == aGraphicDrawMode)
+ {
+ // this is solved by applying fixed values additionally to luminance
+ // and contrast, do it here and reset DrawMode to GRAPHICDRAWMODE_STANDARD
+ // original in svtools uses:
+ // #define WATERMARK_LUM_OFFSET 50
+ // #define WATERMARK_CON_OFFSET -70
+ fLuminance = basegfx::clamp(fLuminance + 0.5, -1.0, 1.0);
+ fContrast = basegfx::clamp(fContrast - 0.7, -1.0, 1.0);
+ aGraphicDrawMode = GRAPHICDRAWMODE_STANDARD;
+ }
+
+ // DrawMode (GRAPHICDRAWMODE_WATERMARK already handled)
+ switch(aGraphicDrawMode)
+ {
+ case GRAPHICDRAWMODE_GREYS:
+ {
+ // convert to grey
+ const Primitive2DReference aPrimitiveGrey(
+ new ModifiedColorPrimitive2D(
+ aRetval,
+ basegfx::BColorModifierSharedPtr(
+ new basegfx::BColorModifier_gray())));
+
+ aRetval = Primitive2DSequence(&aPrimitiveGrey, 1);
+ break;
+ }
+ case GRAPHICDRAWMODE_MONO:
+ {
+ // convert to mono (black/white with threshold 0.5)
+ const Primitive2DReference aPrimitiveBlackAndWhite(
+ new ModifiedColorPrimitive2D(
+ aRetval,
+ basegfx::BColorModifierSharedPtr(
+ new basegfx::BColorModifier_black_and_white(0.5))));
+
+ aRetval = Primitive2DSequence(&aPrimitiveBlackAndWhite, 1);
+ break;
+ }
+ case GRAPHICDRAWMODE_WATERMARK:
+ {
+ OSL_ENSURE(false, "OOps, GRAPHICDRAWMODE_WATERMARK should already be handled (see above)");
+ // fallthrough intended
+ }
+ default: // case GRAPHICDRAWMODE_STANDARD:
+ {
+ // nothing to do
+ break;
+ }
+ }
+
+ // mnContPercent, mnLumPercent, mnRPercent, mnGPercent, mnBPercent
+ // handled in a single call
+ if(!basegfx::fTools::equalZero(fLuminance)
+ || !basegfx::fTools::equalZero(fContrast)
+ || !basegfx::fTools::equalZero(fRed)
+ || !basegfx::fTools::equalZero(fGreen)
+ || !basegfx::fTools::equalZero(fBlue))
+ {
+ const Primitive2DReference aPrimitiveRGBLuminannceContrast(
+ new ModifiedColorPrimitive2D(
+ aRetval,
+ basegfx::BColorModifierSharedPtr(
+ new basegfx::BColorModifier_RGBLuminanceContrast(
+ fRed,
+ fGreen,
+ fBlue,
+ fLuminance,
+ fContrast))));
+
+ aRetval = Primitive2DSequence(&aPrimitiveRGBLuminannceContrast, 1);
+ }
+
+ // gamma (boolean)
+ if(!basegfx::fTools::equal(fGamma, 1.0))
+ {
+ const Primitive2DReference aPrimitiveGamma(
+ new ModifiedColorPrimitive2D(
+ aRetval,
+ basegfx::BColorModifierSharedPtr(
+ new basegfx::BColorModifier_gamma(
+ fGamma))));
+
+ aRetval = Primitive2DSequence(&aPrimitiveGamma, 1);
+ }
+
+ // invert (boolean)
+ if(bInvert)
+ {
+ const Primitive2DReference aPrimitiveInvert(
+ new ModifiedColorPrimitive2D(
+ aRetval,
+ basegfx::BColorModifierSharedPtr(
+ new basegfx::BColorModifier_invert())));
+
+ aRetval = Primitive2DSequence(&aPrimitiveInvert, 1);
+ }
+
+ return aRetval;
+ }
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
index d08a8ed89ffa..40913fac1cd4 100644
--- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
@@ -1057,7 +1057,9 @@ namespace
rTargetHolders.Current().append(
new drawinglayer::primitive2d::ModifiedColorPrimitive2D(
aSubContent,
- basegfx::BColorModifier(basegfx::BColor(0.0, 0.0, 0.0))));
+ basegfx::BColorModifierSharedPtr(
+ new basegfx::BColorModifier_replace(
+ basegfx::BColor(0.0, 0.0, 0.0)))));
}
else // if(rPropertyHolders.Current().isRasterOpInvert())
{
diff --git a/drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx b/drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx
index 96af83a440db..ab664f2fdc72 100644
--- a/drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx
@@ -32,7 +32,7 @@ namespace drawinglayer
{
ModifiedColorPrimitive2D::ModifiedColorPrimitive2D(
const Primitive2DSequence& rChildren,
- const basegfx::BColorModifier& rColorModifier)
+ const basegfx::BColorModifierSharedPtr& rColorModifier)
: GroupPrimitive2D(rChildren),
maColorModifier(rColorModifier)
{
@@ -44,7 +44,17 @@ namespace drawinglayer
{
const ModifiedColorPrimitive2D& rCompare = (ModifiedColorPrimitive2D&)rPrimitive;
- return (getColorModifier() == rCompare.getColorModifier());
+ if(getColorModifier().get() == rCompare.getColorModifier().get())
+ {
+ return true;
+ }
+
+ if(!getColorModifier().get() || !rCompare.getColorModifier().get())
+ {
+ return false;
+ }
+
+ return *getColorModifier().get() == *rCompare.getColorModifier().get();
}
return false;
diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
index 1499faa9f807..4fe7c8ebc2d8 100644
--- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
@@ -73,8 +73,13 @@ namespace drawinglayer
if(getChildren().hasElements())
{
// create a modifiedColorPrimitive containing the shadow color and the content
- const basegfx::BColorModifier aBColorModifier(getShadowColor());
- const Primitive2DReference xRefA(new ModifiedColorPrimitive2D(getChildren(), aBColorModifier));
+ const basegfx::BColorModifierSharedPtr aBColorModifier(
+ new basegfx::BColorModifier_replace(
+ getShadowColor()));
+ const Primitive2DReference xRefA(
+ new ModifiedColorPrimitive2D(
+ getChildren(),
+ aBColorModifier));
const Primitive2DSequence aSequenceB(&xRefA, 1L);
// build transformed primitiveVector with shadow offset and add to target
diff --git a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx
index 5dc453fb4cf5..254ac1b8b556 100644
--- a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx
@@ -84,20 +84,44 @@ namespace drawinglayer
if(bDefaultTextColor)
{
// emboss/engrave in black, original forced to white
- const basegfx::BColorModifier aBColorModifierToGray(basegfx::BColor(0.0));
- const Primitive2DReference xModifiedColor(new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToGray));
- aRetval[0] = Primitive2DReference(new TransformPrimitive2D(aTransform, Primitive2DSequence(&xModifiedColor, 1)));
+ const basegfx::BColorModifierSharedPtr aBColorModifierToGray(
+ new basegfx::BColorModifier_replace(
+ basegfx::BColor(0.0)));
+ const Primitive2DReference xModifiedColor(
+ new ModifiedColorPrimitive2D(
+ getTextContent(),
+ aBColorModifierToGray));
+
+ aRetval[0] = Primitive2DReference(
+ new TransformPrimitive2D(
+ aTransform,
+ Primitive2DSequence(&xModifiedColor, 1)));
// add original, too
- const basegfx::BColorModifier aBColorModifierToWhite(basegfx::BColor(1.0));
- aRetval[1] = Primitive2DReference(new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToWhite));
+ const basegfx::BColorModifierSharedPtr aBColorModifierToWhite(
+ new basegfx::BColorModifier_replace(
+ basegfx::BColor(1.0)));
+
+ aRetval[1] = Primitive2DReference(
+ new ModifiedColorPrimitive2D(
+ getTextContent(),
+ aBColorModifierToWhite));
}
else
{
// emboss/engrave in gray, keep original's color
- const basegfx::BColorModifier aBColorModifierToGray(basegfx::BColor(0.75)); // 192
- const Primitive2DReference xModifiedColor(new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToGray));
- aRetval[0] = Primitive2DReference(new TransformPrimitive2D(aTransform, Primitive2DSequence(&xModifiedColor, 1)));
+ const basegfx::BColorModifierSharedPtr aBColorModifierToGray(
+ new basegfx::BColorModifier_replace(
+ basegfx::BColor(0.75))); // 192
+ const Primitive2DReference xModifiedColor(
+ new ModifiedColorPrimitive2D(
+ getTextContent(),
+ aBColorModifierToGray));
+
+ aRetval[0] = Primitive2DReference(
+ new TransformPrimitive2D(
+ aTransform,
+ Primitive2DSequence(&xModifiedColor, 1)));
// add original, too
aRetval[1] = Primitive2DReference(new GroupPrimitive2D(getTextContent()));
@@ -144,8 +168,13 @@ namespace drawinglayer
aRetval[7] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent()));
// at last, place original over it, but force to white
- const basegfx::BColorModifier aBColorModifierToWhite(basegfx::BColor(1.0, 1.0, 1.0));
- aRetval[8] = Primitive2DReference(new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToWhite));
+ const basegfx::BColorModifierSharedPtr aBColorModifierToWhite(
+ new basegfx::BColorModifier_replace(
+ basegfx::BColor(1.0, 1.0, 1.0)));
+ aRetval[8] = Primitive2DReference(
+ new ModifiedColorPrimitive2D(
+ getTextContent(),
+ aBColorModifierToWhite));
break;
}
diff --git a/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx b/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx
index daff0632d322..a01007b02ad1 100644
--- a/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx
@@ -32,7 +32,7 @@ namespace drawinglayer
{
ModifiedColorPrimitive3D::ModifiedColorPrimitive3D(
const Primitive3DSequence& rChildren,
- const basegfx::BColorModifier& rColorModifier)
+ const basegfx::BColorModifierSharedPtr& rColorModifier)
: GroupPrimitive3D(rChildren),
maColorModifier(rColorModifier)
{
@@ -44,7 +44,17 @@ namespace drawinglayer
{
const ModifiedColorPrimitive3D& rCompare = (ModifiedColorPrimitive3D&)rPrimitive;
- return (maColorModifier == rCompare.maColorModifier);
+ if(getColorModifier().get() == rCompare.getColorModifier().get())
+ {
+ return true;
+ }
+
+ if(!getColorModifier().get() || !rCompare.getColorModifier().get())
+ {
+ return false;
+ }
+
+ return *getColorModifier().get() == *rCompare.getColorModifier().get();
}
return false;
diff --git a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx
index 667fae1f576e..c301f3b6cf36 100644
--- a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx
@@ -247,8 +247,13 @@ namespace drawinglayer
if(::com::sun::star::drawing::TextureKind2_LUMINANCE == aSdr3DObjectAttribute.getTextureKind())
{
// use modified color primitive to force textures to gray
- const basegfx::BColorModifier aBColorModifier(basegfx::BColor(), 0.0, basegfx::BCOLORMODIFYMODE_GRAY);
- const Primitive3DReference xRef2(new ModifiedColorPrimitive3D(aRetval, aBColorModifier));
+ const basegfx::BColorModifierSharedPtr aBColorModifier(
+ new basegfx::BColorModifier_gray());
+ const Primitive3DReference xRef2(
+ new ModifiedColorPrimitive3D(
+ aRetval,
+ aBColorModifier));
+
aRetval = Primitive3DSequence(&xRef2, 1L);
}
}
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 1cd768e9a31a..7f2ab70ffc6e 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -688,9 +688,10 @@ namespace drawinglayer
if(nBColorModifierStackCount)
{
- const basegfx::BColorModifier& rTopmostModifier = maBColorModifierStack.getBColorModifier(nBColorModifierStackCount - 1);
+ const basegfx::BColorModifierSharedPtr& rTopmostModifier = maBColorModifierStack.getBColorModifier(nBColorModifierStackCount - 1);
+ const basegfx::BColorModifier_replace* pReplacer = dynamic_cast< const basegfx::BColorModifier_replace* >(rTopmostModifier.get());
- if(basegfx::BCOLORMODIFYMODE_REPLACE == rTopmostModifier.getMode())
+ if(pReplacer)
{
// the bitmap fill is in unified color, so we can replace it with
// a single polygon fill. The form of the fill depends on tiling
@@ -701,7 +702,7 @@ namespace drawinglayer
aLocalPolyPolygon.transform(maCurrentTransformation);
mpOutputDevice->SetLineColor();
- mpOutputDevice->SetFillColor(Color(rTopmostModifier.getBColor()));
+ mpOutputDevice->SetFillColor(Color(pReplacer->getBColor()));
mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon);
}
else
@@ -733,7 +734,7 @@ namespace drawinglayer
{
aTarget.transform(maCurrentTransformation);
mpOutputDevice->SetLineColor();
- mpOutputDevice->SetFillColor(Color(rTopmostModifier.getBColor()));
+ mpOutputDevice->SetFillColor(Color(pReplacer->getBColor()));
mpOutputDevice->DrawPolyPolygon(aTarget);
}
}
diff --git a/drawinglayer/source/tools/converters.cxx b/drawinglayer/source/tools/converters.cxx
index 76f37d5d730c..dfd0b8f9f3f5 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -114,14 +114,12 @@ namespace drawinglayer
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,
- aMode)));
+ basegfx::BColorModifierSharedPtr(
+ new basegfx::BColorModifier_replace(
+ basegfx::BColor(0.0, 0.0, 0.0)))));
const primitive2d::Primitive2DSequence xSeq(&xRef, 1);
// render