incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1231198 - in /incubator/ooo/trunk/main: drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx drawinglayer/source/processor2d/contourextractor2d.cxx svgio/source/svgreader/svgclippathnode.cxx svx/source/svdraw/svdobj.cxx
Date Fri, 13 Jan 2012 17:29:16 GMT
Author: alg
Date: Fri Jan 13 17:29:15 2012
New Revision: 1231198

URL: http://svn.apache.org/viewvc?rev=1231198&view=rev
Log:
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive representation instead
of TransparencePrimitive2D

Modified:
    incubator/ooo/trunk/main/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx
    incubator/ooo/trunk/main/drawinglayer/source/processor2d/contourextractor2d.cxx
    incubator/ooo/trunk/main/svgio/source/svgreader/svgclippathnode.cxx
    incubator/ooo/trunk/main/svx/source/svdraw/svdobj.cxx

Modified: incubator/ooo/trunk/main/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx?rev=1231198&r1=1231197&r2=1231198&view=diff
==============================================================================
--- incubator/ooo/trunk/main/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx
(original)
+++ incubator/ooo/trunk/main/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx
Fri Jan 13 17:29:15 2012
@@ -46,11 +46,16 @@ namespace drawinglayer
             /// the extracted contour
             basegfx::B2DPolyPolygonVector       maExtractedContour;
 
+            /// bitfield
+            bool                                mbExtractFillOnly : 1;
+
 			/// tooling methods
 			void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
 
 		public:
-			ContourExtractor2D(const geometry::ViewInformation2D& rViewInformation);
+			ContourExtractor2D(
+                const geometry::ViewInformation2D& rViewInformation,
+                bool bExtractFillOnly);
 			virtual ~ContourExtractor2D();
 			
 			const basegfx::B2DPolyPolygonVector& getExtractedContour() const { return maExtractedContour;
}

Modified: incubator/ooo/trunk/main/drawinglayer/source/processor2d/contourextractor2d.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/drawinglayer/source/processor2d/contourextractor2d.cxx?rev=1231198&r1=1231197&r2=1231198&view=diff
==============================================================================
--- incubator/ooo/trunk/main/drawinglayer/source/processor2d/contourextractor2d.cxx (original)
+++ incubator/ooo/trunk/main/drawinglayer/source/processor2d/contourextractor2d.cxx Fri Jan
13 17:29:15 2012
@@ -46,9 +46,12 @@ namespace drawinglayer
 {
 	namespace processor2d
 	{
-		ContourExtractor2D::ContourExtractor2D(const geometry::ViewInformation2D& rViewInformation)
+		ContourExtractor2D::ContourExtractor2D(
+            const geometry::ViewInformation2D& rViewInformation,
+            bool bExtractFillOnly)
 		:	BaseProcessor2D(rViewInformation),
-			maExtractedContour()
+			maExtractedContour(),
+            mbExtractFillOnly(bExtractFillOnly)
 		{
 		}
 
@@ -62,19 +65,22 @@ namespace drawinglayer
 			{
 				case PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D :
 				{
-					// extract hairline in world coordinates
-					const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate(static_cast<
const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate));
-					basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon());
-					aLocalPolygon.transform(getViewInformation2D().getObjectTransformation());
-
-                    if(aLocalPolygon.isClosed())
+                    if(!mbExtractFillOnly)
                     {
-                        // line polygons need to be represented as open polygons to differentiate
them
-                        // from filled polygons
-                        basegfx::tools::openWithGeometryChange(aLocalPolygon);
-                    }
+                        // extract hairline in world coordinates
+                        const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate(static_cast<
const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate));
+                        basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon());
+                        aLocalPolygon.transform(getViewInformation2D().getObjectTransformation());
+
+                        if(aLocalPolygon.isClosed())
+                        {
+                            // line polygons need to be represented as open polygons to differentiate
them
+                            // from filled polygons
+                            basegfx::tools::openWithGeometryChange(aLocalPolygon);
+                        }
 
-                    maExtractedContour.push_back(basegfx::B2DPolyPolygon(aLocalPolygon));
+                        maExtractedContour.push_back(basegfx::B2DPolyPolygon(aLocalPolygon));
+                    }
 					break;
 				}
 				case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D :

