diff options
Diffstat (limited to 'drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx')
-rw-r--r-- | drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx | 88 |
1 files changed, 68 insertions, 20 deletions
diff --git a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx index b6badf9d1f18..471d18ed846e 100644 --- a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx @@ -31,14 +31,11 @@ #include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx> #include <basegfx/polygon/b3dpolygon.hxx> #include <drawinglayer/attribute/strokeattribute.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> #include <drawinglayer/primitive3d/baseprimitive3d.hxx> #include <drawinglayer/primitive3d/polygonprimitive3d.hxx> #include <basegfx/polygon/b3dpolypolygon.hxx> #include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> #include <vcl/vclenum.hxx> -#include <drawinglayer/attribute/fillattribute.hxx> #include <drawinglayer/attribute/fillbitmapattribute.hxx> #include <drawinglayer/attribute/sdrfillbitmapattribute.hxx> #include <vcl/bmpacc.hxx> @@ -47,8 +44,12 @@ #include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx> #include <drawinglayer/primitive3d/hatchtextureprimitive3d.hxx> #include <drawinglayer/primitive3d/shadowprimitive3d.hxx> -#include <drawinglayer/attribute/sdrattribute3d.hxx> #include <basegfx/range/b2drange.hxx> +#include <drawinglayer/attribute/sdrlineattribute.hxx> +#include <drawinglayer/attribute/sdrobjectattribute3d.hxx> +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <drawinglayer/attribute/sdrshadowattribute.hxx> +#include <drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -167,8 +168,8 @@ namespace drawinglayer if(0.0 != rLine.getTransparence()) { - // create UnifiedAlphaTexturePrimitive3D, add created primitives and exchange - const Primitive3DReference xRef(new UnifiedAlphaTexturePrimitive3D(rLine.getTransparence(), aRetval)); + // create UnifiedTransparenceTexturePrimitive3D, add created primitives and exchange + const Primitive3DReference xRef(new UnifiedTransparenceTexturePrimitive3D(rLine.getTransparence(), aRetval)); aRetval = Primitive3DSequence(&xRef, 1L); } @@ -181,7 +182,7 @@ namespace drawinglayer const basegfx::B2DVector& rTextureSize, const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute, const attribute::SdrFillAttribute& rFill, - const attribute::FillGradientAttribute* pFillGradient) + const attribute::FillGradientAttribute& rFillGradient) { Primitive3DSequence aRetval; @@ -209,27 +210,45 @@ namespace drawinglayer } // look for and evtl. build texture sub-group primitive - if(rFill.isGradient() || rFill.isHatch() || rFill.isBitmap()) + if(!rFill.getGradient().isDefault() + || !rFill.getHatch().isDefault() + || !rFill.getBitmap().isDefault()) { bool bModulate(::com::sun::star::drawing::TextureMode_MODULATE == aSdr3DObjectAttribute.getTextureMode()); bool bFilter(aSdr3DObjectAttribute.getTextureFilter()); - BasePrimitive3D* pNewTexturePrimitive3D = 0L; + BasePrimitive3D* pNewTexturePrimitive3D = 0; - if(rFill.isGradient()) + if(!rFill.getGradient().isDefault()) { // create gradientTexture3D with sublist, add to local aRetval - pNewTexturePrimitive3D = new GradientTexturePrimitive3D(*rFill.getGradient(), aRetval, rTextureSize, bModulate, bFilter); + pNewTexturePrimitive3D = new GradientTexturePrimitive3D( + rFill.getGradient(), + aRetval, + rTextureSize, + bModulate, + bFilter); } - else if(rFill.isHatch()) + else if(!rFill.getHatch().isDefault()) { // create hatchTexture3D with sublist, add to local aRetval - pNewTexturePrimitive3D = new HatchTexturePrimitive3D(*rFill.getHatch(), aRetval, rTextureSize, bModulate, bFilter); + pNewTexturePrimitive3D = new HatchTexturePrimitive3D( + rFill.getHatch(), + aRetval, + rTextureSize, + bModulate, + bFilter); } - else // if(rFill.isBitmap()) + else // if(!rFill.getBitmap().isDefault()) { // create bitmapTexture3D with sublist, add to local aRetval basegfx::B2DRange aTexRange(0.0, 0.0, rTextureSize.getX(), rTextureSize.getY()); - pNewTexturePrimitive3D = new BitmapTexturePrimitive3D(rFill.getBitmap()->getFillBitmapAttribute(aTexRange), aRetval, rTextureSize, bModulate, bFilter); + + pNewTexturePrimitive3D = new BitmapTexturePrimitive3D( + rFill.getBitmap().getFillBitmapAttribute(aTexRange), + aRetval, + rTextureSize, + bModulate, + bFilter); } // exchange aRetval content with texture group @@ -247,14 +266,14 @@ namespace drawinglayer if(0.0 != rFill.getTransparence()) { - // create UnifiedAlphaTexturePrimitive3D with sublist and exchange - const Primitive3DReference xRef(new UnifiedAlphaTexturePrimitive3D(rFill.getTransparence(), aRetval)); + // create UnifiedTransparenceTexturePrimitive3D with sublist and exchange + const Primitive3DReference xRef(new UnifiedTransparenceTexturePrimitive3D(rFill.getTransparence(), aRetval)); aRetval = Primitive3DSequence(&xRef, 1L); } - else if(pFillGradient) + else if(!rFillGradient.isDefault()) { - // create AlphaTexturePrimitive3D with sublist and exchange - const Primitive3DReference xRef(new AlphaTexturePrimitive3D(*pFillGradient, aRetval, rTextureSize)); + // create TransparenceTexturePrimitive3D with sublist and exchange + const Primitive3DReference xRef(new TransparenceTexturePrimitive3D(rFillGradient, aRetval, rTextureSize)); aRetval = Primitive3DSequence(&xRef, 1L); } } @@ -284,6 +303,35 @@ namespace drawinglayer return Primitive3DSequence(); } } + + Primitive3DSequence createHiddenGeometryPrimitives3D( + const ::std::vector< basegfx::B3DPolyPolygon >& r3DPolyPolygonVector, + const basegfx::B3DHomMatrix& rObjectTransform, + const basegfx::B2DVector& rTextureSize, + const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute) + { + // create hidden sub-geometry which can be used for HitTest + // and BoundRect calculations, but will not be visualized + const attribute::SdrFillAttribute aSimplifiedFillAttribute( + 0.0, + basegfx::BColor(), + attribute::FillGradientAttribute(), + attribute::FillHatchAttribute(), + attribute::SdrFillBitmapAttribute()); + + const Primitive3DReference aHidden( + new HiddenGeometryPrimitive3D( + create3DPolyPolygonFillPrimitives( + r3DPolyPolygonVector, + rObjectTransform, + rTextureSize, + aSdr3DObjectAttribute, + aSimplifiedFillAttribute, + attribute::FillGradientAttribute()))); + + return Primitive3DSequence(&aHidden, 1); + } + } // end of namespace primitive3d } // end of namespace drawinglayer |