summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorka <kai.ahrens@oracle.com>2011-02-04 14:49:25 +0100
committerka <kai.ahrens@oracle.com>2011-02-04 14:49:25 +0100
commitc42ccec9332b82c0cc36199d35d68495b9662004 (patch)
tree1f918d4a74addd4ea51f7aa4ca5bd99a14685c8f /drawinglayer
parent8cdff22a144e3a0a85b5d0219485ca5ab04aa9cf (diff)
ka102: SVG import implementation
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx1
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx2
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx2
-rw-r--r--drawinglayer/prj/d.lst1
-rw-r--r--drawinglayer/source/primitive2d/graphicprimitive2d.cxx69
-rw-r--r--drawinglayer/source/primitive2d/makefile.mk1
-rw-r--r--drawinglayer/source/primitive2d/metafileprimitive2d.cxx238
-rw-r--r--drawinglayer/source/processor2d/hittestprocessor2d.cxx2
-rw-r--r--drawinglayer/source/processor2d/linegeometryextractor2d.cxx1
-rw-r--r--drawinglayer/source/processor2d/textaspolygonextractor2d.cxx1
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx7
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx7
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx137
13 files changed, 303 insertions, 166 deletions
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
index 7f1c929a6e..8c4f79bcb2 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
@@ -103,6 +103,7 @@
#define PRIMITIVE2D_ID_EPSPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 60)
#define PRIMITIVE2D_ID_DISCRETESHADOWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 61)
#define PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 62)
+#define PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 63)
//////////////////////////////////////////////////////////////////////////////
diff --git a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx
index 8a66fbc35c..5252751736 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx
@@ -56,6 +56,7 @@ namespace drawinglayer { namespace primitive2d {
class MetafilePrimitive2D;
class TextSimplePortionPrimitive2D;
class BitmapPrimitive2D;
+ class RenderGraphicPrimitive2D;
class TransparencePrimitive2D;
class PolygonStrokePrimitive2D;
class FillBitmapPrimitive2D;
@@ -108,6 +109,7 @@ namespace drawinglayer
void impRenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rMetaCandidate);
void impRenderTextSimplePortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate);
void impRenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate);
+ void impRenderRenderGraphicPrimitive2D(const primitive2d::RenderGraphicPrimitive2D& rRenderGraphicCandidate);
void impRenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransparenceCandidate);
void impRenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokePrimitive);
void impRenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapPrimitive2D);
diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
index aad727e863..cb1e3b5516 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
@@ -41,6 +41,7 @@ namespace drawinglayer { namespace primitive2d {
class TextSimplePortionPrimitive2D;
class PolygonHairlinePrimitive2D;
class BitmapPrimitive2D;
+ class RenderGraphicPrimitive2D;
class FillBitmapPrimitive2D;
class PolyPolygonGradientPrimitive2D;
class PolyPolygonBitmapPrimitive2D;
@@ -97,6 +98,7 @@ namespace drawinglayer
void RenderTextSimpleOrDecoratedPortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate);
void RenderPolygonHairlinePrimitive2D(const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate, bool bPixelBased);
void RenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate);
+ void RenderRenderGraphicPrimitive2D(const primitive2d::RenderGraphicPrimitive2D& rRenderGraphicCandidate);
void RenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapCandidate);
void RenderPolyPolygonGradientPrimitive2D(const primitive2d::PolyPolygonGradientPrimitive2D& rPolygonCandidate);
void RenderPolyPolygonBitmapPrimitive2D(const primitive2d::PolyPolygonBitmapPrimitive2D& rPolygonCandidate);
diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst
index 54f087d317..10e692785a 100644
--- a/drawinglayer/prj/d.lst
+++ b/drawinglayer/prj/d.lst
@@ -13,6 +13,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d
..\inc\drawinglayer\primitive2d\backgroundcolorprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\backgroundcolorprimitive2d.hxx
..\inc\drawinglayer\primitive2d\baseprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\baseprimitive2d.hxx
..\inc\drawinglayer\primitive2d\bitmapprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\bitmapprimitive2d.hxx
+..\inc\drawinglayer\primitive2d\rendergraphicprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\rendergraphicprimitive2d.hxx
..\inc\drawinglayer\primitive2d\borderlineprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\borderlineprimitive2d.hxx
..\inc\drawinglayer\primitive2d\chartprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\chartprimitive2d.hxx
..\inc\drawinglayer\primitive2d\controlprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\controlprimitive2d.hxx
diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
index fd4467d449..07a10be75f 100644
--- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
@@ -31,6 +31,7 @@
#include <drawinglayer/primitive2d/graphicprimitive2d.hxx>
#include <drawinglayer/animation/animationtiming.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/rendergraphicprimitive2d.hxx>
#include <drawinglayer/primitive2d/animatedprimitive2d.hxx>
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
@@ -46,6 +47,7 @@
#include <vcl/graph.hxx>
#include <vcl/virdev.hxx>
#include <vcl/svapp.hxx>
+#include <vcl/metaact.hxx>
//////////////////////////////////////////////////////////////////////////////
// includes for testing MetafilePrimitive2D::create2DDecomposition
@@ -260,7 +262,9 @@ namespace drawinglayer
aSuppressGraphicAttr.SetCrop(0, 0, 0, 0);
aSuppressGraphicAttr.SetRotation(0);
aSuppressGraphicAttr.SetMirrorFlags(0);
- const Graphic aTransformedGraphic(getGraphicObject().GetTransformedGraphic(&aSuppressGraphicAttr));
+
+ const GraphicObject& rGraphicObject = getGraphicObject();
+ const Graphic aTransformedGraphic(rGraphicObject.GetTransformedGraphic(&aSuppressGraphicAttr));
switch(aTransformedGraphic.GetType())
{
@@ -743,34 +747,43 @@ namespace drawinglayer
{
#endif // USE_DEBUG_CODE_TO_TEST_METAFILE_DECOMPOSE
// create MetafilePrimitive2D
- const Graphic aGraphic(getGraphicObject().GetGraphic());
const GDIMetaFile& rMetafile = aTransformedGraphic.GetGDIMetaFile();
- xPrimitive = Primitive2DReference(
- new MetafilePrimitive2D(
- aTransform,
- rMetafile));
-
- // #i100357# find out if clipping is needed for this primitive. Unfortunately,
- // there exist Metafiles who's content is bigger than the proposed PrefSize set
- // at them. This is an error, but we need to work around this
- const Size aMetaFilePrefSize(rMetafile.GetPrefSize());
- const Size aMetaFileRealSize(
- const_cast< GDIMetaFile& >(rMetafile).GetBoundRect(
- *Application::GetDefaultDevice()).GetSize());
-
- if(aMetaFileRealSize.getWidth() > aMetaFilePrefSize.getWidth()
- || aMetaFileRealSize.getHeight() > aMetaFilePrefSize.getHeight())
+ if( aTransformedGraphic.IsRenderGraphic() )
{
- // clipping needed. Embed to MaskPrimitive2D. Create childs and mask polygon
- const primitive2d::Primitive2DSequence aChildContent(&xPrimitive, 1);
- basegfx::B2DPolygon aMaskPolygon(basegfx::tools::createUnitPolygon());
- aMaskPolygon.transform(aTransform);
-
xPrimitive = Primitive2DReference(
- new MaskPrimitive2D(
- basegfx::B2DPolyPolygon(aMaskPolygon),
- aChildContent));
+ new RenderGraphicPrimitive2D(
+ static_cast< MetaRenderGraphicAction* >(rMetafile.GetAction(0))->GetRenderGraphic(),
+ aTransform));
+ }
+ else
+ {
+ xPrimitive = Primitive2DReference(
+ new MetafilePrimitive2D(
+ aTransform,
+ rMetafile));
+
+ // #i100357# find out if clipping is needed for this primitive. Unfortunately,
+ // there exist Metafiles who's content is bigger than the proposed PrefSize set
+ // at them. This is an error, but we need to work around this
+ const Size aMetaFilePrefSize(rMetafile.GetPrefSize());
+ const Size aMetaFileRealSize(
+ const_cast< GDIMetaFile& >(rMetafile).GetBoundRect(
+ *Application::GetDefaultDevice()).GetSize());
+
+ if(aMetaFileRealSize.getWidth() > aMetaFilePrefSize.getWidth()
+ || aMetaFileRealSize.getHeight() > aMetaFilePrefSize.getHeight())
+ {
+ // clipping needed. Embed to MaskPrimitive2D. Create childs and mask polygon
+ const primitive2d::Primitive2DSequence aChildContent(&xPrimitive, 1);
+ basegfx::B2DPolygon aMaskPolygon(basegfx::tools::createUnitPolygon());
+ aMaskPolygon.transform(aTransform);
+
+ xPrimitive = Primitive2DReference(
+ new MaskPrimitive2D(
+ basegfx::B2DPolyPolygon(aMaskPolygon),
+ aChildContent));
+ }
}
#ifdef USE_DEBUG_CODE_TO_TEST_METAFILE_DECOMPOSE
}
@@ -808,16 +821,16 @@ namespace drawinglayer
{
const MapMode aMapMode100thmm(MAP_100TH_MM);
- Size aBitmapSize(getGraphicObject().GetPrefSize());
+ Size aBitmapSize(rGraphicObject.GetPrefSize());
// #i95968# better support PrefMapMode; special for MAP_PIXEL was missing
- if(MAP_PIXEL == getGraphicObject().GetPrefMapMode().GetMapUnit())
+ if(MAP_PIXEL == rGraphicObject.GetPrefMapMode().GetMapUnit())
{
aBitmapSize = Application::GetDefaultDevice()->PixelToLogic(aBitmapSize, aMapMode100thmm);
}
else
{
- aBitmapSize = Application::GetDefaultDevice()->LogicToLogic(aBitmapSize, getGraphicObject().GetPrefMapMode(), aMapMode100thmm);
+ aBitmapSize = Application::GetDefaultDevice()->LogicToLogic(aBitmapSize, rGraphicObject.GetPrefMapMode(), aMapMode100thmm);
}
const double fDivX(aBitmapSize.Width() - getGraphicAttr().GetLeftCrop() - getGraphicAttr().GetRightCrop());
diff --git a/drawinglayer/source/primitive2d/makefile.mk b/drawinglayer/source/primitive2d/makefile.mk
index 720769a0ef..77e59dca24 100644
--- a/drawinglayer/source/primitive2d/makefile.mk
+++ b/drawinglayer/source/primitive2d/makefile.mk
@@ -42,6 +42,7 @@ SLOFILES= \
$(SLO)$/baseprimitive2d.obj \
$(SLO)$/backgroundcolorprimitive2d.obj \
$(SLO)$/bitmapprimitive2d.obj \
+ $(SLO)$/rendergraphicprimitive2d.obj \
$(SLO)$/borderlineprimitive2d.obj \
$(SLO)$/chartprimitive2d.obj \
$(SLO)$/controlprimitive2d.obj \
diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
index 41af340084..208a95da71 100644
--- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -63,6 +63,7 @@
#include <drawinglayer/primitive2d/textlineprimitive2d.hxx>
#include <drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx>
#include <drawinglayer/primitive2d/epsprimitive2d.hxx>
+#include <drawinglayer/primitive2d/rendergraphicprimitive2d.hxx>
#include <numeric>
//////////////////////////////////////////////////////////////////////////////
@@ -155,7 +156,7 @@ namespace
void setLineColor(const basegfx::BColor& rNew) { if(rNew != maLineColor) maLineColor = rNew; }
bool getLineColorActive() const { return mbLineColor; }
void setLineColorActive(bool bNew) { if(bNew != mbLineColor) mbLineColor = bNew; }
-
+
const basegfx::BColor& getFillColor() const { return maFillColor; }
void setFillColor(const basegfx::BColor& rNew) { if(rNew != maFillColor) maFillColor = rNew; }
bool getFillColorActive() const { return mbFillColor; }
@@ -397,13 +398,13 @@ namespace
{
RegionHandle aRegionHandle(aRegion.BeginEnumRects());
Rectangle aRegionRectangle;
-
+
while(aRegion.GetEnumRects(aRegionHandle, aRegionRectangle))
{
if(!aRegionRectangle.IsEmpty())
{
const basegfx::B2DRange aRegionRange(
- aRegionRectangle.Left(), aRegionRectangle.Top(),
+ aRegionRectangle.Left(), aRegionRectangle.Top(),
aRegionRectangle.Right(), aRegionRectangle.Bottom());
aRetval.append(basegfx::tools::createPolygonFromRect(aRegionRange));
}
@@ -473,7 +474,7 @@ namespace
// All Targets were pointers, but do not need to be deleted since they
// were converted to UNO API references now, so they stay as long as
- // referenced. Do NOT delete the C++ implementation classes here, but clear
+ // referenced. Do NOT delete the C++ implementation classes here, but clear
// the buffer to not delete them in the destructor.
aTargets.clear();
@@ -487,7 +488,7 @@ namespace
new drawinglayer::primitive2d::MaskPrimitive2D(
rClipPolyPolygon,
xRetval));
-
+
xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xMask, 1);
}
}
@@ -576,7 +577,7 @@ namespace drawinglayer
public:
/// constructor
NonOverlappingFillGradientPrimitive2D(
- const basegfx::B2DRange& rObjectRange,
+ const basegfx::B2DRange& rObjectRange,
const attribute::FillGradientAttribute& rFillGradient)
: FillGradientPrimitive2D(rObjectRange, rFillGradient)
{
@@ -617,7 +618,7 @@ namespace
if(rMapMode.GetScaleX() != aNoScale || rMapMode.GetScaleY() != aNoScale)
{
aMapping.scale(
- double(rMapMode.GetScaleX()),
+ double(rMapMode.GetScaleX()),
double(rMapMode.GetScaleY()));
}
@@ -626,8 +627,8 @@ namespace
/** helper to create a PointArrayPrimitive2D based on current context */
void createPointArrayPrimitive(
- const std::vector< basegfx::B2DPoint >& rPositions,
- TargetHolder& rTarget,
+ const std::vector< basegfx::B2DPoint >& rPositions,
+ TargetHolder& rTarget,
PropertyHolder& rProperties,
basegfx::BColor aBColor)
{
@@ -660,7 +661,7 @@ namespace
/** helper to create a PolygonHairlinePrimitive2D based on current context */
void createHairlinePrimitive(
const basegfx::B2DPolygon& rLinePolygon,
- TargetHolder& rTarget,
+ TargetHolder& rTarget,
PropertyHolder& rProperties)
{
if(rLinePolygon.count())
@@ -677,7 +678,7 @@ namespace
/** helper to create a PolyPolygonColorPrimitive2D based on current context */
void createFillPrimitive(
const basegfx::B2DPolyPolygon& rFillPolyPolygon,
- TargetHolder& rTarget,
+ TargetHolder& rTarget,
PropertyHolder& rProperties)
{
if(rFillPolyPolygon.count())
@@ -694,8 +695,8 @@ namespace
/** helper to create a PolygonStrokePrimitive2D based on current context */
void createLinePrimitive(
const basegfx::B2DPolygon& rLinePolygon,
- const LineInfo& rLineInfo,
- TargetHolder& rTarget,
+ const LineInfo& rLineInfo,
+ TargetHolder& rTarget,
PropertyHolder& rProperties)
{
if(rLinePolygon.count())
@@ -760,14 +761,14 @@ namespace
/** helper to create needed line and fill primitives based on current context */
void createHairlineAndFillPrimitive(
const basegfx::B2DPolygon& rPolygon,
- TargetHolder& rTarget,
+ TargetHolder& rTarget,
PropertyHolder& rProperties)
{
if(rProperties.getFillColorActive())
{
createFillPrimitive(basegfx::B2DPolyPolygon(rPolygon), rTarget, rProperties);
}
-
+
if(rProperties.getLineColorActive())
{
createHairlinePrimitive(rPolygon, rTarget, rProperties);
@@ -777,14 +778,14 @@ namespace
/** helper to create needed line and fill primitives based on current context */
void createHairlineAndFillPrimitive(
const basegfx::B2DPolyPolygon& rPolyPolygon,
- TargetHolder& rTarget,
+ TargetHolder& rTarget,
PropertyHolder& rProperties)
{
if(rProperties.getFillColorActive())
{
createFillPrimitive(rPolyPolygon, rTarget, rProperties);
}
-
+
if(rProperties.getLineColorActive())
{
for(sal_uInt32 a(0); a < rPolyPolygon.count(); a++)
@@ -801,16 +802,16 @@ namespace
transformed embedding of a BitmapPrimitive2D.
*/
void createBitmapExPrimitive(
- const BitmapEx& rBitmapEx,
+ const BitmapEx& rBitmapEx,
const Point& rPoint,
- TargetHolder& rTarget,
+ TargetHolder& rTarget,
PropertyHolder& rProperties)
{
if(!rBitmapEx.IsEmpty())
{
basegfx::B2DPoint aPoint(rPoint.X(), rPoint.Y());
aPoint = rProperties.getTransformation() * aPoint;
-
+
rTarget.append(
new drawinglayer::primitive2d::DiscreteBitmapPrimitive2D(
rBitmapEx,
@@ -820,23 +821,23 @@ namespace
/** helper to create BitmapPrimitive2D based on current context */
void createBitmapExPrimitive(
- const BitmapEx& rBitmapEx,
+ const BitmapEx& rBitmapEx,
const Point& rPoint,
const Size& rSize,
- TargetHolder& rTarget,
+ TargetHolder& rTarget,
PropertyHolder& rProperties)
{
if(!rBitmapEx.IsEmpty())
{
basegfx::B2DHomMatrix aObjectTransform;
-
+
aObjectTransform.set(0, 0, rSize.Width());
aObjectTransform.set(1, 1, rSize.Height());
aObjectTransform.set(0, 2, rPoint.X());
aObjectTransform.set(1, 2, rPoint.Y());
-
+
aObjectTransform = rProperties.getTransformation() * aObjectTransform;
-
+
rTarget.append(
new drawinglayer::primitive2d::BitmapPrimitive2D(
rBitmapEx,
@@ -846,21 +847,21 @@ namespace
/** helper to create a regular BotmapEx from a MaskAction (definitions
which use a bitmap without transparence but define one of the colors as
- transparent)
+ transparent)
*/
BitmapEx createMaskBmpEx(const Bitmap& rBitmap, const Color& rMaskColor)
{
const Color aWhite(COL_WHITE);
BitmapPalette aBiLevelPalette(2);
-
+
aBiLevelPalette[0] = aWhite;
aBiLevelPalette[1] = rMaskColor;
Bitmap aMask(rBitmap.CreateMask(aWhite));
Bitmap aSolid(rBitmap.GetSizePixel(), 1, &aBiLevelPalette);
-
+
aSolid.Erase(rMaskColor);
-
+
return BitmapEx(aSolid, aMask);
}
@@ -872,7 +873,7 @@ namespace
const Color aStartColor(rGradient.GetStartColor());
const sal_uInt16 nStartIntens(rGradient.GetStartIntensity());
basegfx::BColor aStart(aStartColor.getBColor());
-
+
if(nStartIntens != 100)
{
const basegfx::BColor aBlack;
@@ -882,7 +883,7 @@ namespace
const Color aEndColor(rGradient.GetEndColor());
const sal_uInt16 nEndIntens(rGradient.GetEndIntensity());
basegfx::BColor aEnd(aEndColor.getBColor());
-
+
if(nEndIntens != 100)
{
const basegfx::BColor aBlack;
@@ -893,29 +894,29 @@ namespace
switch(rGradient.GetStyle())
{
- case GRADIENT_LINEAR :
+ case GRADIENT_LINEAR :
{
aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_LINEAR;
break;
}
- case GRADIENT_AXIAL :
+ case GRADIENT_AXIAL :
{
aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_AXIAL;
break;
}
- case GRADIENT_RADIAL :
+ case GRADIENT_RADIAL :
{
aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_RADIAL;
break;
}
- case GRADIENT_ELLIPTICAL :
+ case GRADIENT_ELLIPTICAL :
{
aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_ELLIPTICAL;
break;
}
- case GRADIENT_SQUARE :
+ case GRADIENT_SQUARE :
{
- aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_SQUARE;
+ aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_SQUARE;
break;
}
default : // GRADIENT_RECT
@@ -945,14 +946,14 @@ namespace
switch(rHatch.GetStyle())
{
- default : // case HATCH_SINGLE :
+ default : // case HATCH_SINGLE :
{
- aHatchStyle = drawinglayer::attribute::HATCHSTYLE_SINGLE;
+ aHatchStyle = drawinglayer::attribute::HATCHSTYLE_SINGLE;
break;
}
- case HATCH_DOUBLE :
+ case HATCH_DOUBLE :
{
- aHatchStyle = drawinglayer::attribute::HATCHSTYLE_DOUBLE;
+ aHatchStyle = drawinglayer::attribute::HATCHSTYLE_DOUBLE;
break;
}
case HATCH_TRIPLE :
@@ -961,7 +962,7 @@ namespace
break;
}
}
-
+
return drawinglayer::attribute::FillHatchAttribute(
aHatchStyle,
(double)rHatch.GetDistance(),
@@ -991,7 +992,7 @@ namespace
//
// This ClipPolyPolygon is identical to the current one, so there is no need to
// create a MaskPrimitive2D containing the up-to-now created primitives, but
- // this was done before. While this does not lead to wrong primitive
+ // this was done before. While this does not lead to wrong primitive
// representations of the metafile data, it creates unneccesarily expensive
// representations. Just detecting when no really 'new' ClipPolyPolygon gets set
// solves the problem.
@@ -1015,7 +1016,7 @@ namespace
// Here the old and the new are definitively different, maybe
// old one and/or new one is not active.
- // Handle deletion of old ClipPolyPolygon. The process evtl. created primitives which
+ // Handle deletion of old ClipPolyPolygon. The process evtl. created primitives which
// belong to this active ClipPolyPolygon. These need to be embedded to a
// MaskPrimitive2D accordingly.
if(rPropertyHolders.Current().getClipPolyPolygonActive() && rTargetHolders.size() > 1)
@@ -1140,7 +1141,7 @@ namespace
else
{
// really a gradient
- drawinglayer::primitive2d::BasePrimitive2D* pRetval =
+ drawinglayer::primitive2d::BasePrimitive2D* pRetval =
new drawinglayer::primitive2d::FillGradientPrimitive2D(
rRange,
aAttribute);
@@ -1201,7 +1202,7 @@ namespace
if(rWallpaper.IsRect() && !rWallpaper.GetRect().IsEmpty())
{
aWallpaperRange = basegfx::B2DRange(
- rWallpaper.GetRect().Left(), rWallpaper.GetRect().Top(),
+ rWallpaper.GetRect().Left(), rWallpaper.GetRect().Top(),
rWallpaper.GetRect().Right(), rWallpaper.GetRect().Bottom());
}
@@ -1210,7 +1211,7 @@ namespace
aWallpaperRange,
aBitmapEx,
eWallpaperStyle);
-
+
if(rProperty.getTransformation().isIdentity())
{
// add directly
@@ -1373,7 +1374,7 @@ namespace
// TextDecoratedPortionPrimitive2D is needed, create one
pResult = new drawinglayer::primitive2d::TextDecoratedPortionPrimitive2D(
-
+
// attributes for TextSimplePortionPrimitive2D
aTextTransform,
rText,
@@ -1435,7 +1436,7 @@ namespace
{
// build text range
const basegfx::B2DRange aTextRange(
- 0.0, -aTextLayouterDevice.getFontAscent(),
+ 0.0, -aTextLayouterDevice.getFontAscent(),
fTextWidth, aTextLayouterDevice.getFontDescent());
// create Transform
@@ -1556,7 +1557,7 @@ namespace
if(bStrikeoutUsed)
{
// create primitive geometry for strikeout
- if(drawinglayer::primitive2d::TEXT_STRIKEOUT_SLASH == aTextStrikeout
+ if(drawinglayer::primitive2d::TEXT_STRIKEOUT_SLASH == aTextStrikeout
|| drawinglayer::primitive2d::TEXT_STRIKEOUT_X == aTextStrikeout)
{
// strikeout with character
@@ -1641,9 +1642,9 @@ namespace
I have marked the single MetaActions with:
- SIMPLE, DONE:
+ SIMPLE, DONE:
Simple, e.g nothing to do or value setting in the context
-
+
CHECKED, WORKS WELL:
Thoroughly tested with extra written test code which created a replacement
Metafile just to test this action in various combinations
@@ -1752,7 +1753,7 @@ namespace
if(aLinePolygon.count())
{
- if(pA->GetLineInfo() == aLineInfo
+ if(pA->GetLineInfo() == aLineInfo
&& aStart == aLinePolygon.getB2DPoint(aLinePolygon.count() - 1))
{
aLinePolygon.append(aEnd);
@@ -1773,7 +1774,7 @@ namespace
aLinePolygon.append(aStart);
aLinePolygon.append(aEnd);
}
-
+
nAction++; if(nAction < nCount) pAction = rMetaFile.GetAction(nAction);
}
@@ -1815,7 +1816,7 @@ namespace
/** CHECKED, WORKS WELL */
/** The original OutputDevice::DrawRect paints nothing when nHor or nVer is zero; but just
because the tools::Polygon operator creating the rounding does produce nonsense. I assume
- this an error and create an unrounded rectangle in that case (implicit in
+ this an error and create an unrounded rectangle in that case (implicit in
createPolygonFromRect)
*/
if(rPropertyHolders.Current().getLineOrFillActive())
@@ -1826,7 +1827,7 @@ namespace
if(!rRectangle.IsEmpty())
{
const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
-
+
if(!aRange.isEmpty())
{
const sal_uInt32 nHor(pA->GetHorzRound());
@@ -2019,7 +2020,7 @@ namespace
{
nTextLength = nTextIndex > nStringLength ? 0 : nStringLength - nTextIndex;
}
-
+
if(nTextLength && rPropertyHolders.Current().getTextColorActive())
{
// preapare DXArray (if used)
@@ -2035,7 +2036,7 @@ namespace
aDXArray.push_back((double)(*(pDXArray + a)));
}
}
-
+
proccessMetaTextAction(
pA->GetPoint(),
pA->GetText(),
@@ -2056,7 +2057,7 @@ namespace
// Implemented getting the DXArray and checking for scale at all. If
// scale is more than 3.5% different, scale the DXArray before usage.
// New status:
-
+
/** CHECKED, WORKS WELL */
const MetaStretchTextAction* pA = (const MetaStretchTextAction*)pAction;
sal_uInt32 nTextLength(pA->GetLen());
@@ -2067,7 +2068,7 @@ namespace
{
nTextLength = nStringLength - nTextIndex;
}
-
+
if(nTextLength && rPropertyHolders.Current().getTextColorActive())
{
drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice;
@@ -2108,7 +2109,7 @@ namespace
rTargetHolders.Current(),
rPropertyHolders.Current());
}
-
+
break;
}
case META_TEXTRECT_ACTION :
@@ -2118,7 +2119,7 @@ namespace
const MetaTextRectAction* pA = (const MetaTextRectAction*)pAction;
const Rectangle& rRectangle = pA->GetRect();
const sal_uInt32 nStringLength(pA->GetText().Len());
-
+
if(!rRectangle.IsEmpty() && 0 != nStringLength)
{
// The problem with this action is that it describes unlayouted text
@@ -2284,7 +2285,7 @@ namespace
{
aCroppedBitmap.Crop(aCropRectangle);
}
-
+
const BitmapEx aCroppedBitmapEx(createMaskBmpEx(aCroppedBitmap, pA->GetColor()));
createBitmapExPrimitive(aCroppedBitmapEx, pA->GetDestPoint(), pA->GetDestSize(), rTargetHolders.Current(), rPropertyHolders.Current());
}
@@ -2306,13 +2307,13 @@ namespace
const Gradient& rGradient = pA->GetGradient();
const drawinglayer::attribute::FillGradientAttribute aAttribute(createFillGradientAttribute(rGradient));
basegfx::B2DPolyPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange));
-
+
if(aAttribute.getStartColor() == aAttribute.getEndColor())
{
// not really a gradient. Create filled rectangle
createFillPrimitive(
- aOutline,
- rTargetHolders.Current(),
+ aOutline,
+ rTargetHolders.Current(),
rPropertyHolders.Current());
}
else
@@ -2386,13 +2387,13 @@ namespace
/** CHECKED, WORKS WELL */
const MetaWallpaperAction* pA = (const MetaWallpaperAction*)pAction;
Rectangle aWallpaperRectangle(pA->GetRect());
-
+
if(!aWallpaperRectangle.IsEmpty())
{
const Wallpaper& rWallpaper = pA->GetWallpaper();
const WallpaperStyle eWallpaperStyle(rWallpaper.GetStyle());
basegfx::B2DRange aWallpaperRange(
- aWallpaperRectangle.Left(), aWallpaperRectangle.Top(),
+ aWallpaperRectangle.Left(), aWallpaperRectangle.Top(),
aWallpaperRectangle.Right(), aWallpaperRectangle.Bottom());
if(WALLPAPER_NULL != eWallpaperStyle)
@@ -2440,7 +2441,7 @@ namespace
{
// new clipping. Get PolyPolygon and transform with current transformation
basegfx::B2DPolyPolygon aNewClipPolyPolygon(getB2DPolyPolygonFromRegion(pA->GetRegion()));
-
+
aNewClipPolyPolygon.transform(rPropertyHolders.Current().getTransformation());
HandleNewClipRegion(aNewClipPolyPolygon, rTargetHolders, rPropertyHolders);
}
@@ -2448,7 +2449,7 @@ namespace
{
// end clipping
const basegfx::B2DPolyPolygon aEmptyPolyPolygon;
-
+
HandleNewClipRegion(aEmptyPolyPolygon, rTargetHolders, rPropertyHolders);
}
@@ -2465,7 +2466,7 @@ namespace
// intersect with empty rectangle will always give empty
// ClipPolyPolygon; start new clipping with empty PolyPolygon
const basegfx::B2DPolyPolygon aEmptyPolyPolygon;
-
+
HandleNewClipRegion(aEmptyPolyPolygon, rTargetHolders, rPropertyHolders);
}
else
@@ -2494,18 +2495,18 @@ namespace
if(aOriginalPolyPolygon.count())
{
aClippedPolyPolygon = basegfx::tools::clipPolyPolygonOnRange(
- aOriginalPolyPolygon,
- aClipRange,
- true,
+ aOriginalPolyPolygon,
+ aClipRange,
+ true,
false);
}
-
+
if(aClippedPolyPolygon != aOriginalPolyPolygon)
{
// start new clipping with intersected region
HandleNewClipRegion(
- aClippedPolyPolygon,
- rTargetHolders,
+ aClippedPolyPolygon,
+ rTargetHolders,
rPropertyHolders);
}
}
@@ -2533,7 +2534,7 @@ namespace
// intersect with empty region will always give empty
// region; start new clipping with empty PolyPolygon
const basegfx::B2DPolyPolygon aEmptyPolyPolygon;
-
+
HandleNewClipRegion(aEmptyPolyPolygon, rTargetHolders, rPropertyHolders);
}
else
@@ -2561,7 +2562,7 @@ namespace
aClippedPolyPolygon = basegfx::tools::clipPolyPolygonOnPolyPolygon(
aOriginalPolyPolygon, aNewClipPolyPolygon, true, false);
}
-
+
if(aClippedPolyPolygon != aOriginalPolyPolygon)
{
// start new clipping with intersected ClipPolyPolygon
@@ -2611,7 +2612,7 @@ namespace
}
}
}
-
+
break;
}
case META_LINECOLOR_ACTION :
@@ -2619,11 +2620,11 @@ namespace
/** CHECKED, WORKS WELL */
const MetaLineColorAction* pA = (const MetaLineColorAction*)pAction;
const bool bActive(pA->IsSetting());
-
+
rPropertyHolders.Current().setLineColorActive(bActive);
if(bActive)
rPropertyHolders.Current().setLineColor(pA->GetColor().getBColor());
-
+
break;
}
case META_FILLCOLOR_ACTION :
@@ -2676,7 +2677,7 @@ namespace
const MetaTextAlignAction* pA = (const MetaTextAlignAction*)pAction;
const TextAlign aNewTextAlign = pA->GetTextAlign();
- // TextAlign is applied to the current font (as in
+ // TextAlign is applied to the current font (as in
// OutputDevice::SetTextAlign which would be used when
// playing the Metafile)
if(rPropertyHolders.Current().getFont().GetAlign() != aNewTextAlign)
@@ -2736,7 +2737,7 @@ namespace
aMapping = getTransformFromMapMode(rMapMode) * aMapping;
rPropertyHolders.Current().setMapUnit(rMapMode.GetMapUnit());
}
-
+
if(!aMapping.isIdentity())
{
aMapping = aMapping * rPropertyHolders.Current().getTransformation();
@@ -2778,7 +2779,7 @@ namespace
{
rPropertyHolders.Current().setTextColor(rFontColor.getBColor());
}
-
+
// caution: do NOT decativate here on transparet, see
// OutputDevice::SetFont(..) for more info
// rPropertyHolders.Current().setTextColorActive(bActivate);
@@ -2811,7 +2812,7 @@ namespace
/** CHECKED, WORKS WELL */
const bool bRegionMayChange(rPropertyHolders.Current().getPushFlags() & PUSH_CLIPREGION);
const bool bRasterOpMayChange(rPropertyHolders.Current().getPushFlags() & PUSH_RASTEROP);
-
+
if(bRegionMayChange && rPropertyHolders.Current().getClipPolyPolygonActive())
{
// end evtl. clipping
@@ -2819,7 +2820,7 @@ namespace
HandleNewClipRegion(aEmptyPolyPolygon, rTargetHolders, rPropertyHolders);
}
-
+
if(bRasterOpMayChange && rPropertyHolders.Current().isRasterOpActive())
{
// end evtl. RasterOp
@@ -2884,7 +2885,7 @@ namespace
// back to old target
rTargetHolders.Pop();
-
+
if(aSubContent.hasElements())
{
rTargetHolders.Current().append(
@@ -2916,7 +2917,7 @@ namespace
aObjectTransform.set(1, 1, aRectangle.GetHeight());
aObjectTransform.set(0, 2, aRectangle.Left());
aObjectTransform.set(1, 2, aRectangle.Top());
-
+
// add current transformation
aObjectTransform = rPropertyHolders.Current().getTransformation() * aObjectTransform;
@@ -2927,7 +2928,7 @@ namespace
pA->GetLink(),
pA->GetSubstitute()));
}
-
+
break;
}
case META_REFPOINT_ACTION :
@@ -2961,9 +2962,9 @@ namespace
// checked files). It's used in combination with the current
// Font.
const MetaTextLineAction* pA = (const MetaTextLineAction*)pAction;
-
+
proccessMetaTextLineAction(
- *pA,
+ *pA,
rTargetHolders.Current(),
rPropertyHolders.Current());
@@ -2999,7 +3000,7 @@ namespace
// check if gradient is a real gradient
const Gradient& rGradient = pA->GetGradient();
const drawinglayer::attribute::FillGradientAttribute aAttribute(createFillGradientAttribute(rGradient));
-
+
if(aAttribute.getStartColor() == aAttribute.getEndColor())
{
// not really a gradient; create UnifiedTransparencePrimitive2D
@@ -3012,16 +3013,16 @@ namespace
{
// really a gradient. Create gradient sub-content (with correct scaling)
basegfx::B2DRange aRange(
- aTargetRectangle.Left(), aTargetRectangle.Top(),
+ aTargetRectangle.Left(), aTargetRectangle.Top(),
aTargetRectangle.Right(), aTargetRectangle.Bottom());
aRange.transform(rPropertyHolders.Current().getTransformation());
// prepare gradient for transparent content
const drawinglayer::primitive2d::Primitive2DReference xTransparence(
new drawinglayer::primitive2d::FillGradientPrimitive2D(
- aRange,
+ aRange,
aAttribute));
-
+
// create transparence primitive
rTargetHolders.Current().append(
new drawinglayer::primitive2d::TransparencePrimitive2D(
@@ -3068,10 +3069,37 @@ namespace
break;
}
+ case META_RENDERGRAPHIC_ACTION :
+ {
+ const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*)pAction;
+ const Rectangle aRectangle(pA->GetPoint(), pA->GetSize());
+
+ if(!aRectangle.IsEmpty())
+ {
+ // create object transform
+ basegfx::B2DHomMatrix aObjectTransform;
+
+ aObjectTransform.set(0, 0, aRectangle.GetWidth());
+ aObjectTransform.set(1, 1, aRectangle.GetHeight());
+ aObjectTransform.set(0, 2, aRectangle.Left());
+ aObjectTransform.set(1, 2, aRectangle.Top());
+
+ // add current transformation
+ aObjectTransform = rPropertyHolders.Current().getTransformation() * aObjectTransform;
+
+ // embed using EpsPrimitive
+ rTargetHolders.Current().append(
+ new drawinglayer::primitive2d::RenderGraphicPrimitive2D(
+ pA->GetRenderGraphic(),
+ aObjectTransform ) );
+ }
+
+ break;
+ }
case META_COMMENT_ACTION :
{
/** CHECKED, WORKS WELL */
- // I already implemented
+ // I already implemented
// XPATHFILL_SEQ_BEGIN, XPATHFILL_SEQ_END
// XPATHSTROKE_SEQ_BEGIN, XPATHSTROKE_SEQ_END,
// but opted to remove these again; it works well without them
@@ -3117,11 +3145,11 @@ namespace
{
// transform geometry
aPolyPolygon.transform(rPropertyHolders.Current().getTransformation());
-
+
// get and check if gradient is a real gradient
const Gradient& rGradient = pMetaGradientExAction->GetGradient();
const drawinglayer::attribute::FillGradientAttribute aAttribute(createFillGradientAttribute(rGradient));
-
+
if(aAttribute.getStartColor() == aAttribute.getEndColor())
{
// not really a gradient
@@ -3178,12 +3206,12 @@ namespace drawinglayer
while(aTargetHolders.size() > 1)
{
- appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
+ appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
aTargetHolders.Current().getPrimitive2DSequence(aPropertyHolders.Current()));
aTargetHolders.Pop();
}
-
- appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
+
+ appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
aTargetHolders.Current().getPrimitive2DSequence(aPropertyHolders.Current()));
if(xRetval.hasElements())
@@ -3213,7 +3241,7 @@ namespace drawinglayer
}
MetafilePrimitive2D::MetafilePrimitive2D(
- const basegfx::B2DHomMatrix& rMetaFileTransform,
+ const basegfx::B2DHomMatrix& rMetaFileTransform,
const GDIMetaFile& rMetaFile)
: BufferedDecompositionPrimitive2D(),
maMetaFileTransform(rMetaFileTransform),
@@ -3227,7 +3255,7 @@ namespace drawinglayer
{
const MetafilePrimitive2D& rCompare = (MetafilePrimitive2D&)rPrimitive;
- return (getTransform() == rCompare.getTransform()
+ return (getTransform() == rCompare.getTransform()
&& getMetaFile() == rCompare.getMetaFile());
}
diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
index 9502df95a3..589c2e814d 100644
--- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
@@ -528,6 +528,8 @@ namespace drawinglayer
case PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D :
case PRIMITIVE2D_ID_FILLHATCHPRIMITIVE2D :
case PRIMITIVE2D_ID_PAGEPREVIEWPRIMITIVE2D :
+ case PRIMITIVE2D_ID_MEDIAPRIMITIVE2D:
+ case PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D:
{
if(!getHitTextOnly())
{
diff --git a/drawinglayer/source/processor2d/linegeometryextractor2d.cxx b/drawinglayer/source/processor2d/linegeometryextractor2d.cxx
index cdf64d5e43..68d1b4942c 100644
--- a/drawinglayer/source/processor2d/linegeometryextractor2d.cxx
+++ b/drawinglayer/source/processor2d/linegeometryextractor2d.cxx
@@ -123,6 +123,7 @@ namespace drawinglayer
case PRIMITIVE2D_ID_MARKERARRAYPRIMITIVE2D :
case PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D :
case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D :
+ case PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D :
case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D :
case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
{
diff --git a/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx b/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx
index e36f76765f..c3ac630fa4 100644
--- a/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx
+++ b/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx
@@ -214,6 +214,7 @@ namespace drawinglayer
case PRIMITIVE2D_ID_MARKERARRAYPRIMITIVE2D :
case PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D :
case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D :
+ case PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D :
case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D :
case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
{
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 4792e9beb7..186ac26332 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -38,6 +38,7 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/rendergraphicprimitive2d.hxx>
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygonclipper.hxx>
@@ -1287,6 +1288,12 @@ namespace drawinglayer
RenderBitmapPrimitive2D(static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate));
break;
}
+ case PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D :
+ {
+ // direct draw of transformed RenderGraphic primitive; use default processing
+ RenderRenderGraphicPrimitive2D(static_cast< const primitive2d::RenderGraphicPrimitive2D& >(rCandidate));
+ break;
+ }
case PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D :
{
// need to handle PolyPolygonBitmapPrimitive2D here to support XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index c21f3bc87a..6eba230632 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -35,6 +35,7 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/rendergraphicprimitive2d.hxx>
#include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx>
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
@@ -193,6 +194,12 @@ namespace drawinglayer
RenderBitmapPrimitive2D(static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate));
break;
}
+ case PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D :
+ {
+ // direct draw of transformed BitmapEx primitive
+ RenderRenderGraphicPrimitive2D(static_cast< const primitive2d::RenderGraphicPrimitive2D& >(rCandidate));
+ break;
+ }
case PRIMITIVE2D_ID_FILLBITMAPPRIMITIVE2D :
{
// direct draw of fillBitmapPrimitive
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 71bb587339..550d1da105 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -35,6 +35,7 @@
#include <vcl/outdev.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/rendergraphicprimitive2d.hxx>
#include <vclhelperbitmaptransform.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <vclhelperbitmaprender.hxx>
@@ -60,6 +61,7 @@
#include <vcl/metric.hxx>
#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
#include <drawinglayer/primitive2d/epsprimitive2d.hxx>
+#include <vcl/rendergraphicrasterizer.hxx>
//////////////////////////////////////////////////////////////////////////////
// control support
@@ -128,9 +130,9 @@ namespace drawinglayer
{
// Get the VCL font (use FontHeight as FontWidth)
Font aFont(primitive2d::getVclFontFromFontAttribute(
- rTextCandidate.getFontAttribute(),
- aFontScaling.getX(),
- aFontScaling.getY(),
+ rTextCandidate.getFontAttribute(),
+ aFontScaling.getX(),
+ aFontScaling.getY(),
fRotate,
rTextCandidate.getLocale()));
@@ -140,7 +142,7 @@ namespace drawinglayer
if( pTCPP != NULL )
{
-
+
// set the color of text decorations
const basegfx::BColor aTextlineColor = maBColorModifierStack.getModifiedColor(pTCPP->getTextlineColor());
mpOutputDevice->SetTextLineColor( Color(aTextlineColor) );
@@ -227,7 +229,7 @@ namespace drawinglayer
const basegfx::B2DVector aPixelVector(maCurrentTransformation * basegfx::B2DVector(1.0, 0.0));
const double fPixelVectorFactor(aPixelVector.getLength());
- for(::std::vector< double >::const_iterator aStart(rTextCandidate.getDXArray().begin());
+ for(::std::vector< double >::const_iterator aStart(rTextCandidate.getDXArray().begin());
aStart != rTextCandidate.getDXArray().end(); aStart++)
{
aTransformedDXArray.push_back(basegfx::fround((*aStart) * fPixelVectorFactor));
@@ -253,8 +255,8 @@ namespace drawinglayer
if(aTransformedDXArray.size())
{
mpOutputDevice->DrawTextArray(
- aStartPoint,
- rTextCandidate.getText(),
+ aStartPoint,
+ rTextCandidate.getText(),
&(aTransformedDXArray[0]),
rTextCandidate.getTextPosition(),
rTextCandidate.getTextLength());
@@ -262,8 +264,8 @@ namespace drawinglayer
else
{
mpOutputDevice->DrawText(
- aStartPoint,
- rTextCandidate.getText(),
+ aStartPoint,
+ rTextCandidate.getText(),
rTextCandidate.getTextPosition(),
rTextCandidate.getTextLength());
}
@@ -302,7 +304,7 @@ namespace drawinglayer
const basegfx::B2DRange& rDiscreteViewport = getViewInformation2D().getDiscreteViewport();
basegfx::B2DPolyPolygon aLocalPolyPolygon(basegfx::tools::clipPolygonOnRange(
aLocalPolygon, rDiscreteViewport, true, false));
-
+
if(aLocalPolyPolygon.count())
{
// subdivide
@@ -324,7 +326,7 @@ namespace drawinglayer
for(sal_uInt32 a(0); a < nCount; a++)
{
const basegfx::B2DPolygon aTempPolygon(aB2DTrapezoidVector[a].getB2DPolygon());
-
+
if(bShowOutlinesThere)
{
mpOutputDevice->SetFillColor(Color(aHairlineColor));
@@ -421,6 +423,75 @@ namespace drawinglayer
}
}
+ void VclProcessor2D::RenderRenderGraphicPrimitive2D(const primitive2d::RenderGraphicPrimitive2D& rRenderGraphicCandidate)
+ {
+ // create local transform
+ basegfx::B2DHomMatrix aLocalTransform(maCurrentTransformation * rRenderGraphicCandidate.getTransform());
+ vcl::RenderGraphic aRenderGraphic(rRenderGraphicCandidate.getRenderGraphic());
+ bool bPainted(false);
+
+ if(maBColorModifierStack.count())
+ {
+ // !!! TODO
+ // aRenderGraphic = impModifyRenderGraphic(maBColorModifierStack, aRenderGraphic);
+
+ if(aRenderGraphic.IsEmpty())
+ {
+ // color gets completely replaced, get it
+ const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor()));
+ basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon());
+ aPolygon.transform(aLocalTransform);
+
+ mpOutputDevice->SetFillColor(Color(aModifiedColor));
+ mpOutputDevice->SetLineColor();
+ mpOutputDevice->DrawPolygon(aPolygon);
+
+ bPainted = true;
+ }
+ }
+
+ if(!bPainted)
+ {
+ // decompose matrix to check for shear, rotate and mirroring
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0);
+
+ if( basegfx::fTools::equalZero( fRotate ) )
+ {
+ aOutlineRange.transform( aLocalTransform );
+ }
+ else
+ {
+ // !!! TODO
+ // if rotated, create the unrotated output rectangle for the GraphicManager paint
+ /*
+ const basegfx::B2DHomMatrix aSimpleObjectMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(
+ fabs(aScale.getX()), fabs(aScale.getY()),
+ aTranslate.getX(), aTranslate.getY()));
+
+ aOutlineRange.transform(aSimpleObjectMatrix);
+ */
+ }
+
+ // prepare dest coordinates
+ const Point aPoint( basegfx::fround(aOutlineRange.getMinX() ),
+ basegfx::fround(aOutlineRange.getMinY() ) );
+ const Size aSize( basegfx::fround(aOutlineRange.getWidth() ),
+ basegfx::fround(aOutlineRange.getHeight() ) );
+ const Size aSizePixel( mpOutputDevice->LogicToPixel( aSize ) );
+ const vcl::RenderGraphicRasterizer aRasterizer( aRenderGraphic );
+ const BitmapEx aBitmapEx( aRasterizer.Rasterize( aSizePixel, fRotate, fShearX ) );
+
+ if( !aBitmapEx.IsEmpty() )
+ {
+ mpOutputDevice->DrawBitmapEx( aPoint, aSize, aBitmapEx );
+ }
+ }
+ }
+
void VclProcessor2D::RenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapCandidate)
{
const attribute::FillBitmapAttribute& rFillBitmapAttribute(rFillBitmapCandidate.getFillBitmap());
@@ -510,7 +581,7 @@ namespace drawinglayer
// nBWidth, nBHeight is the pixel size of the neede bitmap. To not need to scale it
// in vcl many times, create a size-optimized version
const Size aNeededBitmapSizePixel(nBWidth, nBHeight);
-
+
if(aNeededBitmapSizePixel != aBitmapEx.GetSizePixel())
{
aBitmapEx.Scale(aNeededBitmapSizePixel);
@@ -622,7 +693,7 @@ namespace drawinglayer
{
// with tiling, fill the whole PolyPolygon with the modifier color
basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolyPolygon);
-
+
aLocalPolyPolygon.transform(maCurrentTransformation);
mpOutputDevice->SetLineColor();
mpOutputDevice->SetFillColor(Color(rTopmostModifier.getBColor()));
@@ -631,7 +702,7 @@ namespace drawinglayer
else
{
// without tiling, only the area common to the bitmap tile and the
- // PolyPolygon is filled. Create the bitmap tile area in object
+ // PolyPolygon is filled. Create the bitmap tile area in object
// coordinates. For this, the object transformation needs to be created
// from the already scaled PolyPolygon. The tile area in object
// coordinates wil always be non-rotated, so it's not necessary to
@@ -696,7 +767,7 @@ namespace drawinglayer
const basegfx::B2DRange& rDiscreteViewport = getViewInformation2D().getDiscreteViewport();
aLocalPolyPolygon = basegfx::tools::clipPolyPolygonOnRange(
aLocalPolyPolygon, rDiscreteViewport, true, false);
-
+
if(aLocalPolyPolygon.count())
{
// subdivide
@@ -717,7 +788,7 @@ namespace drawinglayer
for(sal_uInt32 a(0); a < nCount; a++)
{
const basegfx::B2DPolygon aTempPolygon(aB2DTrapezoidVector[a].getB2DPolygon());
-
+
if(bShowOutlinesThere)
{
mpOutputDevice->SetFillColor(Color(aPolygonColor));
@@ -740,7 +811,7 @@ namespace drawinglayer
{
mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon);
- if(mnPolygonStrokePrimitive2D
+ if(mnPolygonStrokePrimitive2D
&& getOptionsDrawinglayer().IsAntiAliasing()
&& (mpOutputDevice->GetAntialiasing() & ANTIALIASING_ENABLE_B2DDRAW))
{
@@ -775,7 +846,7 @@ namespace drawinglayer
aScale = basegfx::absolute(aScale);
fRotate += F_PI;
}
-
+
// get BoundRect
basegfx::B2DRange aOutlineRange(rMetaCandidate.getB2DRange(getViewInformation2D()));
aOutlineRange.transform(maCurrentTransformation);
@@ -925,7 +996,7 @@ namespace drawinglayer
// use decomposition
process(rTransCandidate.get2DDecomposition(getViewInformation2D()));
}
- else
+ else
{
if(0.0 == rTransCandidate.getTransparence())
{
@@ -947,7 +1018,7 @@ namespace drawinglayer
// paint content to it
process(rTransCandidate.getChildren());
-
+
// back to old OutDev
mpOutputDevice = pLastOutputDevice;
@@ -1073,19 +1144,19 @@ namespace drawinglayer
{
// get discrete half size
const basegfx::B2DVector aDiscreteHalfSize(
- (aBitmapSize.getWidth() - 1.0) * 0.5,
+ (aBitmapSize.getWidth() - 1.0) * 0.5,
(aBitmapSize.getHeight() - 1.0) * 0.5);
const bool bWasEnabled(mpOutputDevice->IsMapModeEnabled());
- // do not forget evtl. moved origin in target device MapMode when
+ // do not forget evtl. moved origin in target device MapMode when
// switching it off; it would be missing and lead to wrong positions.
// All his could be done using logic sizes and coordinates, too, but
// we want a 1:1 bitmap rendering here, so it's more safe and faster
// to work with switching off MapMode usage completely.
const Point aOrigin(mpOutputDevice->GetMapMode().GetOrigin());
-
+
mpOutputDevice->EnableMapMode(false);
-
+
for(std::vector< basegfx::B2DPoint >::const_iterator aIter(rPositions.begin()); aIter != rPositions.end(); aIter++)
{
const basegfx::B2DPoint aDiscreteTopLeft((maCurrentTransformation * (*aIter)) - aDiscreteHalfSize);
@@ -1204,22 +1275,22 @@ namespace drawinglayer
const double fDistance((fDiscreteLineWidth - 1.0) * 0.5);
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
+
aMat.set(0, 2, -fDistance);
aMat.set(1, 2, 0.0);
aCandidate.transform(aMat);
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
+
aMat.set(0, 2, fDistance);
aMat.set(1, 2, -fDistance);
aCandidate.transform(aMat);
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
+
aMat.set(0, 2, fDistance);
aMat.set(1, 2, fDistance);
aCandidate.transform(aMat);
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
+
aMat.set(0, 2, -fDistance);
aMat.set(1, 2, fDistance);
aCandidate.transform(aMat);
@@ -1283,16 +1354,16 @@ namespace drawinglayer
}
}
}
-
+
if(!bDone)
{
// remeber that we enter a PolygonStrokePrimitive2D decomposition,
// used for AA thick line drawing
mnPolygonStrokePrimitive2D++;
-
+
// line width is big enough for standard filled polygon visualisation or zero
process(rPolygonStrokeCandidate.get2DDecomposition(getViewInformation2D()));
-
+
// leave PolygonStrokePrimitive2D
mnPolygonStrokePrimitive2D--;
}
@@ -1304,7 +1375,7 @@ namespace drawinglayer
// primitive to handle embedded Eps data. On some devices, this can be
// painted directly (mac, printer).
// To be able to handle the replacement correctly, i need to handle it myself
- // since DrawEPS will not be able e.g. to rotate the replacement. To be able
+ // since DrawEPS will not be able e.g. to rotate the replacement. To be able
// to do that, i added a boolean return to OutputDevice::DrawEPS(..)
// to know when EPS was handled directly already.
basegfx::B2DRange aRange(0.0, 0.0, 1.0, 1.0);