Modified: incubator/ooo/trunk/main/svgio/source/svgreader/svgclippathnode.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svgio/source/svgreader/svgclippathnode.cxx?rev=1231198&r1=1231197&r2=1231198&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svgio/source/svgreader/svgclippathnode.cxx (original)
+++ incubator/ooo/trunk/main/svgio/source/svgreader/svgclippathnode.cxx Fri Jan 13 17:29:15
2012
@@ -24,9 +24,11 @@
 
 #include <svgio/svgreader/svgclippathnode.hxx>
 #include <drawinglayer/primitive2d/transformprimitive2d.hxx>
-#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
+#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <drawinglayer/processor2d/contourextractor2d.hxx>
+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -133,39 +135,58 @@ namespace svgio
         {
             if(rContent.hasElements())
             {
+                const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
                 drawinglayer::primitive2d::Primitive2DSequence aClipTarget;
+                basegfx::B2DPolyPolygon aClipPolyPolygon;
 
                 // get clipPath definition as primitives
                 decomposeSvgNode(aClipTarget, true);
 
                 if(aClipTarget.hasElements())
                 {
+                    // extract filled plygons as base for a mask PolyPolygon
+                    drawinglayer::processor2d::ContourExtractor2D aExtractor(aViewInformation2D,
true);
+
+                    aExtractor.process(aClipTarget);
+
+                    const basegfx::B2DPolyPolygonVector& rResult(aExtractor.getExtractedContour());
+                    const sal_uInt32 nSize(rResult.size());
+
+                    if(nSize > 1)
+                    {
+                        // merge to single clipPolyPolygon
+                        aClipPolyPolygon = basegfx::tools::mergeToSinglePolyPolygon(rResult);
+                    }
+                    else
+                    {
+                        aClipPolyPolygon = rResult[0];
+                    }
+                }
+
+                if(aClipPolyPolygon.count())
+                {
                     if(objectBoundingBox == getClipPathUnits())
                     {
-                        // clip is object-relative, embed in content transformation
+                        // clip is object-relative, transform using content transformation
                         const basegfx::B2DRange aContentRange(
                             drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(
                                 rContent,
-                                drawinglayer::geometry::ViewInformation2D()));
-
-                        const drawinglayer::primitive2d::Primitive2DReference xTransform(
-                            new drawinglayer::primitive2d::TransformPrimitive2D(
-                                basegfx::tools::createScaleTranslateB2DHomMatrix(
-                                    aContentRange.getRange(),
-                                    aContentRange.getMinimum()),
-                                aClipTarget));
+                                aViewInformation2D));
 
-                        aClipTarget = drawinglayer::primitive2d::Primitive2DSequence(&xTransform,
1);
+                        aClipPolyPolygon.transform(
+                            basegfx::tools::createScaleTranslateB2DHomMatrix(
+                                aContentRange.getRange(),
+                                aContentRange.getMinimum()));
                     }
 
-                    // redefine target. Use TransparencePrimitive2D with created clip
+                    // redefine target. Use MaskPrimitive2D with created clip
                     // geometry. Using the automatically set mbIsClipPathContent at 
                     // SvgStyleAttributes the clip definition is without fill, stroke, 
-                    // and strokeWidth and forced to black, thus being 100% opaque
+                    // and strokeWidth and forced to black
                     const drawinglayer::primitive2d::Primitive2DReference xEmbedTransparence(
-                        new drawinglayer::primitive2d::TransparencePrimitive2D(
-                            rContent,
-                            aClipTarget));
+                        new drawinglayer::primitive2d::MaskPrimitive2D(
+                            aClipPolyPolygon,
+                            rContent));
 
                     rContent = drawinglayer::primitive2d::Primitive2DSequence(&xEmbedTransparence,
1);
                 }

Modified: incubator/ooo/trunk/main/svx/source/svdraw/svdobj.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/svdraw/svdobj.cxx?rev=1231198&r1=1231197&r2=1231198&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/svdraw/svdobj.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/svdraw/svdobj.cxx Fri Jan 13 17:29:15 2012
@@ -1200,8 +1200,8 @@ basegfx::B2DPolyPolygon SdrObject::TakeC
 		    // use neutral ViewInformation
 		    const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
 
-		    // create extractor, process and get result
-		    drawinglayer::processor2d::ContourExtractor2D aExtractor(aViewInformation2D);
+		    // create extractor, process and get result (with hairlines as opened polygons)
+		    drawinglayer::processor2d::ContourExtractor2D aExtractor(aViewInformation2D, false);
 		    aExtractor.process(xSequence);
             const basegfx::B2DPolyPolygonVector& rResult(aExtractor.getExtractedContour());
             const sal_uInt32 nSize(rResult.size());



Mime
View raw message