diff options
author | Armin Weiss <aw@openoffice.org> | 2006-08-09 15:51:16 +0000 |
---|---|---|
committer | Armin Weiss <aw@openoffice.org> | 2006-08-09 15:51:16 +0000 |
commit | 4d0a693b85b6191d351f7a6bb0e5c30b2e47eca8 (patch) | |
tree | ce070c550ee0fb8884592d0be883a48de224ad19 /drawinglayer | |
parent | 73679d08d7072f98065007b7014df46e45e2862e (diff) |
#i39532#
Diffstat (limited to 'drawinglayer')
30 files changed, 2855 insertions, 625 deletions
diff --git a/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx new file mode 100644 index 000000000000..d34d76cf0f01 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx @@ -0,0 +1,113 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: baseprocessor3d.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2006-08-09 16:45:32 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX +#define _DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX + +#ifndef _DRAWINGLAYER_GEOMETRY_VIEWINFORMATION_HXX +#include <drawinglayer/geometry/viewinformation.hxx> +#endif + +#ifndef _DRAWINGLAYER_GEOMETRY_TRANSFORMATION3D_HXX +#include <drawinglayer/geometry/transformation3d.hxx> +#endif + +#ifndef _DRAWINGLAYER_PRIMITIVE3D_PRIMITIVE3D_HXX +#include <drawinglayer/primitive3d/primitive3d.hxx> +#endif + +////////////////////////////////////////////////////////////////////////////// +// predefines + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor3d + { + class baseProcessor3D + { + protected: + // the view information and the complete 3d stack + const geometry::viewInformation maViewInformation; + const geometry::transformation3D maTransformation3D; + + public: + baseProcessor3D( + const geometry::viewInformation& rViewInformation, + const geometry::transformation3D& rTransformation3D); + virtual ~baseProcessor3D(); + + // the central processing method + virtual void process(const primitive3d::primitiveVector3D& rSource) = 0; + + // data access + const geometry::viewInformation& getViewInformation() const { return maViewInformation; } + const geometry::transformation3D& getTransformation3D() const { return maTransformation3D; } + }; + } // end of namespace processor3d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor3d + { + class collectingProcessor3D : public baseProcessor3D + { + protected: + primitive3d::primitiveVector3D maPrimitiveVector; + + public: + collectingProcessor3D( + const geometry::viewInformation& rViewInformation, + const geometry::transformation3D& rTransformation3D); + virtual ~collectingProcessor3D(); + + // the central processing method + virtual void process(const primitive3d::primitiveVector3D& rSource); + + // data access + const primitive3d::primitiveVector3D& getPrimitives() const { return maPrimitiveVector; } + }; + } // end of namespace processor3d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //_DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx new file mode 100644 index 000000000000..3bc59564aea6 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx @@ -0,0 +1,182 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: defaultprocessor3d.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2006-08-09 16:45:32 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX +#define _DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX + +#ifndef _DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX +#include <drawinglayer/processor3d/baseprocessor3d.hxx> +#endif + +#ifndef _BGFX_MATRIX_B3DHOMMATRIX_HXX +#include <basegfx/matrix/b3dhommatrix.hxx> +#endif + +#ifndef _BGFX_COLOR_BCOLOR_HXX +#include <basegfx/color/bcolor.hxx> +#endif + +#ifndef _DRAWINGLAYER_GEOMETRY_TRANSFORMATION3D_HXX +#include <drawinglayer/geometry/transformation3d.hxx> +#endif + +#ifndef _SV_BITMAPEX_HXX +#include <vcl/bitmapex.hxx> +#endif + +#ifndef _DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX +#include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx> +#endif + +#ifndef _BGFX_RANGE_B2DRANGE_HXX +#include <basegfx/range/b2drange.hxx> +#endif + +////////////////////////////////////////////////////////////////////////////// +// predefines +namespace basegfx { + class BZPixelRaster; +} + +namespace drawinglayer { namespace attribute { + class sdrSceneAttribute; + class sdrLightingAttribute; + class materialAttribute3D; +}} + +namespace drawinglayer { namespace primitive3d { + class polygonHairlinePrimitive3D; + class polyPolygonMaterialPrimitive3D; + class gradientTexturePrimitive3D; + class hatchTexturePrimitive3D; + class bitmapTexturePrimitive3D; + class transparenceTexturePrimitive3D; + class transformPrimitive3D; +}} + +namespace drawinglayer { namespace texture { + class geoTexSvx; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor3d + { + class defaultProcessor3D : public baseProcessor3D + { + protected: + // render information + const attribute::sdrSceneAttribute& mrSdrSceneAttribute; // read-only scene infos (normal handling, etc...) + const attribute::sdrLightingAttribute& mrSdrLightingAttribute; // read-only light infos (lights, etc...) + basegfx::B3DHomMatrix maDeviceToView; // scale and translate to map to target view size + basegfx::B3DHomMatrix maWorldToEye; // world to eye coordinates + basegfx::B3DHomMatrix maWorldToView; // mul maWorldToEye with maProjection and maDeviceToView + basegfx::B3DHomMatrix maInvEyeToView; // back from view to eye coordinates + basegfx::B3DHomMatrix maInvWorldToView; // back from view to world coordinates + basegfx::B2DRange maRasterRange; // the (0, 0, W, H) range from mpBZPixelRaster + + // the target + basegfx::BZPixelRaster* mpBZPixelRaster; + + // the modifiedColorPrimitive stack + basegfx::BColorModifierStack maBColorModifierStack; + + // the current active texture + texture::geoTexSvx* mpGeoTexSvx; + + // the current active transparence texture + texture::geoTexSvx* mpTransparenceGeoTexSvx; + + // bitfield + unsigned mbModulate : 1; + unsigned mbFilter : 1; + unsigned mbProcessTransparent : 1; + unsigned mbContainsTransparent : 1; + + ////////////////////////////////////////////////////////////////////////////// + // rendering support + void impRender_GRX3(const primitive3d::gradientTexturePrimitive3D& rPrimitive, bool bTransparence); + void impRender_HAX3(const primitive3d::hatchTexturePrimitive3D& rPrimitive); + void impRender_BMX3(const primitive3d::bitmapTexturePrimitive3D& rPrimitive); + void impRender_MCOL(const primitive3d::modifiedColorPrimitive3D& rModifiedCandidate); + void impRender_POH3(const primitive3d::polygonHairlinePrimitive3D& rPrimitive); + void impRender_POM3(const primitive3d::polyPolygonMaterialPrimitive3D& rPrimitive); + void impRender_TRN3(const primitive3d::transformPrimitive3D& rTransformCandidate); + + ////////////////////////////////////////////////////////////////////////////// + // lighting support + basegfx::BColor impSolveColorModel( + basegfx::B3DVector aNormal, + const attribute::materialAttribute3D& rMaterial); + + public: + defaultProcessor3D( + const geometry::viewInformation& rViewInformation, + const geometry::transformation3D& rTransformation3D, + const attribute::sdrSceneAttribute& rSdrSceneAttribute, + const attribute::sdrLightingAttribute& rSdrLightingAttribute, + double fSizeX, + double fSizeY, + const basegfx::B2DRange& rVisiblePart); + virtual ~defaultProcessor3D(); + + // the central processing method + virtual void process(const primitive3d::primitiveVector3D& rSource); + + // helpers for drawing transparent parts in 2nd run + void processNonTransparent(const primitive3d::primitiveVector3D& rSource); + void processTransparent(const primitive3d::primitiveVector3D& rSource); + + // data read access + const attribute::sdrLightingAttribute& getSdrLightingAttribute() const { return mrSdrLightingAttribute; } + const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; } + const texture::geoTexSvx* getGeoTexSvx() const { return mpGeoTexSvx; } + const texture::geoTexSvx* getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; } + bool getModulate() const { return mbModulate; } + bool getFilter() const { return mbFilter; } + + // get the result as bitmapEx + BitmapEx getBitmapEx() const; + }; + } // end of namespace processor3d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx b/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx new file mode 100644 index 000000000000..f4126416d043 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: shadow3dextractor.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2006-08-09 16:45:32 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX +#define _DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX + +#ifndef _DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX +#include <drawinglayer/processor3d/baseprocessor3d.hxx> +#endif + +#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX +#include <basegfx/matrix/b2dhommatrix.hxx> +#endif + +#ifndef _BGFX_MATRIX_B3DHOMMATRIX_HXX +#include <basegfx/matrix/b3dhommatrix.hxx> +#endif + +#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX +#include <basegfx/polygon/b2dpolygon.hxx> +#endif + +#ifndef _BGFX_POLYGON_B3DPOLYGON_HXX +#include <basegfx/polygon/b3dpolygon.hxx> +#endif + +#ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX +#include <basegfx/polygon/b2dpolypolygon.hxx> +#endif + +#ifndef _BGFX_POLYGON_B3DPOLYPOLYGON_HXX +#include <basegfx/polygon/b3dpolypolygon.hxx> +#endif + +#ifndef _BGFX_COLOR_BCOLOR_HXX +#include <basegfx/color/bcolor.hxx> +#endif + +#ifndef _DRAWINGLAYER_PRIMITIVE_PRIMITIVE_HXX +#include <drawinglayer/primitive/primitive.hxx> +#endif + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace drawinglayer { namespace geometry { + class viewInformation; +}} + +namespace drawinglayer { namespace attribute { + class sdrLightingAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor3d + { + class shadow3DExtractingProcessor : public baseProcessor3D + { + protected: + // result holding vector (2D) and target vector for stacking (inited to &maPrimitiveVector) + primitive::primitiveVector maPrimitiveVector; + primitive::primitiveVector* mpTargetVector; + + // prepared data (transformations) for 2D/3D shadow calculations + basegfx::B3DHomMatrix maWorldToEye; + basegfx::B3DHomMatrix maEyeToView; + basegfx::B3DHomMatrix maWorldToView; + basegfx::B3DVector maLightNormal; + basegfx::B3DVector maShadowPlaneNormal; + basegfx::B3DPoint maPlanePoint; + double mfLightPlaneScalar; + + // the shadow color used for sub-primitives. Can stay at black since + // the encapsulating 2d shadow primitive will contain the color + basegfx::BColor maPrimitiveColor; + + // bitfield + // flag if shadow plane projection preparation leaded to valid results + unsigned mbShadowProjectionIsValid : 1; + + // flag if conversion is switched on + unsigned mbConvert : 1; + + // flag if conversion shall use projection + unsigned mbUseProjection : 1; + + // protected helpers + basegfx::B2DPolygon impDoShadowProjection(const basegfx::B3DPolygon& rSource); + basegfx::B2DPolyPolygon impDoShadowProjection(const basegfx::B3DPolyPolygon& rSource); + + public: + shadow3DExtractingProcessor( + const geometry::viewInformation& rViewInformation, + const geometry::transformation3D& rTransformation3D, + const attribute::sdrLightingAttribute& rSdrLightingAttribute, + const primitive3d::primitiveVector3D& rPrimitiveVector, + double fShadowSlant); + virtual ~shadow3DExtractingProcessor(); + + // the central processing method + virtual void process(const primitive3d::primitiveVector3D& rSource); + + // data access + const primitive::primitiveVector& getPrimitives() const { return maPrimitiveVector; } + }; + } // end of namespace processor3d +} // end of namespace drawinglayer + +#endif //_DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/texture/texture.hxx b/drawinglayer/inc/drawinglayer/texture/texture.hxx new file mode 100644 index 000000000000..946297f92fad --- /dev/null +++ b/drawinglayer/inc/drawinglayer/texture/texture.hxx @@ -0,0 +1,288 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: texture.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2006-08-09 16:46:03 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _DRAWINGLAYER_TEXTURE_TEXTURE_HXX +#define _DRAWINGLAYER_TEXTURE_TEXTURE_HXX + +#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX +#include <basegfx/matrix/b2dhommatrix.hxx> +#endif + +#ifndef _BGFX_RANGE_B2DRANGE_HXX +#include <basegfx/range/b2drange.hxx> +#endif + +#ifndef _BGFX_COLOR_BCOLOR_HXX +#include <basegfx/color/bcolor.hxx> +#endif + +#include <vector> + +////////////////////////////////////////////////////////////////////////////// +namespace drawinglayer +{ + namespace texture + { + class geoTexSvx + { + public: + geoTexSvx(); + virtual ~geoTexSvx(); + + // compare operator + virtual bool operator==(const geoTexSvx& rGeoTexSvx) const; + bool operator!=(const geoTexSvx& rGeoTexSvx) const { return !operator==(rGeoTexSvx); } + + // virtual base methods + virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices); + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; + virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const; + }; + } // end of namespace texture +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace texture + { + class geoTexSvxGradient : public geoTexSvx + { + protected: + basegfx::B2DHomMatrix maTextureTransform; + basegfx::B2DHomMatrix maBackTextureTransform; + basegfx::B2DRange maTargetRange; + basegfx::BColor maStart; + basegfx::BColor maEnd; + sal_uInt32 mnSteps; + double mfAspect; + double mfBorder; + + // helpers + void impAppendMatrix(::std::vector< basegfx::B2DHomMatrix >& rMatrices, const basegfx::B2DRange& rRange); + void impAppendColorsRadial(::std::vector< basegfx::BColor >& rColors); + + public: + geoTexSvxGradient(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder); + virtual ~geoTexSvxGradient(); + + // compare operator + virtual bool operator==(const geoTexSvx& rGeoTexSvx) const; + + // virtual base methods + virtual void appendColors(::std::vector< basegfx::BColor >& rColors) = 0; + + // data access + const basegfx::BColor& getStart() const { return maStart; } + const basegfx::BColor& getEnd() const { return maEnd; } + }; + } // end of namespace texture +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace texture + { + class geoTexSvxGradientLinear : public geoTexSvxGradient + { + public: + geoTexSvxGradientLinear(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fAngle); + virtual ~geoTexSvxGradientLinear(); + + virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices); + virtual void appendColors(::std::vector< basegfx::BColor >& rColors); + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; + }; + } // end of namespace texture +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace texture + { + class geoTexSvxGradientAxial : public geoTexSvxGradient + { + protected: + double mfInternalSteps; + + public: + geoTexSvxGradientAxial(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fAngle); + virtual ~geoTexSvxGradientAxial(); + + virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices); + virtual void appendColors(::std::vector< basegfx::BColor >& rColors); + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; + }; + } // end of namespace texture +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace texture + { + class geoTexSvxGradientRadial : public geoTexSvxGradient + { + public: + geoTexSvxGradientRadial(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY); + virtual ~geoTexSvxGradientRadial(); + + virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices); + virtual void appendColors(::std::vector< basegfx::BColor >& rColors); + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; + }; + } // end of namespace texture +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace texture + { + class geoTexSvxGradientElliptical : public geoTexSvxGradient + { + public: + geoTexSvxGradientElliptical(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle); + virtual ~geoTexSvxGradientElliptical(); + + virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices); + virtual void appendColors(::std::vector< basegfx::BColor >& rColors); + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; + }; + } // end of namespace texture +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace texture + { + class geoTexSvxGradientSquare : public geoTexSvxGradient + { + public: + geoTexSvxGradientSquare(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle); + virtual ~geoTexSvxGradientSquare(); + + virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices); + virtual void appendColors(::std::vector< basegfx::BColor >& rColors); + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; + }; + } // end of namespace texture +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace texture + { + class geoTexSvxGradientRect : public geoTexSvxGradient + { + public: + geoTexSvxGradientRect(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle); + virtual ~geoTexSvxGradientRect(); + + virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices); + virtual void appendColors(::std::vector< basegfx::BColor >& rColors); + virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; + }; + } // end of namespace texture +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace texture + { + class geoTexSvxHatch : public geoTexSvx + { + protected: + basegfx::B2DHomMatrix maTextureTransform; + basegfx::B2DHomMatrix maBackTextureTransform; + double mfDistance; + double mfAngle; + sal_uInt32 mnSteps; + + public: + geoTexSvxHatch(const basegfx::B2DRange& rTargetRange, double fDistance, double fAngle); + virtual ~geoTexSvxHatch(); + + // compare operator + virtual bool operator==(const geoTexSvx& rGeoTexSvx) const; + + virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices); + double getDistanceToHatch(const basegfx::B2DPoint& rUV) const; + }; + } // end of namespace texture +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace texture + { + class geoTexSvxTiled : public geoTexSvx + { + protected: + basegfx::B2DPoint maTopLeft; + basegfx::B2DVector maSize; + + public: + geoTexSvxTiled(const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize); + virtual ~geoTexSvxTiled(); + + // compare operator + virtual bool operator==(const geoTexSvx& rGeoTexSvx) const; + + virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices); + }; + } // end of namespace texture +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //_DRAWINGLAYER_TEXTURE_TEXTURE_HXX + +// eof diff --git a/drawinglayer/source/animation/animationtiming.cxx b/drawinglayer/source/animation/animationtiming.cxx index d3a4654a6e57..5ffe14f6d4f4 100644 --- a/drawinglayer/source/animation/animationtiming.cxx +++ b/drawinglayer/source/animation/animationtiming.cxx @@ -4,9 +4,9 @@ * * $RCSfile: animationtiming.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: aw $ $Date: 2006-05-12 11:50:12 $ + * last change: $Author: aw $ $Date: 2006-08-09 16:47:02 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,6 +37,10 @@ #include <drawinglayer/animation/animationtiming.hxx> #endif +#ifndef _BGFX_NUMERIC_FTOOLS_HXX +#include <basegfx/numeric/ftools.hxx> +#endif + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -75,8 +79,8 @@ namespace drawinglayer const animationEntryFixed* pCompare = dynamic_cast< const animationEntryFixed* >(&rCandidate); return (pCompare - && mfDuration == pCompare->mfDuration - && mfState == pCompare->mfState); + && basegfx::fTools::equal(mfDuration, pCompare->mfDuration) + && basegfx::fTools::equal(mfState, pCompare->mfState)); } double animationEntryFixed::getDuration() const @@ -91,12 +95,14 @@ namespace drawinglayer double animationEntryFixed::getNextEventTime(double fTime) const { - if(fTime < mfDuration) + if(basegfx::fTools::less(fTime, mfDuration)) { - fTime = mfDuration; + return mfDuration; + } + else + { + return 0.0; } - - return fTime; } ////////////////////////////////////////////////////////////////////////////// @@ -123,9 +129,9 @@ namespace drawinglayer const animationEntryLinear* pCompare = dynamic_cast< const animationEntryLinear* >(&rCandidate); return (pCompare - && mfDuration == pCompare->mfDuration - && mfStart == pCompare->mfStart - && mfStop == pCompare->mfStop); + && basegfx::fTools::equal(mfDuration, pCompare->mfDuration) + && basegfx::fTools::equal(mfStart, pCompare->mfStart) + && basegfx::fTools::equal(mfStop, pCompare->mfStop)); } double animationEntryLinear::getDuration() const @@ -135,10 +141,18 @@ namespace drawinglayer double animationEntryLinear::getStateAtTime(double fTime) const { - if(0.0 != mfDuration) + if(basegfx::fTools::more(mfDuration, 0.0)) { const double fFactor(fTime / mfDuration); - return mfStart + ((mfStop - mfStart) * fFactor); + + if(fFactor > 1.0) + { + return mfStop; + } + else + { + return mfStart + ((mfStop - mfStart) * fFactor); + } } else { @@ -148,20 +162,24 @@ namespace drawinglayer double animationEntryLinear::getNextEventTime(double fTime) const { - if(fTime < mfDuration) + if(basegfx::fTools::less(fTime, mfDuration)) { // use the simple solution: just add the frequency. More correct (but also more // complicated) would be to calculate the slice of time we are in and when this // slice will end. For the animations, this makes no quality difference. fTime += mfFrequency; - if(fTime > mfDuration) + if(basegfx::fTools::more(fTime, mfDuration)) { fTime = mfDuration; } - } - return fTime; + return fTime; + } + else + { + return 0.0; + } } ////////////////////////////////////////////////////////////////////////////// @@ -170,7 +188,7 @@ namespace drawinglayer { sal_uInt32 nIndex(0L); - while(nIndex < maEntries.size() && rfAddedTime + maEntries[nIndex]->getDuration() <= fTime) + while(nIndex < maEntries.size() && basegfx::fTools::lessOrEqual(rfAddedTime + maEntries[nIndex]->getDuration(), fTime)) { rfAddedTime += maEntries[nIndex++]->getDuration(); } @@ -183,15 +201,6 @@ namespace drawinglayer { } - animationEntryList::animationEntryList(const animationEntryList& rCandidate) - : mfDuration(0.0) - { - for(sal_uInt32 a(0L); a < rCandidate.maEntries.size(); a++) - { - append(*rCandidate.maEntries[a]); - } - } - animationEntryList::~animationEntryList() { for(sal_uInt32 a(0L); a < maEntries.size(); a++) @@ -236,7 +245,7 @@ namespace drawinglayer { const double fDuration(rCandidate.getDuration()); - if(0.0 != fDuration) + if(!basegfx::fTools::equalZero(fDuration)) { maEntries.push_back(rCandidate.clone()); mfDuration += fDuration; @@ -250,7 +259,7 @@ namespace drawinglayer double animationEntryList::getStateAtTime(double fTime) const { - if(0.0 != mfDuration) + if(!basegfx::fTools::equalZero(mfDuration)) { double fAddedTime(0.0); const sal_uInt32 nIndex(impGetIndexAtTime(fTime, fAddedTime)); @@ -266,18 +275,20 @@ namespace drawinglayer double animationEntryList::getNextEventTime(double fTime) const { - if(0.0 != mfDuration) + double fNewTime(0.0); + + if(!basegfx::fTools::equalZero(mfDuration)) { double fAddedTime(0.0); const sal_uInt32 nIndex(impGetIndexAtTime(fTime, fAddedTime)); if(nIndex < maEntries.size()) { - return maEntries[nIndex]->getNextEventTime(fTime - fAddedTime); + fNewTime = maEntries[nIndex]->getNextEventTime(fTime - fAddedTime) + fAddedTime; } } - return fTime; + return fNewTime; } ////////////////////////////////////////////////////////////////////////////// @@ -309,8 +320,8 @@ namespace drawinglayer const animationEntryLoop* pCompare = dynamic_cast< const animationEntryLoop* >(&rCandidate); return (pCompare - && animationEntryList::operator==(rCandidate) - && mnRepeat == pCompare->mnRepeat); + && mnRepeat == pCompare->mnRepeat + && animationEntryList::operator==(rCandidate)); } double animationEntryLoop::getDuration() const @@ -320,7 +331,7 @@ namespace drawinglayer double animationEntryLoop::getStateAtTime(double fTime) const { - if(mnRepeat && 0.0 != mfDuration) + if(mnRepeat && !basegfx::fTools::equalZero(mfDuration)) { const sal_uInt32 nCurrentLoop((sal_uInt32)(fTime / mfDuration)); @@ -341,7 +352,9 @@ namespace drawinglayer double animationEntryLoop::getNextEventTime(double fTime) const { - if(mnRepeat && 0.0 != mfDuration) + double fNewTime(0.0); + + if(mnRepeat && !basegfx::fTools::equalZero(mfDuration)) { const sal_uInt32 nCurrentLoop((sal_uInt32)(fTime / mfDuration)); @@ -351,14 +364,14 @@ namespace drawinglayer const double fRelativeTime(fTime - fTimeAtLoopStart); const double fNextEventAtLoop(animationEntryList::getNextEventTime(fRelativeTime)); - if(fNextEventAtLoop != fRelativeTime) + if(!basegfx::fTools::equalZero(fNextEventAtLoop)) { - return fNextEventAtLoop + fTimeAtLoopStart; + fNewTime = fNextEventAtLoop + fTimeAtLoopStart; } } } - return fTime; + return fNewTime; } } // end of namespace animation } // end of namespace drawinglayer diff --git a/drawinglayer/source/animation/makefile.mk b/drawinglayer/source/animation/makefile.mk index 2d1d39b4c387..ef533c8a8614 100644 --- a/drawinglayer/source/animation/makefile.mk +++ b/drawinglayer/source/animation/makefile.mk @@ -4,9 +4,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1 $ +# $Revision: 1.2 $ # -# last change: $Author: aw $ $Date: 2006-05-12 11:50:12 $ +# last change: $Author: aw $ $Date: 2006-08-09 16:47:02 $ # # The Contents of this file are made available subject to # the terms of GNU Lesser General Public License Version 2.1. @@ -45,7 +45,7 @@ TARGET=animation SLOFILES= \ $(SLO)$/animationtiming.obj - + # --- Targets ---------------------------------- .INCLUDE : target.mk diff --git a/drawinglayer/source/attribute/fillattribute.cxx b/drawinglayer/source/attribute/fillattribute.cxx new file mode 100644 index 000000000000..197f65071a0f --- /dev/null +++ b/drawinglayer/source/attribute/fillattribute.cxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: fillattribute.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2006-08-09 16:47:33 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX +#include <drawinglayer/attribute/fillattribute.hxx> +#endif + +#ifndef _BGFX_NUMERIC_FTOOLS_HXX +#include <basegfx/numeric/ftools.hxx> +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + fillGradientAttribute::fillGradientAttribute(GradientStyle eStyle, double fBorder, double fOffsetX, double fOffsetY, double fAngle, + const basegfx::BColor& rStartColor, const basegfx::BColor& rEndColor, sal_uInt16 nSteps) + : maStartColor(rStartColor), + maEndColor(rEndColor), + mfBorder(fBorder), + mfOffsetX(fOffsetX), + mfOffsetY(fOffsetY), + mfAngle(fAngle), + meStyle(eStyle), + mnSteps(nSteps) + { + } + + bool fillGradientAttribute::operator==(const fillGradientAttribute& rCandidate) const + { + return (meStyle == rCandidate.meStyle + && maStartColor == rCandidate.maStartColor + && maEndColor == rCandidate.maEndColor + && mfBorder == rCandidate.mfBorder + && mfOffsetX == rCandidate.mfOffsetX + && mfOffsetY == rCandidate.mfOffsetY + && mfAngle == rCandidate.mfAngle + && mnSteps == rCandidate.mnSteps); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + fillHatchAttribute::fillHatchAttribute(HatchStyle eStyle, double fDistance, double fAngle, const basegfx::BColor& rColor, bool bFillBackground) + : mfDistance(fDistance), + mfAngle(fAngle), + maColor(rColor), + meStyle(eStyle), + mbFillBackground(bFillBackground) + { + } + + bool fillHatchAttribute::operator==(const fillHatchAttribute& rCandidate) const + { + return (meStyle == rCandidate.meStyle + && mfDistance == rCandidate.mfDistance + && mfAngle == rCandidate.mfAngle + && maColor == rCandidate.maColor + && mbFillBackground == rCandidate.mbFillBackground); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/fillbitmapattribute.cxx b/drawinglayer/source/attribute/fillbitmapattribute.cxx new file mode 100644 index 000000000000..625657412eaa --- /dev/null +++ b/drawinglayer/source/attribute/fillbitmapattribute.cxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: fillbitmapattribute.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2006-08-09 16:47:33 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX +#include <drawinglayer/attribute/fillbitmapattribute.hxx> +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + fillBitmapAttribute::fillBitmapAttribute(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize, bool bTiling) + : maBitmap(rBitmap), + maTopLeft(rTopLeft), + maSize(rSize), + mbTiling(bTiling) + { + } + + bool fillBitmapAttribute::operator==(const fillBitmapAttribute& rCandidate) const + { + return (maBitmap == rCandidate.maBitmap + && maTopLeft == rCandidate.maTopLeft + && maSize == rCandidate.maSize + && mbTiling == rCandidate.mbTiling); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/makefile.mk b/drawinglayer/source/attribute/makefile.mk new file mode 100644 index 000000000000..7e4bccd0b959 --- /dev/null +++ b/drawinglayer/source/attribute/makefile.mk @@ -0,0 +1,57 @@ +#************************************************************************* +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1 $ +# +# last change: $Author: aw $ $Date: 2006-08-09 16:47:33 $ +# +# The Contents of this file are made available subject to +# the terms of GNU Lesser General Public License Version 2.1. +# +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2005 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +#************************************************************************* + +PRJ=..$/.. +PRJNAME=drawinglayer +TARGET=attribute + +# --- Settings ---------------------------------- + +.INCLUDE : settings.mk + +# --- Files ------------------------------------- + +SLOFILES= \ + $(SLO)$/fillattribute.obj \ + $(SLO)$/fillbitmapattribute.obj \ + $(SLO)$/materialattribute3d.obj \ + $(SLO)$/sdrallattribute3d.obj \ + $(SLO)$/sdrattribute.obj \ + $(SLO)$/sdrattribute3d.obj \ + $(SLO)$/sdrfillbitmapattribute.obj + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk diff --git a/drawinglayer/source/attribute/materialattribute3d.cxx b/drawinglayer/source/attribute/materialattribute3d.cxx new file mode 100644 index 000000000000..4a2c0b30cdbc --- /dev/null +++ b/drawinglayer/source/attribute/materialattribute3d.cxx @@ -0,0 +1,194 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: materialattribute3d.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2006-08-09 16:47:33 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _DRAWINGLAYER_ATTRIBUTE_MATERIALATTRIBUTE3D_HXX +#include <drawinglayer/attribute/materialattribute3d.hxx> +#endif + +#ifndef _BGFX_COLOR_BCOLOR_HXX +#include <basegfx/color/bcolor.hxx> +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace + { + class impMaterialAttribute3D + { + public: + // materialAttribute3D definitions + basegfx::BColor maColor; // object color + basegfx::BColor maSpecular; // material specular color + basegfx::BColor maEmission; // material emissive color + sal_uInt16 mnSpecularIntensity; // material specular intensity [0..128] + + // refcounter + sal_uInt32 mnRefCount; + + impMaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) + : maColor(rColor), + maSpecular(rSpecular), + maEmission(rEmission), + mnSpecularIntensity(nSpecularIntensity), + mnRefCount(0L) + { + } + + impMaterialAttribute3D(const basegfx::BColor& rColor) + : maColor(rColor), + maSpecular(1.0, 1.0, 1.0), + maEmission(), + mnSpecularIntensity(15), + mnRefCount(0L) + { + } + + impMaterialAttribute3D() + : mnSpecularIntensity(0), + mnRefCount(0L) + { + } + + bool operator==(const impMaterialAttribute3D& rCandidate) const + { + return (maColor == rCandidate.maColor + && maSpecular == rCandidate.maSpecular + && maEmission == rCandidate.maEmission + && mnSpecularIntensity == rCandidate.mnSpecularIntensity); + } + + const basegfx::BColor& getColor() const { return maColor; } + const basegfx::BColor& getSpecular() const { return maSpecular; } + const basegfx::BColor& getEmission() const { return maEmission; } + sal_uInt16 getSpecularIntensity() const { return mnSpecularIntensity; } + }; + } // end of anonymous namespace +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + materialAttribute3D::materialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) + : mpMaterialAttribute3D(new impMaterialAttribute3D(rColor, rSpecular, rEmission, nSpecularIntensity)) + { + } + + materialAttribute3D::materialAttribute3D(const basegfx::BColor& rColor) + : mpMaterialAttribute3D(new impMaterialAttribute3D(rColor)) + { + } + + materialAttribute3D::materialAttribute3D() + : mpMaterialAttribute3D(new impMaterialAttribute3D()) + { + } + + materialAttribute3D::materialAttribute3D(const materialAttribute3D& rCandidate) + : mpMaterialAttribute3D(rCandidate.mpMaterialAttribute3D) + { + mpMaterialAttribute3D->mnRefCount++; + } + + materialAttribute3D::~materialAttribute3D() + { + if(mpMaterialAttribute3D->mnRefCount) + { + mpMaterialAttribute3D->mnRefCount--; + } + else + { + delete mpMaterialAttribute3D; + } + } + + materialAttribute3D& materialAttribute3D::operator=(const materialAttribute3D& rCandidate) + { + if(rCandidate.mpMaterialAttribute3D != mpMaterialAttribute3D) + { + if(mpMaterialAttribute3D->mnRefCount) + { + mpMaterialAttribute3D->mnRefCount--; + } + else + { + delete mpMaterialAttribute3D; + } + + mpMaterialAttribute3D = rCandidate.mpMaterialAttribute3D; + mpMaterialAttribute3D->mnRefCount++; + } + + return *this; + } + + bool materialAttribute3D::operator==(const materialAttribute3D& rCandidate) const + { + if(rCandidate.mpMaterialAttribute3D == mpMaterialAttribute3D) + { + return true; + } + + return (*rCandidate.mpMaterialAttribute3D == *mpMaterialAttribute3D); + } + + const basegfx::BColor& materialAttribute3D::getColor() const + { + return mpMaterialAttribute3D->getColor(); + } + + const basegfx::BColor& materialAttribute3D::getSpecular() const + { + return mpMaterialAttribute3D->getSpecular(); + } + + const basegfx::BColor& materialAttribute3D::getEmission() const + { + return mpMaterialAttribute3D->getEmission(); + } + + sal_uInt16 materialAttribute3D::getSpecularIntensity() const + { + return mpMaterialAttribute3D->getSpecularIntensity(); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrallattribute3d.cxx b/drawinglayer/source/attribute/sdrallattribute3d.cxx new file mode 100644 index 000000000000..1ac32323c7ef --- /dev/null +++ b/drawinglayer/source/attribute/sdrallattribute3d.cxx @@ -0,0 +1,207 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrallattribute3d.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2006-08-09 16:47:33 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRALLATTRIBUTE3D_HXX +#include <drawinglayer/attribute/sdrallattribute3d.hxx> +#endif + +#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX +#include <drawinglayer/attribute/sdrattribute.hxx> +#endif + +#ifndef _DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX +#include <drawinglayer/attribute/fillattribute.hxx> +#endif + +////////////////////////////////////////////////////////////////////////////// +// pointer compare define +#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + sdrLineFillShadowAttribute::sdrLineFillShadowAttribute( + sdrLineAttribute* pLine, + sdrFillAttribute* pFill, + sdrLineStartEndAttribute* pLineStartEnd, + sdrShadowAttribute* pShadow, + fillGradientAttribute* pFillFloatTransGradient) + : mpShadow(pShadow), + mpLine(pLine), + mpLineStartEnd(pLineStartEnd), + mpFill(pFill), + mpFillFloatTransGradient(pFillFloatTransGradient) + { + } + + sdrLineFillShadowAttribute::sdrLineFillShadowAttribute(const sdrLineFillShadowAttribute& rCandidate) + : mpShadow(0L), + mpLine(0L), + mpLineStartEnd(0L), + mpFill(0L), + mpFillFloatTransGradient(0L) + { + if(!(*this == rCandidate)) + { + *this = rCandidate; + } + } + + sdrLineFillShadowAttribute::~sdrLineFillShadowAttribute() + { + delete mpShadow; + delete mpLine; + delete mpLineStartEnd; + delete mpFill; + delete mpFillFloatTransGradient; + } + + sdrLineFillShadowAttribute& sdrLineFillShadowAttribute::operator=(const sdrLineFillShadowAttribute& rCandidate) + { + // handle mpShadow + { + // delete local mpShadow if necessary + if(mpShadow && ((!rCandidate.mpShadow) || (!(*mpShadow == *rCandidate.mpShadow)))) + { + delete mpShadow; + mpShadow = 0L; + } + + // copy mpShadow if necessary + if(!mpShadow && rCandidate.mpShadow) + { + mpShadow = new sdrShadowAttribute(*rCandidate.mpShadow); + } + } + + // handle mpLine + { + // delete local mpLine if necessary + if(mpLine && ((!rCandidate.mpLine) || (!(*mpLine == *rCandidate.mpLine)))) + { + delete mpLine; + mpLine = 0L; + } + + // copy mpLine if necessary + if(!mpLine && rCandidate.mpLine) + { + mpLine = new sdrLineAttribute(*rCandidate.mpLine); + } + } + + // handle mpLineStartEnd + { + // delete local mpLineStartEnd if necessary + if(mpLineStartEnd && ((!rCandidate.mpLineStartEnd) || (!(*mpLineStartEnd == *rCandidate.mpLineStartEnd)))) + { + delete mpLineStartEnd; + mpLineStartEnd = 0L; + } + + // copy mpLineStartEnd if necessary + if(!mpLineStartEnd && rCandidate.mpLineStartEnd) + { + mpLineStartEnd = new sdrLineStartEndAttribute(*rCandidate.mpLineStartEnd); + } + } + + // handle mpFill + { + // delete local mpFill if necessary + if(mpFill && ((!rCandidate.mpFill) || (!(*mpFill == *rCandidate.mpFill)))) + { + delete mpFill; + mpFill = 0L; + } + + // copy mpFill if necessary + if(!mpFill && rCandidate.mpFill) + { + mpFill = new sdrFillAttribute(*rCandidate.mpFill); + } + } + + // handle mpFillFloatTransGradient + { + // delete local mpFillFloatTransGradient if necessary + if(mpFillFloatTransGradient && ((!rCandidate.mpFillFloatTransGradient) || (!(*mpFillFloatTransGradient == *rCandidate.mpFillFloatTransGradient)))) + { + delete mpFillFloatTransGradient; + mpFillFloatTransGradient = 0L; + } + + // copy mpFillFloatTransGradient if necessary + if(!mpFillFloatTransGradient && rCandidate.mpFillFloatTransGradient) + { + mpFillFloatTransGradient = new fillGradientAttribute(*rCandidate.mpFillFloatTransGradient); + } + } + + return *this; + } + + bool sdrLineFillShadowAttribute::operator==(const sdrLineFillShadowAttribute& rCandidate) const + { + // handle mpShadow + if(!pointerOrContentEqual(mpShadow, rCandidate.mpShadow)) + return false; + + // handle mpLine + if(!pointerOrContentEqual(mpLine, rCandidate.mpLine)) + return false; + + // handle mpLineStartEnd + if(!pointerOrContentEqual(mpLineStartEnd, rCandidate.mpLineStartEnd)) + return false; + + // handle mpFill + if(!pointerOrContentEqual(mpFill, rCandidate.mpFill)) + return false; + + // handle mpFillFloatTransGradient + if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient)) + return false; + + return true; + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrattribute.cxx b/drawinglayer/source/attribute/sdrattribute.cxx new file mode 100644 index 000000000000..6c4a8ff84501 --- /dev/null +++ b/drawinglayer/source/attribute/sdrattribute.cxx @@ -0,0 +1,285 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2006-08-09 16:47:34 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX +#include <drawinglayer/attribute/sdrattribute.hxx> +#endif + +#ifndef _DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX +#include <drawinglayer/attribute/fillattribute.hxx> +#endif + +#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX +#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx> +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + sdrLineAttribute::sdrLineAttribute( + basegfx::tools::B2DLineJoin eJoin, double fWidth, double fTransparence, const basegfx::BColor& rColor, + const ::std::vector< double >& rDotDashArray, double fFullDotDashLen) + : meJoin(eJoin), + mfWidth(fWidth), + mfTransparence(fTransparence), + maColor(rColor), + maDotDashArray(rDotDashArray), + mfFullDotDashLen(fFullDotDashLen) + { + } + + sdrLineAttribute::~sdrLineAttribute() + { + } + + bool sdrLineAttribute::operator==(const sdrLineAttribute& rCandidate) const + { + return (meJoin == rCandidate.meJoin + && mfWidth == rCandidate.mfWidth + && mfTransparence == rCandidate.mfTransparence + && maColor == rCandidate.maColor + && maDotDashArray == rCandidate.maDotDashArray); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + sdrLineStartEndAttribute::sdrLineStartEndAttribute( + const basegfx::B2DPolyPolygon& rStartPolyPolygon, const basegfx::B2DPolyPolygon& rEndPolyPolygon, + double fStartWidth, double fEndWidth, bool bStartActive, bool bEndActive, bool bStartCentered, bool bEndCentered) + : maStartPolyPolygon(rStartPolyPolygon), + maEndPolyPolygon(rEndPolyPolygon), + mfStartWidth(fStartWidth), + mfEndWidth(fEndWidth), + mbStartActive(bStartActive), + mbEndActive(bEndActive), + mbStartCentered(bStartCentered), + mbEndCentered(bEndCentered) + { + } + + sdrLineStartEndAttribute::~sdrLineStartEndAttribute() + { + } + + bool sdrLineStartEndAttribute::operator==(const sdrLineStartEndAttribute& rCandidate) const + { + return (mbStartActive == rCandidate.mbStartActive + && mbEndActive == rCandidate.mbEndActive + && mbStartCentered == rCandidate.mbStartCentered + && mbEndCentered == rCandidate.mbEndCentered + && mfStartWidth == rCandidate.mfStartWidth + && mfEndWidth == rCandidate.mfEndWidth + && maStartPolyPolygon == rCandidate.maStartPolyPolygon + && maEndPolyPolygon == rCandidate.maEndPolyPolygon); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + sdrShadowAttribute::sdrShadowAttribute(const basegfx::B2DVector& rOffset, double fTransparence, const basegfx::BColor& rColor) + : maOffset(rOffset), + mfTransparence(fTransparence), + maColor(rColor) + { + } + + sdrShadowAttribute::~sdrShadowAttribute() + { + } + + bool sdrShadowAttribute::operator==(const sdrShadowAttribute& rCandidate) const + { + return (mfTransparence == rCandidate.mfTransparence + && maColor == rCandidate.maColor + && maOffset == rCandidate.maOffset); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + sdrFillAttribute::sdrFillAttribute( + double fTransparence, const basegfx::BColor& rColor, fillGradientAttribute* pGradient, + fillHatchAttribute* pHatch, sdrFillBitmapAttribute* pBitmap) + : mfTransparence(fTransparence), + maColor(rColor), + mpGradient(pGradient), + mpHatch(pHatch), + mpBitmap(pBitmap) + { + } + + sdrFillAttribute::sdrFillAttribute(const sdrFillAttribute& rCandidate) + : mfTransparence(1.0), + mpGradient(0L), + mpHatch(0L), + mpBitmap(0L) + { + if(!(*this == rCandidate)) + { + *this = rCandidate; + } + } + + sdrFillAttribute::~sdrFillAttribute() + { + delete mpGradient; + delete mpHatch; + delete mpBitmap; + } + + sdrFillAttribute& sdrFillAttribute::operator=(const sdrFillAttribute& rCandidate) + { + // copy data + mfTransparence = rCandidate.mfTransparence; + maColor = rCandidate.maColor; + + // handle mpGradient + { + // delete local mpGradient if necessary + if(mpGradient && ((!rCandidate.mpGradient) || (!(*mpGradient == *rCandidate.mpGradient)))) + { + delete mpGradient; + mpGradient = 0L; + } + + // copy mpGradient if necessary + if(!mpGradient && rCandidate.mpGradient) + { + mpGradient = new fillGradientAttribute(*rCandidate.mpGradient); + } + } + + // handle mpHatch + { + // delete local mpHatch if necessary + if(mpHatch && ((!rCandidate.mpHatch) || (!(*mpHatch == *rCandidate.mpHatch)))) + { + delete mpHatch; + mpHatch = 0L; + } + + // copy mpHatch if necessary + if(!mpHatch && rCandidate.mpHatch) + { + mpHatch = new fillHatchAttribute(*rCandidate.mpHatch); + } + } + + // handle mpBitmap + { + // delete local mpBitmap if necessary + if(mpBitmap && ((!rCandidate.mpBitmap) || (!(*mpBitmap == *rCandidate.mpBitmap)))) + { + delete mpBitmap; + mpBitmap = 0L; + } + + // copy mpBitmap if necessary + if(!mpBitmap && rCandidate.mpBitmap) + { + mpBitmap = new sdrFillBitmapAttribute(*rCandidate.mpBitmap); + } + } + + return *this; + } + + bool sdrFillAttribute::operator==(const sdrFillAttribute& rCandidate) const + { + if(mfTransparence != rCandidate.mfTransparence) + return false; + + if(mpGradient) + { + if(!rCandidate.mpGradient) + return false; + + if(!(*mpGradient == *rCandidate.mpGradient)) + return false; + } + else if(mpHatch) + { + if(!rCandidate.mpHatch) + return false; + + if(!(*mpHatch == *rCandidate.mpHatch)) + return false; + + if(mpHatch->isFillBackground() && !(maColor == rCandidate.maColor)) + return false; + } + else if(mpBitmap) + { + if(!rCandidate.mpBitmap) + return false; + + if(!(*mpBitmap == *rCandidate.mpBitmap)) + return false; + } + else + { + if(!rCandidate.isColor()) + return false; + + if(!(maColor == rCandidate.maColor)) + return false; + } + + return true; + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrattribute3d.cxx b/drawinglayer/source/attribute/sdrattribute3d.cxx new file mode 100644 index 000000000000..ccbe27181256 --- /dev/null +++ b/drawinglayer/source/attribute/sdrattribute3d.cxx @@ -0,0 +1,231 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2006-08-09 16:47:34 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE3D_HXX +#include <drawinglayer/attribute/sdrattribute3d.hxx> +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + sdr3DObjectAttribute::sdr3DObjectAttribute( + ::com::sun::star::drawing::NormalsKind aNormalsKind, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY, + ::com::sun::star::drawing::TextureKind2 aTextureKind, + ::com::sun::star::drawing::TextureMode aTextureMode, + const materialAttribute3D& rMaterial, + bool bNormalsInvert, + bool bDoubleSided, + bool bShadow3D, + bool bTextureFilter) + : maNormalsKind(aNormalsKind), + maTextureProjectionX(aTextureProjectionX), + maTextureProjectionY(aTextureProjectionY), + maTextureKind(aTextureKind), + maTextureMode(aTextureMode), + maMaterial(rMaterial), + mbNormalsInvert(bNormalsInvert), + mbDoubleSided(bDoubleSided), + mbShadow3D(bShadow3D), + mbTextureFilter(bTextureFilter) + { + } + + sdr3DObjectAttribute::~sdr3DObjectAttribute() + { + } + + bool sdr3DObjectAttribute::operator==(const sdr3DObjectAttribute& rCandidate) const + { + return (maNormalsKind == rCandidate.maNormalsKind + && maTextureProjectionX == rCandidate.maTextureProjectionX + && maTextureProjectionY == rCandidate.maTextureProjectionY + && maTextureKind == rCandidate.maTextureKind + && maTextureMode == rCandidate.maTextureMode + && maMaterial == rCandidate.maMaterial + && mbNormalsInvert == rCandidate.mbNormalsInvert + && mbDoubleSided == rCandidate.mbDoubleSided + && mbShadow3D == rCandidate.mbShadow3D + && mbTextureFilter == rCandidate.mbTextureFilter); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + sdr3DLightAttribute::sdr3DLightAttribute(const basegfx::BColor& rColor, const basegfx::B3DVector& rDirection, bool bSpecular) + : maColor(rColor), + maDirection(rDirection), + mbSpecular(bSpecular) + { + } + + sdr3DLightAttribute::~sdr3DLightAttribute() + { + } + + bool sdr3DLightAttribute::operator==(const sdr3DLightAttribute& rCandidate) const + { + return (maColor == rCandidate.maColor + && maDirection == rCandidate.maDirection + && mbSpecular == rCandidate.mbSpecular); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + sdrLightingAttribute::sdrLightingAttribute( + const basegfx::BColor& rAmbientLight, + const ::std::vector< sdr3DLightAttribute >& rLightVector) + : maAmbientLight(rAmbientLight), + maLightVector(rLightVector) + { + } + + sdrLightingAttribute::~sdrLightingAttribute() + { + } + + bool sdrLightingAttribute::operator==(const sdrLightingAttribute& rCandidate) const + { + return (maAmbientLight == rCandidate.maAmbientLight + && maLightVector == rCandidate.maLightVector); + } + + // color model solver + basegfx::BColor sdrLightingAttribute::solveColorModel( + const basegfx::B3DVector& rNormalInEyeCoordinates, + const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, + const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) const + { + // initialize with emissive color + basegfx::BColor aRetval(rEmission); + + // take care of global ambient light + aRetval += getAmbientLight() * rColor; + + // prepare light access. Is there a light? + const sal_uInt32 nLightCount(maLightVector.size()); + + if(nLightCount && !rNormalInEyeCoordinates.equalZero()) + { + // prepare normal + basegfx::B3DVector aEyeNormal(rNormalInEyeCoordinates); + aEyeNormal.normalize(); + + for(sal_uInt32 a(0L); a < nLightCount; a++) + { + const sdr3DLightAttribute& rLight(maLightVector[a]); + const double fCosFac(rLight.getDirection().scalar(aEyeNormal)); + + if(basegfx::fTools::more(fCosFac, 0.0)) + { + aRetval += ((rLight.getColor() * rColor) * fCosFac); + + if(rLight.getSpecular()) + { + // expand by (0.0, 0.0, 1.0) in Z + basegfx::B3DVector aSpecularNormal(rLight.getDirection().getX(), rLight.getDirection().getY(), rLight.getDirection().getZ() + 1.0); + aSpecularNormal.normalize(); + double fCosFac2(aSpecularNormal.scalar(aEyeNormal)); + + if(basegfx::fTools::more(fCosFac2, 0.0)) + { + fCosFac2 = pow(fCosFac2, (double)nSpecularIntensity); + aRetval += (rSpecular * fCosFac2); + } + } + } + } + } + + // clamp to color space before usage + aRetval.clamp(); + + return aRetval; + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + sdrSceneAttribute::sdrSceneAttribute( + double fDistance, + double fShadowSlant, + ::com::sun::star::drawing::ProjectionMode aProjectionMode, + ::com::sun::star::drawing::ShadeMode aShadeMode, + bool bTwoSidedLighting) + : mfDistance(fDistance), + mfShadowSlant(fShadowSlant), + maProjectionMode(aProjectionMode), + maShadeMode(aShadeMode), + mbTwoSidedLighting(bTwoSidedLighting) + { + } + + sdrSceneAttribute::~sdrSceneAttribute() + { + } + + bool sdrSceneAttribute::operator==(const sdrSceneAttribute& rCandidate) const + { + return (mfDistance == rCandidate.mfDistance + && mfShadowSlant == rCandidate.mfShadowSlant + && maProjectionMode == rCandidate.maProjectionMode + && maShadeMode == rCandidate.maShadeMode + && mbTwoSidedLighting == rCandidate.mbTwoSidedLighting); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx new file mode 100644 index 000000000000..4f7e8b5947a2 --- /dev/null +++ b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx @@ -0,0 +1,245 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrfillbitmapattribute.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2006-08-09 16:47:34 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX +#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx> +#endif + +#ifndef _DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX +#include <drawinglayer/attribute/fillbitmapattribute.hxx> +#endif + +#ifndef _BGFX_NUMERIC_FTOOLS_HXX +#include <basegfx/numeric/ftools.hxx> +#endif + +#ifndef _BGFX_RANGE_B2DRANGE_HXX +#include <basegfx/range/b2drange.hxx> +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + sdrFillBitmapAttribute::sdrFillBitmapAttribute( + const Bitmap& rBitmap, const basegfx::B2DVector& rSize, const basegfx::B2DVector& rOffset, + const basegfx::B2DVector& rOffsetPosition, const basegfx::B2DVector& rRectPoint, + bool bTiling, bool bStretch, bool bLogSize) + : maBitmap(rBitmap), + maSize(rSize), + maOffset(rOffset), + maOffsetPosition(rOffsetPosition), + maRectPoint(rRectPoint), + mbTiling(bTiling), + mbStretch(bStretch), + mbLogSize(bLogSize) + { + } + + bool sdrFillBitmapAttribute::operator==(const sdrFillBitmapAttribute& rCandidate) const + { + return (maBitmap == rCandidate.maBitmap + && maSize == rCandidate.maSize + && maOffset == rCandidate.maOffset + && maOffsetPosition == rCandidate.maOffsetPosition + && maRectPoint == rCandidate.maRectPoint + && mbTiling == rCandidate.mbTiling + && mbStretch == rCandidate.mbStretch + && mbLogSize == rCandidate.mbLogSize); + } + + fillBitmapAttribute sdrFillBitmapAttribute::getFillBitmapAttribute(const basegfx::B2DRange& rRange) const + { + // get logical size of bitmap (before expanding eventually) + Bitmap aBitmap(maBitmap); + const basegfx::B2DVector aLogicalSize(aBitmap.GetPrefSize().getWidth(), aBitmap.GetPrefSize().getHeight()); + + // get hor/ver shiftings and apply them eventually to the bitmap, but only + // when tiling is on + bool bExpandWidth(false); + bool bExpandHeight(false); + + if(mbTiling) + { + if(0.0 != maOffset.getX() || 0.0 != maOffset.getY()) + { + const sal_uInt32 nWidth(aBitmap.GetSizePixel().getWidth()); + const sal_uInt32 nHeight(aBitmap.GetSizePixel().getHeight()); + + if(0.0 != maOffset.getX()) + { + bExpandHeight = true; + const sal_uInt32 nOffset(basegfx::fround(((double)nWidth * maOffset.getX()) / 100.0)); + aBitmap.Expand(0L, nHeight); + + const Size aSizeA(nOffset, nHeight); + const Rectangle aDstA(Point(0L, nHeight), aSizeA); + const Rectangle aSrcA(Point(nWidth - nOffset, 0L), aSizeA); + aBitmap.CopyPixel(aDstA, aSrcA); + + const Size aSizeB(nWidth - nOffset, nHeight); + const Rectangle aDstB(Point(nOffset, nHeight), aSizeB); + const Rectangle aSrcB(Point(0L, 0L), aSizeB); + aBitmap.CopyPixel(aDstB, aSrcB); + } + else + { + bExpandWidth = true; + const sal_uInt32 nOffset(basegfx::fround(((double)nHeight * maOffset.getY()) / 100.0)); + aBitmap.Expand(nWidth, 0L); + + const Size aSize(nWidth, nHeight); + const Rectangle aDst(Point(nWidth, 0L), aSize); + const Rectangle aSrc(Point(0L, 0L), aSize); + aBitmap.CopyPixel(aDst, aSrc); + + const Size aSizeA(nWidth, nOffset); + const Rectangle aDstA(Point(0L, 0L), aSizeA); + const Rectangle aSrcA(Point(nWidth, nHeight - nOffset), aSizeA); + aBitmap.CopyPixel(aDstA, aSrcA); + + const Size aSizeB(nWidth, nHeight - nOffset); + const Rectangle aDstB(Point(0L, nOffset), aSizeB); + const Rectangle aSrcB(Point(nWidth, 0L), aSizeB); + aBitmap.CopyPixel(aDstB, aSrcB); + } + } + } + + // init values with defaults + basegfx::B2DPoint aBitmapSize(1.0, 1.0); + basegfx::B2DVector aBitmapTopLeft(0.0, 0.0); + + // are canges needed? + if(mbTiling || !mbStretch) + { + // init values with range sizes + const double fRangeWidth(0.0 != rRange.getWidth() ? rRange.getWidth() : 1.0); + const double fRangeHeight(0.0 != rRange.getHeight() ? rRange.getHeight() : 1.0); + aBitmapSize = basegfx::B2DPoint(fRangeWidth, fRangeHeight); + + // size changes + if(0.0 != maSize.getX()) + { + if(maSize.getX() < 0.0) + { + aBitmapSize.setX(aBitmapSize.getX() * (maSize.getX() * -0.01)); + } + else + { + aBitmapSize.setX(maSize.getX()); + } + } + else + { + aBitmapSize.setX(aLogicalSize.getX()); + } + + if(0.0 != maSize.getY()) + { + if(maSize.getY() < 0.0) + { + aBitmapSize.setY(aBitmapSize.getY() * (maSize.getY() * -0.01)); + } + else + { + aBitmapSize.setY(maSize.getY()); + } + } + else + { + aBitmapSize.setY(aLogicalSize.getY()); + } + + // get values, force to centered if necessary + const basegfx::B2DVector aRectPoint(mbTiling ? maRectPoint : basegfx::B2DVector(0.0, 0.0)); + + // position changes X + if(0.0 == aRectPoint.getX()) + { + aBitmapTopLeft.setX((fRangeWidth - aBitmapSize.getX()) * 0.5); + } + else if(1.0 == aRectPoint.getX()) + { + aBitmapTopLeft.setX(fRangeWidth - aBitmapSize.getX()); + } + + if(mbTiling && 0.0 != maOffsetPosition.getX()) + { + aBitmapTopLeft.setX(aBitmapTopLeft.getX() + (aBitmapSize.getX() * (maOffsetPosition.getX() * 0.01))); + } + + // position changes Y + if(0.0 == aRectPoint.getY()) + { + aBitmapTopLeft.setY((fRangeHeight - aBitmapSize.getY()) * 0.5); + } + else if(1.0 == aRectPoint.getY()) + { + aBitmapTopLeft.setY(fRangeHeight - aBitmapSize.getY()); + } + + if(mbTiling && 0.0 != maOffsetPosition.getY()) + { + aBitmapTopLeft.setY(aBitmapTopLeft.getY() + (aBitmapSize.getY() * (maOffsetPosition.getY() * 0.01))); + } + + // apply expand + if(bExpandWidth) + { + aBitmapSize.setX(aBitmapSize.getX() * 2.0); + } + + if(bExpandHeight) + { + aBitmapSize.setY(aBitmapSize.getY() * 2.0); + } + + // apply bitmap size scaling to unit rectangle + aBitmapTopLeft.setX(aBitmapTopLeft.getX() / fRangeWidth); + aBitmapTopLeft.setY(aBitmapTopLeft.getY() / fRangeHeight); + aBitmapSize.setX(aBitmapSize.getX() / fRangeWidth); + aBitmapSize.setY(aBitmapSize.getY() / fRangeHeight); + } + + return fillBitmapAttribute(aBitmap, aBitmapTopLeft, aBitmapSize, mbTiling); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx index 14e1f53cc5bc..1ab1baa2827d 100644 --- a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: hatchtextureprimitive3d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-06-02 13:58:02 $ + * last change: $Author: aw $ $Date: 2006-08-09 16:51:14 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -73,14 +73,14 @@ namespace drawinglayer { - namespace primitive + namespace primitive3d { - void hatchTexturePrimitive3D::impCreateDecomposition(const primitiveVector& rSource, primitiveVector& rDest) + void hatchTexturePrimitive3D::impCreateDecomposition(const primitiveVector3D& rSource, primitiveVector3D& rDest) { for(sal_uInt32 a(0L); a < rSource.size(); a++) { // get reference - const referencedPrimitive& rCandidate = rSource[a]; + const referencedPrimitive3D& rCandidate = rSource[a]; // not all content is needed, remove transparencies and ModifiedColorPrimitives switch(rCandidate.getID()) @@ -89,28 +89,28 @@ namespace drawinglayer { // polyPolygonMaterialPrimitive3D, check texturing and hatching const polyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const polyPolygonMaterialPrimitive3D& >(rCandidate.getBasePrimitive()); - const ::basegfx::B3DPolyPolygon aFillPolyPolygon(rPrimitive.getB3DPolyPolygon()); + const basegfx::B3DPolyPolygon aFillPolyPolygon(rPrimitive.getB3DPolyPolygon()); if(aFillPolyPolygon.areTextureCoordinatesUsed()) { const sal_uInt32 nPolyCount(aFillPolyPolygon.count()); - ::basegfx::B2DPolyPolygon aTexPolyPolygon; - ::basegfx::B2DPoint a2N; - ::basegfx::B2DVector a2X, a2Y; - ::basegfx::B3DPoint a3N; - ::basegfx::B3DVector a3X, a3Y; + basegfx::B2DPolyPolygon aTexPolyPolygon; + basegfx::B2DPoint a2N; + basegfx::B2DVector a2X, a2Y; + basegfx::B3DPoint a3N; + basegfx::B3DVector a3X, a3Y; bool b2N(false), b2X(false), b2Y(false); sal_uInt32 a, b; for(a = 0L; a < nPolyCount; a++) { - const ::basegfx::B3DPolygon aPartPoly(aFillPolyPolygon.getB3DPolygon(a)); + const basegfx::B3DPolygon aPartPoly(aFillPolyPolygon.getB3DPolygon(a)); const sal_uInt32 nPointCount(aPartPoly.count()); - ::basegfx::B2DPolygon aTexPolygon; + basegfx::B2DPolygon aTexPolygon; for(b = 0L; b < nPointCount; b++) { - const ::basegfx::B2DPoint a2Candidate(aPartPoly.getTextureCoordinate(b)); + const basegfx::B2DPoint a2Candidate(aPartPoly.getTextureCoordinate(b)); if(!b2N) { @@ -130,7 +130,7 @@ namespace drawinglayer const double fCross(a2X.cross(a2Y)); - if(!::basegfx::fTools::equalZero(fCross)) + if(!basegfx::fTools::equalZero(fCross)) { a3Y = aPartPoly.getB3DPoint(b) - a3N; b2Y = true; @@ -148,44 +148,44 @@ namespace drawinglayer { // found two linearly independent 2D vectors // get 2d range of texture coordinates - const ::basegfx::B2DRange aOutlineRange(::basegfx::tools::getRange(aTexPolyPolygon)); - const ::basegfx::BColor aHatchColor(maHatch.getColor()); + const basegfx::B2DRange aOutlineRange(basegfx::tools::getRange(aTexPolyPolygon)); + const basegfx::BColor aHatchColor(maHatch.getColor()); const double fAngle(-maHatch.getAngle()); - ::std::vector< ::basegfx::B2DHomMatrix > aMatrices; + ::std::vector< basegfx::B2DHomMatrix > aMatrices; // get hatch transformations switch(maHatch.getStyle()) { - case HATCHSTYLE_TRIPLE: + case attribute::HATCHSTYLE_TRIPLE: { // rotated 45 degrees - geoTexSvxHatch aHatch(aOutlineRange, maHatch.getDistance(), fAngle + F_PI4); + texture::geoTexSvxHatch aHatch(aOutlineRange, maHatch.getDistance(), fAngle + F_PI4); aHatch.appendTransformations(aMatrices); } - case HATCHSTYLE_DOUBLE: + case attribute::HATCHSTYLE_DOUBLE: { // rotated 90 degrees - geoTexSvxHatch aHatch(aOutlineRange, maHatch.getDistance(), fAngle + F_PI2); + texture::geoTexSvxHatch aHatch(aOutlineRange, maHatch.getDistance(), fAngle + F_PI2); aHatch.appendTransformations(aMatrices); } - case HATCHSTYLE_SINGLE: + case attribute::HATCHSTYLE_SINGLE: { // angle as given - geoTexSvxHatch aHatch(aOutlineRange, maHatch.getDistance(), fAngle); + texture::geoTexSvxHatch aHatch(aOutlineRange, maHatch.getDistance(), fAngle); aHatch.appendTransformations(aMatrices); } } // create geometry from unit line - ::basegfx::B2DPolyPolygon a2DHatchLines; - ::basegfx::B2DPolygon a2DUnitLine; - a2DUnitLine.append(::basegfx::B2DPoint(0.0, 0.0)); - a2DUnitLine.append(::basegfx::B2DPoint(1.0, 0.0)); + basegfx::B2DPolyPolygon a2DHatchLines; + basegfx::B2DPolygon a2DUnitLine; + a2DUnitLine.append(basegfx::B2DPoint(0.0, 0.0)); + a2DUnitLine.append(basegfx::B2DPoint(1.0, 0.0)); for(a = 0L; a < aMatrices.size(); a++) { - const ::basegfx::B2DHomMatrix& rMatrix = aMatrices[a]; - ::basegfx::B2DPolygon aNewLine(a2DUnitLine); + const basegfx::B2DHomMatrix& rMatrix = aMatrices[a]; + basegfx::B2DPolygon aNewLine(a2DUnitLine); aNewLine.transform(rMatrix); a2DHatchLines.append(aNewLine); } @@ -193,14 +193,14 @@ namespace drawinglayer if(a2DHatchLines.count()) { // clip against texture polygon - a2DHatchLines = ::basegfx::tools::clipPolyPolygonOnPolyPolygon(a2DHatchLines, aTexPolyPolygon, true, false); + a2DHatchLines = basegfx::tools::clipPolyPolygonOnPolyPolygon(a2DHatchLines, aTexPolyPolygon, true, false); } if(a2DHatchLines.count()) { // create 2d matrix with 2d vectors as column vectors and 2d point as offset, this represents // a coordinate system transformation from unit coordinates to the new coordinate system - ::basegfx::B2DHomMatrix a2D; + basegfx::B2DHomMatrix a2D; a2D.set(0, 0, a2X.getX()); a2D.set(1, 0, a2X.getY()); a2D.set(0, 1, a2Y.getX()); @@ -214,11 +214,11 @@ namespace drawinglayer a2DHatchLines.transform(a2D); // expand back-transformated geometry tpo 3D - ::basegfx::B3DPolyPolygon a3DHatchLines(::basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(a2DHatchLines, 0.0)); + basegfx::B3DPolyPolygon a3DHatchLines(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(a2DHatchLines, 0.0)); // create 3d matrix with 3d vectors as column vectors (0,0,1 as Z) and 3d point as offset, this represents // a coordinate system transformation from unit coordinates to the object's 3d coordinate system - ::basegfx::B3DHomMatrix a3D; + basegfx::B3DHomMatrix a3D; a3D.set(0, 0, a3X.getX()); a3D.set(1, 0, a3X.getY()); a3D.set(2, 0, a3X.getZ()); @@ -237,8 +237,8 @@ namespace drawinglayer for(a = 0L; a < nHatchLines; a++) { - basePrimitive* pNew = new polygonHairlinePrimitive3D(a3DHatchLines.getB3DPolygon(a), aHatchColor); - rDest.push_back(referencedPrimitive(*pNew)); + basePrimitive3D* pNew = new polygonHairlinePrimitive3D(a3DHatchLines.getB3DPolygon(a), aHatchColor); + rDest.push_back(referencedPrimitive3D(*pNew)); } } } @@ -263,21 +263,21 @@ namespace drawinglayer } } - void hatchTexturePrimitive3D::decompose(primitiveVector& rTarget, const ::drawinglayer::geometry::viewInformation& rViewInformation) + void hatchTexturePrimitive3D::decompose(primitiveVector3D& rTarget) { if(maPrimitiveVector.size()) { // create decomposition - primitiveVector aNewPrimitiveVector; + primitiveVector3D aNewPrimitiveVector; impCreateDecomposition(maPrimitiveVector, aNewPrimitiveVector); rTarget.insert(rTarget.end(), aNewPrimitiveVector.begin(), aNewPrimitiveVector.end()); } } hatchTexturePrimitive3D::hatchTexturePrimitive3D( - const fillHatchAttribute& rHatch, - const primitiveVector& rPrimitiveVector, - const ::basegfx::B2DVector& rTextureSize, + const attribute::fillHatchAttribute& rHatch, + const primitiveVector3D& rPrimitiveVector, + const basegfx::B2DVector& rTextureSize, bool bModulate, bool bFilter) : texturePrimitive3D(rPrimitiveVector, rTextureSize, bModulate, bFilter), @@ -289,7 +289,7 @@ namespace drawinglayer { } - bool hatchTexturePrimitive3D::operator==(const basePrimitive& rPrimitive) const + bool hatchTexturePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const { if(texturePrimitive3D::operator==(rPrimitive)) { @@ -304,7 +304,7 @@ namespace drawinglayer { return CreatePrimitiveID('H', 'A', 'X', '3'); } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive3d/makefile.mk b/drawinglayer/source/primitive3d/makefile.mk index 0be6d6307dcd..dcb84b36d464 100644 --- a/drawinglayer/source/primitive3d/makefile.mk +++ b/drawinglayer/source/primitive3d/makefile.mk @@ -4,9 +4,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: aw $ $Date: 2006-06-02 13:58:02 $ +# last change: $Author: aw $ $Date: 2006-08-09 16:51:14 $ # # The Contents of this file are made available subject to # the terms of GNU Lesser General Public License Version 2.1. @@ -44,24 +44,25 @@ TARGET=primitive3d # --- Files ------------------------------------- SLOFILES= \ - $(SLO)$/materialattribute3d.obj \ - $(SLO)$/sdrallattribute3d.obj \ - $(SLO)$/sdrattribute3d.obj \ - $(SLO)$/shadowprimitive3d.obj \ - $(SLO)$/textureprimitive3d.obj \ - $(SLO)$/hatchtextureprimitive3d.obj \ - $(SLO)$/polygontubeprimitive3d.obj \ - $(SLO)$/polygonprimitive3d.obj \ - $(SLO)$/polypolygonprimitive3d.obj \ - $(SLO)$/transformprimitive3d.obj \ - $(SLO)$/sdrdecompositiontools3d.obj \ - $(SLO)$/sdrextrudelathetools3d.obj \ - $(SLO)$/sdrprimitive3d.obj \ - $(SLO)$/sdrcubeprimitive3d.obj \ - $(SLO)$/sdrextrudeprimitive3d.obj \ - $(SLO)$/sdrsphereprimitive3d.obj \ - $(SLO)$/sdrlatheprimitive3d.obj \ - $(SLO)$/sdrpolygonprimitive3d.obj + $(SLO)$/primitive3d.obj \ + $(SLO)$/vectorprimitive3d.obj \ + $(SLO)$/shadowprimitive3d.obj \ + $(SLO)$/textureprimitive3d.obj \ + $(SLO)$/hatchtextureprimitive3d.obj \ + $(SLO)$/polygontubeprimitive3d.obj \ + $(SLO)$/polygonprimitive3d.obj \ + $(SLO)$/polypolygonprimitive3d.obj \ + $(SLO)$/transformprimitive3d.obj \ + $(SLO)$/sdrdecompositiontools3d.obj \ + $(SLO)$/sdrextrudelathetools3d.obj \ + $(SLO)$/sdrprimitive3d.obj \ + $(SLO)$/sdrlabelprimitive3d.obj \ + $(SLO)$/sdrcubeprimitive3d.obj \ + $(SLO)$/sdrextrudeprimitive3d.obj \ + $(SLO)$/sdrsphereprimitive3d.obj \ + $(SLO)$/sdrlatheprimitive3d.obj \ + $(SLO)$/sdrpolygonprimitive3d.obj \ + $(SLO)$/modifiedcolorprimitive3d.obj # --- Targets ---------------------------------- diff --git a/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx b/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx new file mode 100644 index 000000000000..0d5d911919d3 --- /dev/null +++ b/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: modifiedcolorprimitive3d.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX +#include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx> +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive3d + { + modifiedColorPrimitive3D::modifiedColorPrimitive3D( + const primitiveVector3D& rPrimitiveVector, + const basegfx::BColorModifier& rColorModifier) + : vectorPrimitive3D(rPrimitiveVector), + maColorModifier(rColorModifier) + { + } + + modifiedColorPrimitive3D::~modifiedColorPrimitive3D() + { + } + + bool modifiedColorPrimitive3D::operator==(const basePrimitive3D& rPrimitive) const + { + if(vectorPrimitive3D::operator==(rPrimitive)) + { + const modifiedColorPrimitive3D& rCompare = (modifiedColorPrimitive3D&)rPrimitive; + return (maColorModifier == rCompare.maColorModifier); + } + + return false; + } + + PrimitiveID modifiedColorPrimitive3D::getID() const + { + return CreatePrimitiveID('M', 'C', 'L', '3'); + } + } // end of namespace primitive3d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive3d/polygonprimitive3d.cxx b/drawinglayer/source/primitive3d/polygonprimitive3d.cxx index cf5db747ad27..435ccca60716 100644 --- a/drawinglayer/source/primitive3d/polygonprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polygonprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: polygonprimitive3d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-06-02 13:58:02 $ + * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -53,10 +53,11 @@ namespace drawinglayer { - namespace primitive + namespace primitive3d { - polygonHairlinePrimitive3D::polygonHairlinePrimitive3D(const ::basegfx::B3DPolygon& rPolygon, const ::basegfx::BColor& rBColor) - : maPolygon(rPolygon), + polygonHairlinePrimitive3D::polygonHairlinePrimitive3D(const basegfx::B3DPolygon& rPolygon, const basegfx::BColor& rBColor) + : basePrimitive3D(), + maPolygon(rPolygon), maBColor(rBColor) { } @@ -65,7 +66,7 @@ namespace drawinglayer { } - bool polygonHairlinePrimitive3D::operator==(const basePrimitive& rPrimitive) const + bool polygonHairlinePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const { if(getID() == rPrimitive.getID()) { @@ -83,39 +84,39 @@ namespace drawinglayer return CreatePrimitiveID('P', 'O', 'H', '3'); } - ::basegfx::B3DRange polygonHairlinePrimitive3D::get3DRange(const ::drawinglayer::geometry::viewInformation& rViewInformation) const + basegfx::B3DRange polygonHairlinePrimitive3D::get3DRange() const { - return ::basegfx::tools::getRange(maPolygon); + return basegfx::tools::getRange(maPolygon); } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { - namespace primitive + namespace primitive3d { - void polygonStrokePrimitive3D::decompose(primitiveVector& rTarget, const ::drawinglayer::geometry::viewInformation& rViewInformation) + void polygonStrokePrimitive3D::decompose(primitiveVector3D& rTarget) { if(maPolygon.count()) { - ::basegfx::B3DPolyPolygon aHairLinePolyPolygon(maPolygon); + basegfx::B3DPolyPolygon aHairLinePolyPolygon(maPolygon); if(0.0 != maStrokeAttribute.getFullDotDashLen()) { // apply LineStyle - aHairLinePolyPolygon = ::basegfx::tools::applyLineDashing(aHairLinePolyPolygon, maStrokeAttribute.getDotDashArray(), maStrokeAttribute.getFullDotDashLen()); + aHairLinePolyPolygon = basegfx::tools::applyLineDashing(aHairLinePolyPolygon, maStrokeAttribute.getDotDashArray(), maStrokeAttribute.getFullDotDashLen()); // merge LineStyle polygons to bigger parts - aHairLinePolyPolygon = ::basegfx::tools::mergeDashedLines(aHairLinePolyPolygon); + aHairLinePolyPolygon = basegfx::tools::mergeDashedLines(aHairLinePolyPolygon); } if(maStrokeAttribute.getWidth()) { // create fat line data const double fRadius(maStrokeAttribute.getWidth() / 2.0); - const ::basegfx::tools::B2DLineJoin aLineJoin(maStrokeAttribute.getLineJoin()); + const basegfx::tools::B2DLineJoin aLineJoin(maStrokeAttribute.getLineJoin()); for(sal_uInt32 a(0L); a < aHairLinePolyPolygon.count(); a++) { @@ -123,7 +124,7 @@ namespace drawinglayer polygonTubePrimitive3D* pNew = new polygonTubePrimitive3D(aHairLinePolyPolygon.getB3DPolygon(a), maStrokeAttribute.getColor(), fRadius, aLineJoin); - rTarget.push_back(referencedPrimitive(*pNew)); + rTarget.push_back(referencedPrimitive3D(*pNew)); } } else @@ -131,16 +132,19 @@ namespace drawinglayer // create hair line data for all sub polygons for(sal_uInt32 a(0L); a < aHairLinePolyPolygon.count(); a++) { - const ::basegfx::B3DPolygon aCandidate = aHairLinePolyPolygon.getB3DPolygon(a); - basePrimitive* pNew = new polygonHairlinePrimitive3D(aCandidate, maStrokeAttribute.getColor()); - rTarget.push_back(referencedPrimitive(*pNew)); + const basegfx::B3DPolygon aCandidate = aHairLinePolyPolygon.getB3DPolygon(a); + basePrimitive3D* pNew = new polygonHairlinePrimitive3D(aCandidate, maStrokeAttribute.getColor()); + rTarget.push_back(referencedPrimitive3D(*pNew)); } } } } - polygonStrokePrimitive3D::polygonStrokePrimitive3D(const ::basegfx::B3DPolygon& rPolygon, const strokeAttribute& rStrokeAttribute) - : maPolygon(rPolygon), + polygonStrokePrimitive3D::polygonStrokePrimitive3D( + const basegfx::B3DPolygon& rPolygon, + const attribute::strokeAttribute& rStrokeAttribute) + : basePrimitive3D(), + maPolygon(rPolygon), maStrokeAttribute(rStrokeAttribute) { } @@ -149,7 +153,7 @@ namespace drawinglayer { } - bool polygonStrokePrimitive3D::operator==(const basePrimitive& rPrimitive) const + bool polygonStrokePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const { if(getID() == rPrimitive.getID()) { @@ -166,7 +170,7 @@ namespace drawinglayer { return CreatePrimitiveID('P', 'L', 'S', '3'); } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx index ffb059cde583..6f470c5870b2 100644 --- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: polygontubeprimitive3d.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2006-06-02 13:58:02 $ + * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -45,8 +45,8 @@ #include <basegfx/matrix/b3dhommatrix.hxx> #endif -#ifndef _DRAWINGLAYER_PRIMITIVE3D_MATERIALATTRIBUTE3D_HXX -#include <drawinglayer/primitive3d/materialattribute3d.hxx> +#ifndef _DRAWINGLAYER_ATTRIBUTE_MATERIALATTRIBUTE3D_HXX +#include <drawinglayer/attribute/materialattribute3d.hxx> #endif #ifndef _DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE_HXX @@ -69,16 +69,18 @@ namespace drawinglayer { - namespace primitive + namespace primitive3d { namespace // anonymous namespace { - const primitiveVector& getLineTubeSegments(sal_uInt32 nSegments, const materialAttribute3D& rMaterial) + const primitiveVector3D& getLineTubeSegments( + sal_uInt32 nSegments, + const attribute::materialAttribute3D& rMaterial) { // static data for buffered tube primitives - static primitiveVector aLineTubeList; + static primitiveVector3D aLineTubeList; static sal_uInt32 nLineTubeSegments(0L); - static materialAttribute3D aLineMaterial; + static attribute::materialAttribute3D aLineMaterial; // may exclusively change static data, use mutex ::osl::Mutex m_mutex; @@ -92,36 +94,36 @@ namespace drawinglayer if(0L == aLineTubeList.size() && 0L != nLineTubeSegments) { - const ::basegfx::B3DPoint aLeft(0.0, 0.0, 0.0); - const ::basegfx::B3DPoint aRight(1.0, 0.0, 0.0); - ::basegfx::B3DPoint aLastLeft(0.0, 1.0, 0.0); - ::basegfx::B3DPoint aLastRight(1.0, 1.0, 0.0); - ::basegfx::B3DHomMatrix aRot; + const basegfx::B3DPoint aLeft(0.0, 0.0, 0.0); + const basegfx::B3DPoint aRight(1.0, 0.0, 0.0); + basegfx::B3DPoint aLastLeft(0.0, 1.0, 0.0); + basegfx::B3DPoint aLastRight(1.0, 1.0, 0.0); + basegfx::B3DHomMatrix aRot; aRot.rotate(F_2PI / (double)nLineTubeSegments, 0.0, 0.0); for(sal_uInt32 a(0L); a < nLineTubeSegments; a++) { - const ::basegfx::B3DPoint aNextLeft(aRot * aLastLeft); - const ::basegfx::B3DPoint aNextRight(aRot * aLastRight); - ::basegfx::B3DPolygon aNewPolygon; + const basegfx::B3DPoint aNextLeft(aRot * aLastLeft); + const basegfx::B3DPoint aNextRight(aRot * aLastRight); + basegfx::B3DPolygon aNewPolygon; aNewPolygon.append(aNextLeft); - aNewPolygon.setNormal(0L, ::basegfx::B3DVector(aNextLeft - aLeft)); + aNewPolygon.setNormal(0L, basegfx::B3DVector(aNextLeft - aLeft)); aNewPolygon.append(aLastLeft); - aNewPolygon.setNormal(1L, ::basegfx::B3DVector(aLastLeft - aLeft)); + aNewPolygon.setNormal(1L, basegfx::B3DVector(aLastLeft - aLeft)); aNewPolygon.append(aLastRight); - aNewPolygon.setNormal(2L, ::basegfx::B3DVector(aLastRight - aRight)); + aNewPolygon.setNormal(2L, basegfx::B3DVector(aLastRight - aRight)); aNewPolygon.append(aNextRight); - aNewPolygon.setNormal(3L, ::basegfx::B3DVector(aNextRight - aRight)); + aNewPolygon.setNormal(3L, basegfx::B3DVector(aNextRight - aRight)); aNewPolygon.setClosed(true); - const ::basegfx::B3DPolyPolygon aNewPolyPolygon(aNewPolygon); - basePrimitive* pNew = new polyPolygonMaterialPrimitive3D(aNewPolyPolygon, aLineMaterial, false); - aLineTubeList.push_back(referencedPrimitive(*pNew)); + const basegfx::B3DPolyPolygon aNewPolyPolygon(aNewPolygon); + basePrimitive3D* pNew = new polyPolygonMaterialPrimitive3D(aNewPolyPolygon, aLineMaterial, false); + aLineTubeList.push_back(referencedPrimitive3D(*pNew)); aLastLeft = aNextLeft; aLastRight = aNextRight; @@ -131,12 +133,14 @@ namespace drawinglayer return aLineTubeList; } - const primitiveVector& getLineCapSegments(sal_uInt32 nSegments, const materialAttribute3D& rMaterial) + const primitiveVector3D& getLineCapSegments( + sal_uInt32 nSegments, + const attribute::materialAttribute3D& rMaterial) { // static data for buffered tube primitives - static primitiveVector aLineCapList; + static primitiveVector3D aLineCapList; static sal_uInt32 nLineCapSegments(0L); - static materialAttribute3D aLineMaterial; + static attribute::materialAttribute3D aLineMaterial; // may exclusively change static data, use mutex ::osl::Mutex m_mutex; @@ -150,30 +154,30 @@ namespace drawinglayer if(0L == aLineCapList.size() && 0L != nLineCapSegments) { - const ::basegfx::B3DPoint aNull(0.0, 0.0, 0.0); - ::basegfx::B3DPoint aLast(0.0, 1.0, 0.0); - ::basegfx::B3DHomMatrix aRot; + const basegfx::B3DPoint aNull(0.0, 0.0, 0.0); + basegfx::B3DPoint aLast(0.0, 1.0, 0.0); + basegfx::B3DHomMatrix aRot; aRot.rotate(F_2PI / (double)nLineCapSegments, 0.0, 0.0); for(sal_uInt32 a(0L); a < nLineCapSegments; a++) { - const ::basegfx::B3DPoint aNext(aRot * aLast); - ::basegfx::B3DPolygon aNewPolygon; + const basegfx::B3DPoint aNext(aRot * aLast); + basegfx::B3DPolygon aNewPolygon; aNewPolygon.append(aLast); - aNewPolygon.setNormal(0L, ::basegfx::B3DVector(aLast - aNull)); + aNewPolygon.setNormal(0L, basegfx::B3DVector(aLast - aNull)); aNewPolygon.append(aNext); - aNewPolygon.setNormal(1L, ::basegfx::B3DVector(aNext - aNull)); + aNewPolygon.setNormal(1L, basegfx::B3DVector(aNext - aNull)); aNewPolygon.append(aNull); - aNewPolygon.setNormal(2L, ::basegfx::B3DVector(-1.0, 0.0, 0.0)); + aNewPolygon.setNormal(2L, basegfx::B3DVector(-1.0, 0.0, 0.0)); aNewPolygon.setClosed(true); - const ::basegfx::B3DPolyPolygon aNewPolyPolygon(aNewPolygon); - basePrimitive* pNew = new polyPolygonMaterialPrimitive3D(aNewPolyPolygon, aLineMaterial, false); - aLineCapList.push_back(referencedPrimitive(*pNew)); + const basegfx::B3DPolyPolygon aNewPolyPolygon(aNewPolygon); + basePrimitive3D* pNew = new polyPolygonMaterialPrimitive3D(aNewPolyPolygon, aLineMaterial, false); + aLineCapList.push_back(referencedPrimitive3D(*pNew)); aLast = aNext; } @@ -182,15 +186,21 @@ namespace drawinglayer return aLineCapList; } - void getLineJoinSegments(primitiveVector& rDest, sal_uInt32 nSegments, const materialAttribute3D& rMaterial, double fAngle, - double fDegreeStepWidth, double fMiterMinimumAngle, ::basegfx::tools::B2DLineJoin aLineJoin) + void getLineJoinSegments( + primitiveVector3D& rDest, + sal_uInt32 nSegments, + const attribute::materialAttribute3D& rMaterial, + double fAngle, + double fDegreeStepWidth, + double fMiterMinimumAngle, + basegfx::tools::B2DLineJoin aLineJoin) { // nSegments is for whole circle, adapt to half circle const sal_uInt32 nVerSeg(nSegments >> 1L); if(nVerSeg) { - if(::basegfx::tools::B2DLINEJOIN_ROUND == aLineJoin) + if(basegfx::tools::B2DLINEJOIN_ROUND == aLineJoin) { // calculate new horizontal segments const sal_uInt32 nHorSeg((sal_uInt32)((fAngle / F_2PI) * (double)nSegments)); @@ -198,48 +208,48 @@ namespace drawinglayer if(nHorSeg) { // create half-sphere - const ::basegfx::B3DPolyPolygon aSphere(::basegfx::tools::createUnitSphereFillPolyPolygon(nHorSeg, nVerSeg, true, F_PI2, -F_PI2, 0.0, fAngle)); + const basegfx::B3DPolyPolygon aSphere(basegfx::tools::createUnitSphereFillPolyPolygon(nHorSeg, nVerSeg, true, F_PI2, -F_PI2, 0.0, fAngle)); for(sal_uInt32 a(0L); a < aSphere.count(); a++) { - const ::basegfx::B3DPolygon aPartPolygon(aSphere.getB3DPolygon(a)); - const ::basegfx::B3DPolyPolygon aPartPolyPolygon(aPartPolygon); - basePrimitive* pNew = new polyPolygonMaterialPrimitive3D(aPartPolyPolygon, rMaterial, false); - rDest.push_back(referencedPrimitive(*pNew)); + const basegfx::B3DPolygon aPartPolygon(aSphere.getB3DPolygon(a)); + const basegfx::B3DPolyPolygon aPartPolyPolygon(aPartPolygon); + basePrimitive3D* pNew = new polyPolygonMaterialPrimitive3D(aPartPolyPolygon, rMaterial, false); + rDest.push_back(referencedPrimitive3D(*pNew)); } } else { // fallback to bevel when there is not at least one segment hor and ver - aLineJoin = ::basegfx::tools::B2DLINEJOIN_BEVEL; + aLineJoin = basegfx::tools::B2DLINEJOIN_BEVEL; } } - if(::basegfx::tools::B2DLINEJOIN_MIDDLE == aLineJoin - || ::basegfx::tools::B2DLINEJOIN_BEVEL == aLineJoin - || ::basegfx::tools::B2DLINEJOIN_MITER == aLineJoin) + if(basegfx::tools::B2DLINEJOIN_MIDDLE == aLineJoin + || basegfx::tools::B2DLINEJOIN_BEVEL == aLineJoin + || basegfx::tools::B2DLINEJOIN_MITER == aLineJoin) { - if(::basegfx::tools::B2DLINEJOIN_MITER == aLineJoin) + if(basegfx::tools::B2DLINEJOIN_MITER == aLineJoin) { const double fMiterAngle(fAngle/2.0); if(fMiterAngle < fMiterMinimumAngle) { // fallback to bevel when miter's angle is too small - aLineJoin = ::basegfx::tools::B2DLINEJOIN_BEVEL; + aLineJoin = basegfx::tools::B2DLINEJOIN_BEVEL; } } const double fInc(F_PI / (double)nVerSeg); const double fSin(sin(-fAngle)); const double fCos(cos(-fAngle)); - const bool bMiter(::basegfx::tools::B2DLINEJOIN_MITER == aLineJoin); + const bool bMiter(basegfx::tools::B2DLINEJOIN_MITER == aLineJoin); const double fMiterSin(bMiter ? sin(-(fAngle/2.0)) : 0.0); const double fMiterCos(bMiter ? cos(-(fAngle/2.0)) : 0.0); double fPos(-F_PI2); - ::basegfx::B3DPoint aPointOnXY, aPointRotY, aNextPointOnXY, aNextPointRotY; - ::basegfx::B3DPoint aCurrMiter, aNextMiter; - ::basegfx::B3DPolygon aNewPolygon, aMiterPolygon; + basegfx::B3DPoint aPointOnXY, aPointRotY, aNextPointOnXY, aNextPointRotY; + basegfx::B3DPoint aCurrMiter, aNextMiter; + basegfx::B3DPolygon aNewPolygon, aMiterPolygon; // close polygon aNewPolygon.setClosed(true); @@ -254,19 +264,19 @@ namespace drawinglayer { fPos += fInc; - aNextPointOnXY = ::basegfx::B3DPoint( + aNextPointOnXY = basegfx::B3DPoint( cos(fPos), sin(fPos), 0.0); - aNextPointRotY = ::basegfx::B3DPoint( + aNextPointRotY = basegfx::B3DPoint( aNextPointOnXY.getX() * fCos, aNextPointOnXY.getY(), aNextPointOnXY.getX() * fSin); if(bMiter) { - aNextMiter = ::basegfx::B3DPoint( + aNextMiter = basegfx::B3DPoint( aNextPointOnXY.getX(), aNextPointOnXY.getY(), fMiterSin * (aNextPointOnXY.getX() / fMiterCos)); @@ -279,18 +289,18 @@ namespace drawinglayer if(bMiter) { - aNewPolygon.append(::basegfx::B3DPoint(0.0, -1.0, 0.0)); + aNewPolygon.append(basegfx::B3DPoint(0.0, -1.0, 0.0)); aNewPolygon.append(aNextPointOnXY); aNewPolygon.append(aNextMiter); aMiterPolygon.clear(); - aMiterPolygon.append(::basegfx::B3DPoint(0.0, -1.0, 0.0)); + aMiterPolygon.append(basegfx::B3DPoint(0.0, -1.0, 0.0)); aMiterPolygon.append(aNextMiter); aMiterPolygon.append(aNextPointRotY); } else { - aNewPolygon.append(::basegfx::B3DPoint(0.0, -1.0, 0.0)); + aNewPolygon.append(basegfx::B3DPoint(0.0, -1.0, 0.0)); aNewPolygon.append(aNextPointOnXY); aNewPolygon.append(aNextPointRotY); } @@ -301,18 +311,18 @@ namespace drawinglayer if(bMiter) { - aNewPolygon.append(::basegfx::B3DPoint(0.0, 1.0, 0.0)); + aNewPolygon.append(basegfx::B3DPoint(0.0, 1.0, 0.0)); aNewPolygon.append(aCurrMiter); aNewPolygon.append(aPointOnXY); aMiterPolygon.clear(); - aMiterPolygon.append(::basegfx::B3DPoint(0.0, 1.0, 0.0)); + aMiterPolygon.append(basegfx::B3DPoint(0.0, 1.0, 0.0)); aMiterPolygon.append(aPointRotY); aMiterPolygon.append(aCurrMiter); } else { - aNewPolygon.append(::basegfx::B3DPoint(0.0, 1.0, 0.0)); + aNewPolygon.append(basegfx::B3DPoint(0.0, 1.0, 0.0)); aNewPolygon.append(aPointRotY); aNewPolygon.append(aPointOnXY); } @@ -346,15 +356,15 @@ namespace drawinglayer // set normals for(sal_uInt32 b(0L); b < aNewPolygon.count(); b++) { - aNewPolygon.setNormal(b, ::basegfx::B3DVector(aNewPolygon.getB3DPoint(b))); + aNewPolygon.setNormal(b, basegfx::B3DVector(aNewPolygon.getB3DPoint(b))); } // create primitive if(aNewPolygon.count()) { - const ::basegfx::B3DPolyPolygon aNewPolyPolygon(aNewPolygon); - basePrimitive* pNew = new polyPolygonMaterialPrimitive3D(aNewPolyPolygon, rMaterial, false); - rDest.push_back(referencedPrimitive(*pNew)); + const basegfx::B3DPolyPolygon aNewPolyPolygon(aNewPolygon); + basePrimitive3D* pNew = new polyPolygonMaterialPrimitive3D(aNewPolyPolygon, rMaterial, false); + rDest.push_back(referencedPrimitive3D(*pNew)); } if(bMiter && aMiterPolygon.count()) @@ -362,13 +372,13 @@ namespace drawinglayer // set normals for(sal_uInt32 c(0L); c < aMiterPolygon.count(); c++) { - aMiterPolygon.setNormal(c, ::basegfx::B3DVector(aMiterPolygon.getB3DPoint(c))); + aMiterPolygon.setNormal(c, basegfx::B3DVector(aMiterPolygon.getB3DPoint(c))); } // create primitive - const ::basegfx::B3DPolyPolygon aMiterPolyPolygon(aMiterPolygon); - basePrimitive* pNew = new polyPolygonMaterialPrimitive3D(aMiterPolyPolygon, rMaterial, false); - rDest.push_back(referencedPrimitive(*pNew)); + const basegfx::B3DPolyPolygon aMiterPolyPolygon(aMiterPolygon); + basePrimitive3D* pNew = new polyPolygonMaterialPrimitive3D(aMiterPolyPolygon, rMaterial, false); + rDest.push_back(referencedPrimitive3D(*pNew)); } // prepare next step @@ -387,10 +397,10 @@ namespace drawinglayer } } - ::basegfx::B3DHomMatrix getRotationFromVector(const ::basegfx::B3DVector& rVector) + basegfx::B3DHomMatrix getRotationFromVector(const basegfx::B3DVector& rVector) { // build transformation from unit vector to vector - ::basegfx::B3DHomMatrix aRetval; + basegfx::B3DHomMatrix aRetval; // get applied rotations from angles in XY and in XZ (cartesian) const double fRotInXY(atan2(rVector.getY(), rVector.getXZLength())); @@ -403,105 +413,105 @@ namespace drawinglayer return aRetval; } } // end of anonymous namespace - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { - namespace primitive + namespace primitive3d { - void polygonTubePrimitive3D::decompose(primitiveVector& rTarget, const ::drawinglayer::geometry::viewInformation& rViewInformation) + void polygonTubePrimitive3D::decompose(primitiveVector3D& rTarget) { const sal_uInt32 nPointCount(maPolygon.count()); if(0L != nPointCount) { - if(::basegfx::fTools::more(mfRadius, 0.0)) + if(basegfx::fTools::more(mfRadius, 0.0)) { - const materialAttribute3D aMaterial(maBColor); + const attribute::materialAttribute3D aMaterial(maBColor); static sal_uInt32 nSegments(8L); // default for 3d line segments, for more quality just raise this value (in even steps) const bool bClosed(maPolygon.isClosed()); - const bool bNoLineJoin(::basegfx::tools::B2DLINEJOIN_NONE == maLineJoin); + const bool bNoLineJoin(basegfx::tools::B2DLINEJOIN_NONE == maLineJoin); const sal_uInt32 nLoopCount(bClosed ? nPointCount : nPointCount - 1L); - ::basegfx::B3DPoint aLast(maPolygon.getB3DPoint(nPointCount - 1L)); - ::basegfx::B3DPoint aCurr(maPolygon.getB3DPoint(0L)); + basegfx::B3DPoint aLast(maPolygon.getB3DPoint(nPointCount - 1L)); + basegfx::B3DPoint aCurr(maPolygon.getB3DPoint(0L)); for(sal_uInt32 a(0L); a < nLoopCount; a++) { // get next data - const ::basegfx::B3DPoint aNext(maPolygon.getB3DPoint((a + 1L) % nPointCount)); - const ::basegfx::B3DVector aForw(aNext - aCurr); + const basegfx::B3DPoint aNext(maPolygon.getB3DPoint((a + 1L) % nPointCount)); + const basegfx::B3DVector aForw(aNext - aCurr); const double fForwLen(aForw.getLength()); - if(::basegfx::fTools::more(fForwLen, 0.0)) + if(basegfx::fTools::more(fForwLen, 0.0)) { // get rotation from vector, this describes rotation from (1, 0, 0) to aForw - ::basegfx::B3DHomMatrix aRotVector(getRotationFromVector(aForw)); + basegfx::B3DHomMatrix aRotVector(getRotationFromVector(aForw)); // create default transformation with scale and rotate - ::basegfx::B3DHomMatrix aVectorTrans; + basegfx::B3DHomMatrix aVectorTrans; aVectorTrans.scale(fForwLen, mfRadius, mfRadius); aVectorTrans *= aRotVector; aVectorTrans.translate(aCurr.getX(), aCurr.getY(), aCurr.getZ()); if(bNoLineJoin || (!bClosed && !a)) { - // line start edge, build transformed primitiveVector + // line start edge, build transformed primitiveVector3D transformPrimitive3D* pNewTransformedA = new transformPrimitive3D(aVectorTrans, getLineCapSegments(nSegments, aMaterial)); - rTarget.push_back(referencedPrimitive(*pNewTransformedA)); + rTarget.push_back(referencedPrimitive3D(*pNewTransformedA)); } else { - const ::basegfx::B3DVector aBack(aCurr - aLast); - const double fCross(::basegfx::cross(aBack, aForw).getLength()); + const basegfx::B3DVector aBack(aCurr - aLast); + const double fCross(basegfx::cross(aBack, aForw).getLength()); - if(!::basegfx::fTools::equalZero(fCross)) + if(!basegfx::fTools::equalZero(fCross)) { // line connect non-parallel, aBack, aForw, use maLineJoin - primitiveVector aNewList; + primitiveVector3D aNewList; const double fAngle(acos(aBack.scalar(aForw) / (fForwLen * aBack.getLength()))); // 0.0 .. F_PI2 getLineJoinSegments(aNewList, nSegments, aMaterial, fAngle, mfDegreeStepWidth, mfMiterMinimumAngle, maLineJoin); // calculate transformation. First, get angle in YZ between nForw projected on (1, 0, 0) and nBack - ::basegfx::B3DHomMatrix aInvRotVector(aRotVector); + basegfx::B3DHomMatrix aInvRotVector(aRotVector); aInvRotVector.invert(); - ::basegfx::B3DVector aTransBack(aInvRotVector * aBack); + basegfx::B3DVector aTransBack(aInvRotVector * aBack); const double fRotInYZ(atan2(aTransBack.getY(), aTransBack.getZ())); // create trans by rotating unit sphere with angle 90 degrees around Y, then 180-fRot in X. // Also apply usual scaling and translation - ::basegfx::B3DHomMatrix aSphereTrans; + basegfx::B3DHomMatrix aSphereTrans; aSphereTrans.rotate(0.0, F_PI2, 0.0); aSphereTrans.rotate(F_PI - fRotInYZ, 0.0, 0.0); aSphereTrans *= aRotVector; aSphereTrans.scale(mfRadius, mfRadius, mfRadius); aSphereTrans.translate(aCurr.getX(), aCurr.getY(), aCurr.getZ()); - // line start edge, build transformed primitiveVector + // line start edge, build transformed primitiveVector3D transformPrimitive3D* pNewTransformedB = new transformPrimitive3D(aSphereTrans, aNewList); - rTarget.push_back(referencedPrimitive(*pNewTransformedB)); + rTarget.push_back(referencedPrimitive3D(*pNewTransformedB)); } } - // create line segments, build transformed primitiveVector + // create line segments, build transformed primitiveVector3D transformPrimitive3D* pNewTransformedC = new transformPrimitive3D(aVectorTrans, getLineTubeSegments(nSegments, aMaterial)); - rTarget.push_back(referencedPrimitive(*pNewTransformedC)); + rTarget.push_back(referencedPrimitive3D(*pNewTransformedC)); if(bNoLineJoin || (!bClosed && ((a + 1L) == nLoopCount))) { // line end edge, first rotate (mirror) and translate, then use use aRotVector - ::basegfx::B3DHomMatrix aBackTrans; + basegfx::B3DHomMatrix aBackTrans; aBackTrans.rotate(0.0, F_PI, 0.0); aBackTrans.translate(1.0, 0.0, 0.0); aBackTrans.scale(fForwLen, mfRadius, mfRadius); aBackTrans *= aRotVector; aBackTrans.translate(aCurr.getX(), aCurr.getY(), aCurr.getZ()); - // line end edge, build transformed primitiveVector + // line end edge, build transformed primitiveVector3D transformPrimitive3D* pNewTransformedD = new transformPrimitive3D(aBackTrans, getLineCapSegments(nSegments, aMaterial)); - rTarget.push_back(referencedPrimitive(*pNewTransformedD)); + rTarget.push_back(referencedPrimitive3D(*pNewTransformedD)); } } @@ -514,15 +524,15 @@ namespace drawinglayer { // create hairline polygonHairlinePrimitive3D* pNew = new polygonHairlinePrimitive3D(maPolygon, maBColor); - rTarget.push_back(referencedPrimitive(*pNew)); + rTarget.push_back(referencedPrimitive3D(*pNew)); } } } polygonTubePrimitive3D::polygonTubePrimitive3D( - const ::basegfx::B3DPolygon& rPolygon, - const ::basegfx::BColor& rBColor, - double fRadius, ::basegfx::tools::B2DLineJoin aLineJoin, + const basegfx::B3DPolygon& rPolygon, + const basegfx::BColor& rBColor, + double fRadius, basegfx::tools::B2DLineJoin aLineJoin, double fDegreeStepWidth, double fMiterMinimumAngle) : polygonHairlinePrimitive3D(rPolygon, rBColor), @@ -537,7 +547,7 @@ namespace drawinglayer { } - bool polygonTubePrimitive3D::operator==(const basePrimitive& rPrimitive) const + bool polygonTubePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const { if(polygonHairlinePrimitive3D::operator==(rPrimitive)) { @@ -556,7 +566,7 @@ namespace drawinglayer { return CreatePrimitiveID('T', 'U', 'B', '3'); } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx b/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx index 0ba67d332f83..6e838043762b 100644 --- a/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: polypolygonprimitive3d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-06-02 13:58:02 $ + * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -45,10 +45,14 @@ namespace drawinglayer { - namespace primitive + namespace primitive3d { - polyPolygonMaterialPrimitive3D::polyPolygonMaterialPrimitive3D(const ::basegfx::B3DPolyPolygon& rPolyPolygon, const materialAttribute3D& rMaterial, bool bDoubleSided) - : maPolyPolygon(rPolyPolygon), + polyPolygonMaterialPrimitive3D::polyPolygonMaterialPrimitive3D( + const basegfx::B3DPolyPolygon& rPolyPolygon, + const attribute::materialAttribute3D& rMaterial, + bool bDoubleSided) + : basePrimitive3D(), + maPolyPolygon(rPolyPolygon), maMaterial(rMaterial), mbDoubleSided(bDoubleSided) { @@ -58,7 +62,7 @@ namespace drawinglayer { } - bool polyPolygonMaterialPrimitive3D::operator==(const basePrimitive& rPrimitive) const + bool polyPolygonMaterialPrimitive3D::operator==(const basePrimitive3D& rPrimitive) const { if(getID() == rPrimitive.getID()) { @@ -77,11 +81,11 @@ namespace drawinglayer return CreatePrimitiveID('P', 'O', 'M', '3'); } - ::basegfx::B3DRange polyPolygonMaterialPrimitive3D::get3DRange(const ::drawinglayer::geometry::viewInformation& rViewInformation) const + basegfx::B3DRange polyPolygonMaterialPrimitive3D::get3DRange() const { - return ::basegfx::tools::getRange(maPolyPolygon); + return basegfx::tools::getRange(maPolyPolygon); } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx index b34fd61f3449..aa2a43198df4 100644 --- a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrcubeprimitive3d.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2006-06-02 13:58:02 $ + * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -69,16 +69,16 @@ namespace drawinglayer { - namespace primitive + namespace primitive3d { - void sdrCubePrimitive3D::decompose(primitiveVector& rTarget, const ::drawinglayer::geometry::viewInformation& rViewInformation) + void sdrCubePrimitive3D::decompose(primitiveVector3D& rTarget) { - const ::basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); + const basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); // add fill if(getSdrLFSAttribute().getFill()) { - ::basegfx::B3DPolyPolygon aFill(::basegfx::tools::createCubeFillPolyPolygonFromB3DRange(aUnitRange)); + basegfx::B3DPolyPolygon aFill(basegfx::tools::createCubeFillPolyPolygonFromB3DRange(aUnitRange)); // normal creation { @@ -86,14 +86,14 @@ namespace drawinglayer || ::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind()) { // create sphere normals - const ::basegfx::B3DPoint aCenter(::basegfx::tools::getRange(aFill).getCenter()); - aFill = ::basegfx::tools::applyDefaultNormalsSphere(aFill, aCenter); + const basegfx::B3DPoint aCenter(basegfx::tools::getRange(aFill).getCenter()); + aFill = basegfx::tools::applyDefaultNormalsSphere(aFill, aCenter); } if(getSdr3DObjectAttribute().getNormalsInvert()) { // invert normals - aFill = ::basegfx::tools::invertNormals(aFill); + aFill = basegfx::tools::invertNormals(aFill); } } @@ -112,16 +112,16 @@ namespace drawinglayer if(bParallelX || bParallelY) { // apply parallel texture coordinates in X and/or Y - const ::basegfx::B3DRange aRange(::basegfx::tools::getRange(aFill)); - aFill = ::basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill, aRange, bParallelX, bParallelY); + const basegfx::B3DRange aRange(basegfx::tools::getRange(aFill)); + aFill = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill, aRange, bParallelX, bParallelY); } if(bSphereX || bSphereY) { // apply spherical texture coordinates in X and/or Y - const ::basegfx::B3DRange aRange(::basegfx::tools::getRange(aFill)); - const ::basegfx::B3DPoint aCenter(aRange.getCenter()); - aFill = ::basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill, aCenter, bSphereX, bSphereY); + const basegfx::B3DRange aRange(basegfx::tools::getRange(aFill)); + const basegfx::B3DPoint aCenter(aRange.getCenter()); + aFill = basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill, aCenter, bSphereX, bSphereY); } if(bObjectSpecificX || bObjectSpecificY) @@ -129,13 +129,13 @@ namespace drawinglayer // object-specific for(sal_uInt32 a(0L); a < aFill.count(); a++) { - ::basegfx::B3DPolygon aTmpPoly(aFill.getB3DPolygon(a)); + basegfx::B3DPolygon aTmpPoly(aFill.getB3DPolygon(a)); if(aTmpPoly.count() >= 4L) { for(sal_uInt32 b(0L); b < 4L; b++) { - ::basegfx::B2DPoint aPoint(aTmpPoly.getTextureCoordinate(b)); + basegfx::B2DPoint aPoint(aTmpPoly.getTextureCoordinate(b)); if(bObjectSpecificX) { @@ -156,17 +156,17 @@ namespace drawinglayer } // transform texture coordinates to texture size - ::basegfx::B2DHomMatrix aTexMatrix; + basegfx::B2DHomMatrix aTexMatrix; aTexMatrix.scale(maTextureSize.getX(), maTextureSize.getY()); aFill.transformTextureCoordiantes(aTexMatrix); } // build vector of PolyPolygons - ::std::vector< ::basegfx::B3DPolyPolygon > a3DPolyPolygonVector; + ::std::vector< basegfx::B3DPolyPolygon > a3DPolyPolygonVector; for(sal_uInt32 a(0L); a < aFill.count(); a++) { - a3DPolyPolygonVector.push_back(::basegfx::B3DPolyPolygon(aFill.getB3DPolygon(a))); + a3DPolyPolygonVector.push_back(basegfx::B3DPolyPolygon(aFill.getB3DPolygon(a))); } // create single PolyPolygonFill primitives @@ -179,7 +179,7 @@ namespace drawinglayer // add line if(getSdrLFSAttribute().getLine()) { - ::basegfx::B3DPolyPolygon aLine(::basegfx::tools::createCubePolyPolygonFromB3DRange(aUnitRange)); + basegfx::B3DPolyPolygon aLine(basegfx::tools::createCubePolyPolygonFromB3DRange(aUnitRange)); add3DPolyPolygonLinePrimitive(aLine, maTransform, rTarget, *getSdrLFSAttribute().getLine()); } @@ -191,10 +191,10 @@ namespace drawinglayer } sdrCubePrimitive3D::sdrCubePrimitive3D( - const ::basegfx::B3DHomMatrix& rTransform, - const ::basegfx::B2DVector& rTextureSize, - const sdrLineFillShadowAttribute& rSdrLFSAttribute, - const sdr3DObjectAttribute& rSdr3DObjectAttribute) + const basegfx::B3DHomMatrix& rTransform, + const basegfx::B2DVector& rTextureSize, + const attribute::sdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::sdr3DObjectAttribute& rSdr3DObjectAttribute) : sdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute) { } @@ -203,7 +203,7 @@ namespace drawinglayer { } - bool sdrCubePrimitive3D::operator==(const basePrimitive& rPrimitive) const + bool sdrCubePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const { return sdrPrimitive3D::operator==(rPrimitive); } @@ -213,7 +213,7 @@ namespace drawinglayer return CreatePrimitiveID('S', 'C', 'U', '3'); } - ::basegfx::B3DRange sdrCubePrimitive3D::get3DRange(const ::drawinglayer::geometry::viewInformation& rViewInformation) const + basegfx::B3DRange sdrCubePrimitive3D::get3DRange() const { // use defaut from sdrPrimitive3D which uses transformation expanded by line width/2. // The parent implementation which uses the ranges of the decomposition would be more @@ -221,9 +221,9 @@ namespace drawinglayer // the range of the non-transformed geometry and transform it then. This leads to different // ranges where the new method is more correct, but the need to keep the old behaviour // has priority here. - return getStandard3DRange(rViewInformation); + return getStandard3DRange(); } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx index 82816748a7c3..0e9c053b15cf 100644 --- a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrdecompositiontools3d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-06-02 13:58:02 $ + * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -41,16 +41,16 @@ #include <basegfx/polygon/b3dpolygon.hxx> #endif -#ifndef _DRAWINGLAYER_PRIMITIVE_STROKEATTRIBUTE_HXX -#include <drawinglayer/primitive/strokeattribute.hxx> +#ifndef _DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX +#include <drawinglayer/attribute/strokeattribute.hxx> #endif -#ifndef _DRAWINGLAYER_PRIMITIVE_SDRATTRIBUTE_HXX -#include <drawinglayer/primitive/sdrattribute.hxx> +#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX +#include <drawinglayer/attribute/sdrattribute.hxx> #endif -#ifndef _DRAWINGLAYER_PRIMITIVE_PRIMITIVE_HXX -#include <drawinglayer/primitive/primitive.hxx> +#ifndef _DRAWINGLAYER_PRIMITIVE3D_PRIMITIVE3D_HXX +#include <drawinglayer/primitive3d/primitive3d.hxx> #endif #ifndef _DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX @@ -69,24 +69,24 @@ #include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx> #endif -#ifndef _DRAWINGLAYER_PRIMITIVE3D_SDRATTRIBUTE3D_HXX -#include <drawinglayer/primitive3d/sdrattribute3d.hxx> +#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX +#include <drawinglayer/attribute/sdrattribute.hxx> #endif #ifndef _VCL_VCLENUM_HXX #include <vcl/vclenum.hxx> #endif -#ifndef _DRAWINGLAYER_PRIMITIVE_FILLATTRIBUTE_HXX -#include <drawinglayer/primitive/fillattribute.hxx> +#ifndef _DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX +#include <drawinglayer/attribute/fillattribute.hxx> #endif -#ifndef _DRAWINGLAYER_PRIMITIVE_FILLBITMAPATTRIBUTE_HXX -#include <drawinglayer/primitive/fillbitmapattribute.hxx> +#ifndef _DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX +#include <drawinglayer/attribute/fillbitmapattribute.hxx> #endif -#ifndef _DRAWINGLAYER_PRIMITIVE_SDRFILLBITMAPATTRIBUTE_HXX -#include <drawinglayer/primitive/sdrfillbitmapattribute.hxx> +#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX +#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx> #endif #ifndef _SV_BMPACC_HXX @@ -101,8 +101,8 @@ #include <drawinglayer/primitive3d/textureprimitive3d.hxx> #endif -#ifndef _DRAWINGLAYER_PRIMITIVE_MODIFIEDCOLORPRIMITIVE_HXX -#include <drawinglayer/primitive/modifiedcolorprimitive.hxx> +#ifndef _DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX +#include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx> #endif #ifndef _DRAWINGLAYER_PRIMITIVE3D_HATCHTEXTUREPRIMITIVE3D_HXX @@ -113,39 +113,43 @@ #include <drawinglayer/primitive3d/shadowprimitive3d.hxx> #endif +#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE3D_HXX +#include <drawinglayer/attribute/sdrattribute3d.hxx> +#endif + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { - namespace primitive + namespace primitive3d { void add3DPolyPolygonLinePrimitive( - const ::basegfx::B3DPolyPolygon& rUnitPolyPolygon, - const ::basegfx::B3DHomMatrix& rObjectTransform, - primitiveVector& rTarget, - const sdrLineAttribute& rLine) + const basegfx::B3DPolyPolygon& rUnitPolyPolygon, + const basegfx::B3DHomMatrix& rObjectTransform, + primitiveVector3D& rTarget, + const attribute::sdrLineAttribute& rLine) { // prepare fully scaled polyPolygon - ::basegfx::B3DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); + basegfx::B3DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); aScaledPolyPolygon.transform(rObjectTransform); // create stroke attribute - const strokeAttribute aStrokeAttribute(rLine.getColor(), rLine.getWidth(), rLine.getJoin(), rLine.getDotDashArray(), rLine.getFullDotDashLen()); + const attribute::strokeAttribute aStrokeAttribute(rLine.getColor(), rLine.getWidth(), rLine.getJoin(), rLine.getDotDashArray(), rLine.getFullDotDashLen()); // create primitives - primitiveVector aNewPrimitiveVector; + primitiveVector3D aNewPrimitiveVector; for(sal_uInt32 a(0L); a < aScaledPolyPolygon.count(); a++) { - basePrimitive* pNewLinePrimitive = new polygonStrokePrimitive3D(aScaledPolyPolygon.getB3DPolygon(a), aStrokeAttribute); - aNewPrimitiveVector.push_back(referencedPrimitive(*pNewLinePrimitive)); + basePrimitive3D* pNewLinePrimitive = new polygonStrokePrimitive3D(aScaledPolyPolygon.getB3DPolygon(a), aStrokeAttribute); + aNewPrimitiveVector.push_back(referencedPrimitive3D(*pNewLinePrimitive)); } if(0.0 != rLine.getTransparence()) { // create simpleTransparencePrimitive, add created fill primitives - basePrimitive* pNewSimpleTransparenceTexturePrimitive3D = new simpleTransparenceTexturePrimitive3D(rLine.getTransparence(), aNewPrimitiveVector); - rTarget.push_back(referencedPrimitive(*pNewSimpleTransparenceTexturePrimitive3D)); + basePrimitive3D* pNewSimpleTransparenceTexturePrimitive3D = new simpleTransparenceTexturePrimitive3D(rLine.getTransparence(), aNewPrimitiveVector); + rTarget.push_back(referencedPrimitive3D(*pNewSimpleTransparenceTexturePrimitive3D)); } else { @@ -155,23 +159,23 @@ namespace drawinglayer } void add3DPolyPolygonFillPrimitive( - const ::std::vector< ::basegfx::B3DPolyPolygon >& r3DPolyPolygonVector, - const ::basegfx::B3DHomMatrix& rObjectTransform, - const ::basegfx::B2DVector& rTextureSize, - primitiveVector& rTarget, - const sdr3DObjectAttribute& aSdr3DObjectAttribute, - const sdrFillAttribute& rFill, - const fillGradientAttribute* pFillGradient) + const ::std::vector< basegfx::B3DPolyPolygon >& r3DPolyPolygonVector, + const basegfx::B3DHomMatrix& rObjectTransform, + const basegfx::B2DVector& rTextureSize, + primitiveVector3D& rTarget, + const attribute::sdr3DObjectAttribute& aSdr3DObjectAttribute, + const attribute::sdrFillAttribute& rFill, + const attribute::fillGradientAttribute* pFillGradient) { if(r3DPolyPolygonVector.size()) { // create list of simple fill primitives - primitiveVector aNewPrimitiveVector; + primitiveVector3D aNewPrimitiveVector; for(sal_uInt32 a(0L); a < r3DPolyPolygonVector.size(); a++) { // get scaled PolyPolygon - ::basegfx::B3DPolyPolygon aScaledPolyPolygon(r3DPolyPolygonVector[a]); + basegfx::B3DPolyPolygon aScaledPolyPolygon(r3DPolyPolygonVector[a]); aScaledPolyPolygon.transform(rObjectTransform); if(aScaledPolyPolygon.areNormalsUsed()) @@ -179,11 +183,11 @@ namespace drawinglayer aScaledPolyPolygon.transformNormals(rObjectTransform); } - basePrimitive* pNewFillPrimitive = new polyPolygonMaterialPrimitive3D( + basePrimitive3D* pNewFillPrimitive = new polyPolygonMaterialPrimitive3D( aScaledPolyPolygon, aSdr3DObjectAttribute.getMaterial(), aSdr3DObjectAttribute.getDoubleSided()); - aNewPrimitiveVector.push_back(referencedPrimitive(*pNewFillPrimitive)); + aNewPrimitiveVector.push_back(referencedPrimitive3D(*pNewFillPrimitive)); } // look for and evtl. build texture sub-group primitive @@ -191,7 +195,7 @@ namespace drawinglayer { bool bModulate(::com::sun::star::drawing::TextureMode_MODULATE == aSdr3DObjectAttribute.getTextureMode()); bool bFilter(aSdr3DObjectAttribute.getTextureFilter()); - basePrimitive* pNewTexturePrimitive3D = 0L; + basePrimitive3D* pNewTexturePrimitive3D = 0L; if(rFill.isGradient()) { @@ -206,35 +210,35 @@ namespace drawinglayer else // if(rFill.isBitmap()) { // create bitmapTexture3D with sublist, add to local aNewPrimitiveVector - ::basegfx::B2DRange aTexRange(0.0, 0.0, rTextureSize.getX(), rTextureSize.getY()); + basegfx::B2DRange aTexRange(0.0, 0.0, rTextureSize.getX(), rTextureSize.getY()); pNewTexturePrimitive3D = new bitmapTexturePrimitive3D(rFill.getBitmap()->getFillBitmapAttribute(aTexRange), aNewPrimitiveVector, rTextureSize, bModulate, bFilter); } // exchange aNewPrimitiveVector content with texture group aNewPrimitiveVector.clear(); - aNewPrimitiveVector.push_back(referencedPrimitive(*pNewTexturePrimitive3D)); + aNewPrimitiveVector.push_back(referencedPrimitive3D(*pNewTexturePrimitive3D)); 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); - basePrimitive* pModifiedColor = new modifiedColorPrimitive(aNewPrimitiveVector, aBColorModifier); + const basegfx::BColorModifier aBColorModifier(basegfx::BColor(), 0.0, basegfx::BCOLORMODIFYMODE_GRAY); + basePrimitive3D* pModifiedColor = new modifiedColorPrimitive3D(aNewPrimitiveVector, aBColorModifier); aNewPrimitiveVector.clear(); - aNewPrimitiveVector.push_back(referencedPrimitive(*pModifiedColor)); + aNewPrimitiveVector.push_back(referencedPrimitive3D(*pModifiedColor)); } } if(0.0 != rFill.getTransparence()) { // create simpleTransparenceTexturePrimitive3D with sublist and append - basePrimitive* pNewSimpleTransparenceTexturePrimitive3D = new simpleTransparenceTexturePrimitive3D(rFill.getTransparence(), aNewPrimitiveVector); - rTarget.push_back(referencedPrimitive(*pNewSimpleTransparenceTexturePrimitive3D)); + basePrimitive3D* pNewSimpleTransparenceTexturePrimitive3D = new simpleTransparenceTexturePrimitive3D(rFill.getTransparence(), aNewPrimitiveVector); + rTarget.push_back(referencedPrimitive3D(*pNewSimpleTransparenceTexturePrimitive3D)); } else if(pFillGradient) { // create transparenceTexture3D with sublist and append - basePrimitive* pNewTransparenceTexturePrimitive3D = new transparenceTexturePrimitive3D(*pFillGradient, aNewPrimitiveVector, rTextureSize); - rTarget.push_back(referencedPrimitive(*pNewTransparenceTexturePrimitive3D)); + basePrimitive3D* pNewTransparenceTexturePrimitive3D = new transparenceTexturePrimitive3D(*pFillGradient, aNewPrimitiveVector, rTextureSize); + rTarget.push_back(referencedPrimitive3D(*pNewTransparenceTexturePrimitive3D)); } else { @@ -245,29 +249,28 @@ namespace drawinglayer } void addShadowPrimitive3D( - primitiveVector& rTarget, - const sdrShadowAttribute& rShadow, + primitiveVector3D& rTarget, + const attribute::sdrShadowAttribute& rShadow, bool bShadow3D) { // create Shadow primitives. Need to be added in front, should use already created primitives - if(rTarget.size() && !::basegfx::fTools::moreOrEqual(rShadow.getTransparence(), 1.0)) + if(rTarget.size() && !basegfx::fTools::moreOrEqual(rShadow.getTransparence(), 1.0)) { // prepare new list for shadow geometry - primitiveVector aNewList; + primitiveVector3D aNewList; // prepare shadow offset - ::basegfx::B2DHomMatrix aShadowOffset; + basegfx::B2DHomMatrix aShadowOffset; aShadowOffset.set(0, 2, rShadow.getOffset().getX()); aShadowOffset.set(1, 2, rShadow.getOffset().getY()); // create shadow primitive and add primitives - primitiveVector aShadowPrimitiveVector(rTarget); - shadowPrimitive3D* pNewShadow3D = new shadowPrimitive3D(aShadowOffset, rShadow.getColor(), rShadow.getTransparence(), bShadow3D, aShadowPrimitiveVector); + shadowPrimitive3D* pNewShadow3D = new shadowPrimitive3D(aShadowOffset, rShadow.getColor(), rShadow.getTransparence(), bShadow3D, rTarget); rTarget.clear(); - rTarget.push_back(referencedPrimitive(*pNewShadow3D)); + rTarget.push_back(referencedPrimitive3D(*pNewShadow3D)); } } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx index 4cfb233c2b18..574e2c5ea982 100644 --- a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrextrudelathetools3d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-05-19 09:34:54 $ + * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -91,15 +91,15 @@ namespace ////////////////////////////////////////////////////////////////////////////// // common helpers - ::basegfx::B2DPolyPolygon impScalePolyPolygonOnCenter(const ::basegfx::B2DPolyPolygon& rSource, double fScale) + basegfx::B2DPolyPolygon impScalePolyPolygonOnCenter(const basegfx::B2DPolyPolygon& rSource, double fScale) { - ::basegfx::B2DPolyPolygon aRetval(rSource); + basegfx::B2DPolyPolygon aRetval(rSource); - if(!::basegfx::fTools::equalZero(fScale)) + if(!basegfx::fTools::equalZero(fScale)) { - const ::basegfx::B2DRange aRange(::basegfx::tools::getRange(rSource)); - const ::basegfx::B2DPoint aCenter(aRange.getCenter()); - ::basegfx::B2DHomMatrix aTrans; + const basegfx::B2DRange aRange(basegfx::tools::getRange(rSource)); + const basegfx::B2DPoint aCenter(aRange.getCenter()); + basegfx::B2DHomMatrix aTrans; aTrans.translate(-aCenter.getX(), -aCenter.getY()); aTrans.scale(fScale, fScale); @@ -110,23 +110,23 @@ namespace return aRetval; } - void impGetOuterPolyPolygon(::basegfx::B2DPolyPolygon& rPolygon, ::basegfx::B2DPolyPolygon& rOuterPolyPolygon, double fOffset, bool bCharacterMode) + void impGetOuterPolyPolygon(basegfx::B2DPolyPolygon& rPolygon, basegfx::B2DPolyPolygon& rOuterPolyPolygon, double fOffset, bool bCharacterMode) { rOuterPolyPolygon = rPolygon; - if(::basegfx::fTools::more(fOffset, 0.0)) + if(basegfx::fTools::more(fOffset, 0.0)) { if(bCharacterMode) { // grow the outside polygon and scale all polygons to original size. This is done // to avoid a shrink which potentially would lead to self-intersections, but changes // the original polygon -> not a precision step, so e.g. not usable for charts - const ::basegfx::B2DRange aRange(::basegfx::tools::getRange(rPolygon)); - rPolygon = ::basegfx::tools::growInNormalDirection(rPolygon, fOffset); - const ::basegfx::B2DRange aGrownRange(::basegfx::tools::getRange(rPolygon)); - const double fScaleX(::basegfx::fTools::equalZero(aGrownRange.getWidth()) ? 1.0 : aRange.getWidth() / aGrownRange.getWidth()); - const double fScaleY(::basegfx::fTools::equalZero(aGrownRange.getHeight())? 1.0 : aRange.getHeight() / aGrownRange.getHeight()); - ::basegfx::B2DHomMatrix aScaleTrans; + const basegfx::B2DRange aRange(basegfx::tools::getRange(rPolygon)); + rPolygon = basegfx::tools::growInNormalDirection(rPolygon, fOffset); + const basegfx::B2DRange aGrownRange(basegfx::tools::getRange(rPolygon)); + const double fScaleX(basegfx::fTools::equalZero(aGrownRange.getWidth()) ? 1.0 : aRange.getWidth() / aGrownRange.getWidth()); + const double fScaleY(basegfx::fTools::equalZero(aGrownRange.getHeight())? 1.0 : aRange.getHeight() / aGrownRange.getHeight()); + basegfx::B2DHomMatrix aScaleTrans; aScaleTrans.translate(-aGrownRange.getMinX(), -aGrownRange.getMinY()); aScaleTrans.scale(fScaleX, fScaleY); @@ -138,13 +138,13 @@ namespace { // use more precision, shrink the outer polygons. Since this may lead to self-intersections, // some kind of correction should be applied here after that step - rOuterPolyPolygon = ::basegfx::tools::growInNormalDirection(rPolygon, -fOffset); - ::basegfx::tools::correctGrowShrinkPolygonPair(rPolygon, rOuterPolyPolygon); + rOuterPolyPolygon = basegfx::tools::growInNormalDirection(rPolygon, -fOffset); + basegfx::tools::correctGrowShrinkPolygonPair(rPolygon, rOuterPolyPolygon); } } } - void impAddInBetweenFill(::basegfx::B3DPolyPolygon& rTarget, const ::basegfx::B3DPolyPolygon& rPolA, const ::basegfx::B3DPolyPolygon& rPolB, + void impAddInBetweenFill(basegfx::B3DPolyPolygon& rTarget, const basegfx::B3DPolyPolygon& rPolA, const basegfx::B3DPolyPolygon& rPolB, double fTexVerStart, double fTexVerStop, bool bCreateNormals, bool bCreateTextureCoordinates) { OSL_ENSURE(rPolA.count() == rPolB.count(), "impAddInBetweenFill: unequally sized polygons (!)"); @@ -152,8 +152,8 @@ namespace for(sal_uInt32 a(0L); a < nPolygonCount; a++) { - const ::basegfx::B3DPolygon aSubA(rPolA.getB3DPolygon(a)); - const ::basegfx::B3DPolygon aSubB(rPolB.getB3DPolygon(a)); + const basegfx::B3DPolygon aSubA(rPolA.getB3DPolygon(a)); + const basegfx::B3DPolygon aSubB(rPolB.getB3DPolygon(a)); OSL_ENSURE(aSubA.count() == aSubB.count(), "impAddInBetweenFill: unequally sized polygons (!)"); const sal_uInt32 nPointCount(aSubA.count()); @@ -165,11 +165,11 @@ namespace if(bCreateTextureCoordinates) { - const double fPolygonLengthA(::basegfx::tools::getLength(aSubA)); - fTexHorMultiplicatorA = ::basegfx::fTools::equalZero(fPolygonLengthA) ? 1.0 : 1.0 / fPolygonLengthA; + const double fPolygonLengthA(basegfx::tools::getLength(aSubA)); + fTexHorMultiplicatorA = basegfx::fTools::equalZero(fPolygonLengthA) ? 1.0 : 1.0 / fPolygonLengthA; - const double fPolygonLengthB(::basegfx::tools::getLength(aSubB)); - fTexHorMultiplicatorB = ::basegfx::fTools::equalZero(fPolygonLengthB) ? 1.0 : 1.0 / fPolygonLengthB; + const double fPolygonLengthB(basegfx::tools::getLength(aSubB)); + fTexHorMultiplicatorB = basegfx::fTools::equalZero(fPolygonLengthB) ? 1.0 : 1.0 / fPolygonLengthB; fPolygonPosA = fPolygonPosB = 0.0; } @@ -179,12 +179,12 @@ namespace const sal_uInt32 nIndexA(b); const sal_uInt32 nIndexB((b + 1L) % nPointCount); - const ::basegfx::B3DPoint aStartA(aSubA.getB3DPoint(nIndexA)); - const ::basegfx::B3DPoint aEndA(aSubA.getB3DPoint(nIndexB)); - const ::basegfx::B3DPoint aStartB(aSubB.getB3DPoint(nIndexA)); - const ::basegfx::B3DPoint aEndB(aSubB.getB3DPoint(nIndexB)); + const basegfx::B3DPoint aStartA(aSubA.getB3DPoint(nIndexA)); + const basegfx::B3DPoint aEndA(aSubA.getB3DPoint(nIndexB)); + const basegfx::B3DPoint aStartB(aSubB.getB3DPoint(nIndexA)); + const basegfx::B3DPoint aEndB(aSubB.getB3DPoint(nIndexB)); - ::basegfx::B3DPolygon aNew; + basegfx::B3DPolygon aNew; aNew.setClosed(true); aNew.append(aStartA); @@ -203,19 +203,19 @@ namespace if(bCreateTextureCoordinates) { const double fRelTexAL(fPolygonPosA * fTexHorMultiplicatorA); - const double fEdgeLengthA(::basegfx::B3DVector(aEndA - aStartA).getLength()); + const double fEdgeLengthA(basegfx::B3DVector(aEndA - aStartA).getLength()); fPolygonPosA += fEdgeLengthA; const double fRelTexAR(fPolygonPosA * fTexHorMultiplicatorA); const double fRelTexBL(fPolygonPosB * fTexHorMultiplicatorB); - const double fEdgeLengthB(::basegfx::B3DVector(aEndB - aStartB).getLength()); + const double fEdgeLengthB(basegfx::B3DVector(aEndB - aStartB).getLength()); fPolygonPosB += fEdgeLengthB; const double fRelTexBR(fPolygonPosB * fTexHorMultiplicatorB); - aNew.setTextureCoordinate(0L, ::basegfx::B2DPoint(fRelTexAL, fTexVerStart)); - aNew.setTextureCoordinate(1L, ::basegfx::B2DPoint(fRelTexBL, fTexVerStop)); - aNew.setTextureCoordinate(2L, ::basegfx::B2DPoint(fRelTexBR, fTexVerStop)); - aNew.setTextureCoordinate(3L, ::basegfx::B2DPoint(fRelTexAR, fTexVerStart)); + aNew.setTextureCoordinate(0L, basegfx::B2DPoint(fRelTexAL, fTexVerStart)); + aNew.setTextureCoordinate(1L, basegfx::B2DPoint(fRelTexBL, fTexVerStop)); + aNew.setTextureCoordinate(2L, basegfx::B2DPoint(fRelTexBR, fTexVerStop)); + aNew.setTextureCoordinate(3L, basegfx::B2DPoint(fRelTexAR, fTexVerStart)); } rTarget.append(aNew); @@ -224,11 +224,11 @@ namespace } } - void impSetNormal(::basegfx::B3DPolyPolygon& rCandidate, const ::basegfx::B3DVector& rNormal) + void impSetNormal(basegfx::B3DPolyPolygon& rCandidate, const basegfx::B3DVector& rNormal) { for(sal_uInt32 a(0L); a < rCandidate.count(); a++) { - ::basegfx::B3DPolygon aSub(rCandidate.getB3DPolygon(a)); + basegfx::B3DPolygon aSub(rCandidate.getB3DPolygon(a)); for(sal_uInt32 b(0L); b < aSub.count(); b++) { @@ -239,61 +239,61 @@ namespace } } - void impCreateInBetweenNormals(::basegfx::B3DPolyPolygon& rPolA, ::basegfx::B3DPolyPolygon& rPolB, bool bSmoothHorizontalNormals) + void impCreateInBetweenNormals(basegfx::B3DPolyPolygon& rPolA, basegfx::B3DPolyPolygon& rPolB, bool bSmoothHorizontalNormals) { OSL_ENSURE(rPolA.count() == rPolB.count(), "sdrExtrudePrimitive3D: unequally sized polygons (!)"); for(sal_uInt32 a(0L); a < rPolA.count(); a++) { - ::basegfx::B3DPolygon aSubA(rPolA.getB3DPolygon(a)); - ::basegfx::B3DPolygon aSubB(rPolB.getB3DPolygon(a)); + basegfx::B3DPolygon aSubA(rPolA.getB3DPolygon(a)); + basegfx::B3DPolygon aSubB(rPolB.getB3DPolygon(a)); OSL_ENSURE(aSubA.count() == aSubB.count(), "sdrExtrudePrimitive3D: unequally sized polygons (!)"); const sal_uInt32 nPointCount(aSubA.count()); if(nPointCount) { - ::basegfx::B3DPoint aPrevA(aSubA.getB3DPoint(nPointCount - 1L)); - ::basegfx::B3DPoint aCurrA(aSubA.getB3DPoint(0L)); + basegfx::B3DPoint aPrevA(aSubA.getB3DPoint(nPointCount - 1L)); + basegfx::B3DPoint aCurrA(aSubA.getB3DPoint(0L)); const bool bClosed(aSubA.isClosed()); for(sal_uInt32 b(0L); b < nPointCount; b++) { const sal_uInt32 nIndNext((b + 1L) % nPointCount); - const ::basegfx::B3DPoint aNextA(aSubA.getB3DPoint(nIndNext)); - const ::basegfx::B3DPoint aCurrB(aSubB.getB3DPoint(b)); + const basegfx::B3DPoint aNextA(aSubA.getB3DPoint(nIndNext)); + const basegfx::B3DPoint aCurrB(aSubB.getB3DPoint(b)); // vector to back - ::basegfx::B3DVector aDepth(aCurrB - aCurrA); + basegfx::B3DVector aDepth(aCurrB - aCurrA); aDepth.normalize(); if(aDepth.equalZero()) { // no difference, try to get depth from next point - const ::basegfx::B3DPoint aNextB(aSubB.getB3DPoint(nIndNext)); + const basegfx::B3DPoint aNextB(aSubB.getB3DPoint(nIndNext)); aDepth = aNextB - aNextA; aDepth.normalize(); } // vector to left (correct for non-closed lines) const bool bFirstAndNotClosed(!bClosed && 0L == b); - ::basegfx::B3DVector aLeft(bFirstAndNotClosed ? aCurrA - aNextA : aPrevA - aCurrA); + basegfx::B3DVector aLeft(bFirstAndNotClosed ? aCurrA - aNextA : aPrevA - aCurrA); aLeft.normalize(); // create left normal - const ::basegfx::B3DVector aNormalLeft(aDepth.getPerpendicular(aLeft)); + const basegfx::B3DVector aNormalLeft(aDepth.getPerpendicular(aLeft)); if(bSmoothHorizontalNormals) { // vector to right (correct for non-closed lines) const bool bLastAndNotClosed(!bClosed && b + 1L == nPointCount); - ::basegfx::B3DVector aRight(bLastAndNotClosed ? aCurrA - aPrevA : aNextA - aCurrA); + basegfx::B3DVector aRight(bLastAndNotClosed ? aCurrA - aPrevA : aNextA - aCurrA); aRight.normalize(); // create right normal - const ::basegfx::B3DVector aNormalRight(aRight.getPerpendicular(aDepth)); + const basegfx::B3DVector aNormalRight(aRight.getPerpendicular(aDepth)); // create smoothed in-between normal - ::basegfx::B3DVector aNewNormal(aNormalLeft + aNormalRight); + basegfx::B3DVector aNewNormal(aNormalLeft + aNormalRight); aNewNormal.normalize(); // set as new normal at polygons @@ -318,23 +318,23 @@ namespace } } - void impMixNormals(::basegfx::B3DPolyPolygon& rPolA, const ::basegfx::B3DPolyPolygon& rPolB, double fWeightA) + void impMixNormals(basegfx::B3DPolyPolygon& rPolA, const basegfx::B3DPolyPolygon& rPolB, double fWeightA) { const double fWeightB(1.0 - fWeightA); OSL_ENSURE(rPolA.count() == rPolB.count(), "sdrExtrudePrimitive3D: unequally sized polygons (!)"); for(sal_uInt32 a(0L); a < rPolA.count(); a++) { - ::basegfx::B3DPolygon aSubA(rPolA.getB3DPolygon(a)); - const ::basegfx::B3DPolygon aSubB(rPolB.getB3DPolygon(a)); + basegfx::B3DPolygon aSubA(rPolA.getB3DPolygon(a)); + const basegfx::B3DPolygon aSubB(rPolB.getB3DPolygon(a)); OSL_ENSURE(aSubA.count() == aSubB.count(), "sdrExtrudePrimitive3D: unequally sized polygons (!)"); const sal_uInt32 nPointCount(aSubA.count()); for(sal_uInt32 b(0L); b < nPointCount; b++) { - const ::basegfx::B3DVector aVA(aSubA.getNormal(b) * fWeightA); - const ::basegfx::B3DVector aVB(aSubB.getNormal(b) * fWeightB); - ::basegfx::B3DVector aVNew(aVA + aVB); + const basegfx::B3DVector aVA(aSubA.getNormal(b) * fWeightA); + const basegfx::B3DVector aVB(aSubB.getNormal(b) * fWeightB); + basegfx::B3DVector aVNew(aVA + aVB); aVNew.normalize(); aSubA.setNormal(b, aVNew); } @@ -349,25 +349,25 @@ namespace namespace drawinglayer { - namespace primitive + namespace primitive3d { - void createLatheSlices(sliceVector& rSliceVector, const ::basegfx::B2DPolyPolygon& rSource, + void createLatheSlices(sliceVector& rSliceVector, const basegfx::B2DPolyPolygon& rSource, double fBackScale, double fDiagonal, double fRotation, sal_uInt32 nSteps, bool bCharacterMode, bool bCloseFront, bool bCloseBack) { - if(::basegfx::fTools::equalZero(fRotation) || 0L == nSteps) + if(basegfx::fTools::equalZero(fRotation) || 0L == nSteps) { // no rotation or no steps, just one plane - rSliceVector.push_back(slice(rSource, ::basegfx::B3DHomMatrix())); + rSliceVector.push_back(slice(rSource, basegfx::B3DHomMatrix())); } else { - const bool bBackScale(!::basegfx::fTools::equal(fBackScale, 1.0)); - const bool bClosedRotation(!bBackScale && ::basegfx::fTools::equal(fRotation, F_2PI)); - ::basegfx::B2DPolyPolygon aFront(rSource); - ::basegfx::B2DPolyPolygon aBack(rSource); - ::basegfx::B3DHomMatrix aTransformBack; - ::basegfx::B2DPolyPolygon aOuterBack; + const bool bBackScale(!basegfx::fTools::equal(fBackScale, 1.0)); + const bool bClosedRotation(!bBackScale && basegfx::fTools::equal(fRotation, F_2PI)); + basegfx::B2DPolyPolygon aFront(rSource); + basegfx::B2DPolyPolygon aBack(rSource); + basegfx::B3DHomMatrix aTransformBack; + basegfx::B2DPolyPolygon aOuterBack; if(bClosedRotation) { @@ -377,7 +377,7 @@ namespace drawinglayer if(bBackScale) { // avoid null zoom - if(::basegfx::fTools::equalZero(fBackScale)) + if(basegfx::fTools::equalZero(fBackScale)) { fBackScale = 0.000001; } @@ -388,7 +388,7 @@ namespace drawinglayer if(bCloseFront || bCloseBack) { - const ::basegfx::B2DRange aBaseRange(::basegfx::tools::getRange(aFront)); + const basegfx::B2DRange aBaseRange(basegfx::tools::getRange(aFront)); const double fOuterLength(aBaseRange.getMaxX() * fRotation); const double fInnerLength(aBaseRange.getMinX() * fRotation); const double fAverageLength((fOuterLength + fInnerLength) * 0.5); @@ -396,9 +396,9 @@ namespace drawinglayer if(bCloseFront) { const double fOffsetLen((fAverageLength / 12.0) * fDiagonal); - ::basegfx::B2DPolyPolygon aOuterFront; + basegfx::B2DPolyPolygon aOuterFront; impGetOuterPolyPolygon(aFront, aOuterFront, fOffsetLen, bCharacterMode); - ::basegfx::B3DHomMatrix aTransform; + basegfx::B3DHomMatrix aTransform; aTransform.translate(0.0, 0.0, fOffsetLen); rSliceVector.push_back(slice(aOuterFront, aTransform, SLICETYPE_FRONTCAP)); } @@ -415,7 +415,7 @@ namespace drawinglayer // add start polygon (a = 0L) if(!bClosedRotation) { - rSliceVector.push_back(slice(aFront, ::basegfx::B3DHomMatrix())); + rSliceVector.push_back(slice(aFront, basegfx::B3DHomMatrix())); } // create segments (a + 1 .. nSteps) @@ -424,8 +424,8 @@ namespace drawinglayer for(sal_uInt32 a(0L); a < nSteps; a++) { const double fStep((double)(a + 1L) * fStepSize); - ::basegfx::B2DPolyPolygon aNewPoly(bBackScale ? ::basegfx::tools::interpolate(aFront, aBack, fStep) : aFront); - ::basegfx::B3DHomMatrix aNewMat; + basegfx::B2DPolyPolygon aNewPoly(bBackScale ? basegfx::tools::interpolate(aFront, aBack, fStep) : aFront); + basegfx::B3DHomMatrix aNewMat; aNewMat.rotate(0.0, fRotation * fStep, 0.0); rSliceVector.push_back(slice(aNewPoly, aNewMat)); } @@ -437,29 +437,29 @@ namespace drawinglayer } } - void createExtrudeSlices(sliceVector& rSliceVector, const ::basegfx::B2DPolyPolygon& rSource, + void createExtrudeSlices(sliceVector& rSliceVector, const basegfx::B2DPolyPolygon& rSource, double fBackScale, double fDiagonal, double fDepth, bool bCharacterMode, bool bCloseFront, bool bCloseBack) { - if(::basegfx::fTools::equalZero(fDepth)) + if(basegfx::fTools::equalZero(fDepth)) { // no depth, just one plane - rSliceVector.push_back(slice(rSource, ::basegfx::B3DHomMatrix())); + rSliceVector.push_back(slice(rSource, basegfx::B3DHomMatrix())); } else { // there is depth, create Polygons for front,back and their default depth positions - ::basegfx::B2DPolyPolygon aFront(rSource); - ::basegfx::B2DPolyPolygon aBack(rSource); - const bool bBackScale(!::basegfx::fTools::equal(fBackScale, 1.0)); + basegfx::B2DPolyPolygon aFront(rSource); + basegfx::B2DPolyPolygon aBack(rSource); + const bool bBackScale(!basegfx::fTools::equal(fBackScale, 1.0)); double fZFront(fDepth); // default depth for aFront double fZBack(0.0); // default depth for aBack - ::basegfx::B2DPolyPolygon aOuterBack; + basegfx::B2DPolyPolygon aOuterBack; if(bBackScale) { // avoid null zoom - if(::basegfx::fTools::equalZero(fBackScale)) + if(basegfx::fTools::equalZero(fBackScale)) { fBackScale = 0.000001; } @@ -472,9 +472,9 @@ namespace drawinglayer { const double fOffset(fDepth * fDiagonal * 0.5); fZFront = fDepth - fOffset; - ::basegfx::B2DPolyPolygon aOuterFront; + basegfx::B2DPolyPolygon aOuterFront; impGetOuterPolyPolygon(aFront, aOuterFront, fOffset, bCharacterMode); - ::basegfx::B3DHomMatrix aTransformFront; + basegfx::B3DHomMatrix aTransformFront; aTransformFront.translate(0.0, 0.0, fDepth); rSliceVector.push_back(slice(aOuterFront, aTransformFront, SLICETYPE_FRONTCAP)); } @@ -488,7 +488,7 @@ namespace drawinglayer // add front and back polygons at evtl. changed depths { - ::basegfx::B3DHomMatrix aTransformA, aTransformB; + basegfx::B3DHomMatrix aTransformA, aTransformB; aTransformA.translate(0.0, 0.0, fZFront); rSliceVector.push_back(slice(aFront, aTransformA)); @@ -499,12 +499,12 @@ namespace drawinglayer if(bCloseBack) { - rSliceVector.push_back(slice(aOuterBack, ::basegfx::B3DHomMatrix(), SLICETYPE_BACKCAP)); + rSliceVector.push_back(slice(aOuterBack, basegfx::B3DHomMatrix(), SLICETYPE_BACKCAP)); } } } - void extractLinesFromSlice(::basegfx::B3DPolyPolygon& rLine, const sliceVector& rSliceVector, bool bClosed) + void extractLinesFromSlice(basegfx::B3DPolyPolygon& rLine, const sliceVector& rSliceVector, bool bClosed) { const sal_uInt32 nNumSlices(rSliceVector.size()); @@ -517,17 +517,17 @@ namespace drawinglayer } // horizontal - const ::basegfx::B3DPolyPolygon& aFirstPolyPolygon(rSliceVector[0L].getB3DPolyPolygon()); + const basegfx::B3DPolyPolygon& aFirstPolyPolygon(rSliceVector[0L].getB3DPolyPolygon()); const sal_uInt32 nPolygonCount(aFirstPolyPolygon.count()); for(sal_uInt32 b(0L); b < nPolygonCount; b++) { - const ::basegfx::B3DPolygon& aFirstPolygon(aFirstPolyPolygon.getB3DPolygon(0L)); + const basegfx::B3DPolygon& aFirstPolygon(aFirstPolyPolygon.getB3DPolygon(0L)); const sal_uInt32 nPointCount(aFirstPolygon.count()); for(sal_uInt32 c(0L); c < nPointCount; c++) { - ::basegfx::B3DPolygon aNew; + basegfx::B3DPolygon aNew; for(sal_uInt32 d(0L); d < nNumSlices; d++) { @@ -541,9 +541,9 @@ namespace drawinglayer } } - void extractPlanesFromSlice(::std::vector< ::basegfx::B3DPolyPolygon >& rFill, const sliceVector& rSliceVector, + void extractPlanesFromSlice(::std::vector< basegfx::B3DPolyPolygon >& rFill, const sliceVector& rSliceVector, bool bCreateNormals, bool bSmoothHorizontalNormals, bool bSmoothNormals, bool bSmoothLids, bool bClosed, - double fSmoothNormalsMix, double fSmoothLidsMix, bool bCreateTextureCoordinates, const ::basegfx::B2DHomMatrix& rTexTransform) + double fSmoothNormalsMix, double fSmoothLidsMix, bool bCreateTextureCoordinates, const basegfx::B2DHomMatrix& rTexTransform) { const sal_uInt32 nNumSlices(rSliceVector.size()); @@ -551,7 +551,7 @@ namespace drawinglayer { // common parameters const sal_uInt32 nLoopCount(bClosed ? nNumSlices : nNumSlices - 1L); - ::basegfx::B3DPolyPolygon aEdgeRounding; + basegfx::B3DPolyPolygon aEdgeRounding; sal_uInt32 a; // tetxture parameters @@ -560,37 +560,37 @@ namespace drawinglayer double fTexStart(0.0); double fTexStop(1.0); ::std::vector<double> aTexHeightArray; - ::basegfx::B3DRange aTexRangeFront; - ::basegfx::B3DRange aTexRangeBack; + basegfx::B3DRange aTexRangeFront; + basegfx::B3DRange aTexRangeBack; if(bCreateTextureCoordinates) { - aTexRangeFront = ::basegfx::tools::getRange(rSliceVector[0L].getB3DPolyPolygon()); - aTexRangeBack = ::basegfx::tools::getRange(rSliceVector[nNumSlices - 1L].getB3DPolyPolygon()); + aTexRangeFront = basegfx::tools::getRange(rSliceVector[0L].getB3DPolyPolygon()); + aTexRangeBack = basegfx::tools::getRange(rSliceVector[nNumSlices - 1L].getB3DPolyPolygon()); if(aTexRangeBack.getDepth() > aTexRangeBack.getWidth()) { // last polygon is rotated so that depth is bigger than width, exchange X and Z // for making applyDefaultTextureCoordinatesParallel use Z instead of X for // horizontal texture coordinate - aTexRangeBack = ::basegfx::B3DRange( + aTexRangeBack = basegfx::B3DRange( aTexRangeBack.getMinZ(), aTexRangeBack.getMinY(), aTexRangeBack.getMinX(), aTexRangeBack.getMaxZ(), aTexRangeBack.getMaxY(), aTexRangeBack.getMaxX()); } - ::basegfx::B3DPoint aCenter(::basegfx::tools::getRange(rSliceVector[0L].getB3DPolyPolygon()).getCenter()); + basegfx::B3DPoint aCenter(basegfx::tools::getRange(rSliceVector[0L].getB3DPolyPolygon()).getCenter()); for(sal_uInt32 a(0L); a < nLoopCount; a++) { - const ::basegfx::B3DPoint aNextCenter(::basegfx::tools::getRange(rSliceVector[(a + 1L) % nNumSlices].getB3DPolyPolygon()).getCenter()); - const double fLength(::basegfx::B3DVector(aNextCenter - aCenter).getLength()); + const basegfx::B3DPoint aNextCenter(basegfx::tools::getRange(rSliceVector[(a + 1L) % nNumSlices].getB3DPolyPolygon()).getCenter()); + const double fLength(basegfx::B3DVector(aNextCenter - aCenter).getLength()); aTexHeightArray.push_back(fLength); aCenter = aNextCenter; } const double fTexHeight(::std::accumulate(aTexHeightArray.begin(), aTexHeightArray.end(), 0.0)); - if(!::basegfx::fTools::equalZero(fTexHeight)) + if(!basegfx::fTools::equalZero(fTexHeight)) { fInvTexHeight = 1.0 / fTexHeight; } @@ -601,8 +601,8 @@ namespace drawinglayer const slice& rSliceA(rSliceVector[a]); const slice& rSliceB(rSliceVector[(a + 1L) % nNumSlices]); const bool bAcceptPair(SLICETYPE_REGULAR == rSliceA.getSliceType() && SLICETYPE_REGULAR == rSliceB.getSliceType()); - ::basegfx::B3DPolyPolygon aPolA(rSliceA.getB3DPolyPolygon()); - ::basegfx::B3DPolyPolygon aPolB(rSliceB.getB3DPolyPolygon()); + basegfx::B3DPolyPolygon aPolA(rSliceA.getB3DPolyPolygon()); + basegfx::B3DPolyPolygon aPolB(rSliceB.getB3DPolyPolygon()); if(bAcceptPair) { @@ -614,22 +614,22 @@ namespace drawinglayer { const sal_uInt32 nIndPrev((a + nNumSlices - 1L) % nNumSlices); const slice& rSlicePrev(rSliceVector[nIndPrev]); - ::basegfx::B3DPolyPolygon aPrev(rSlicePrev.getB3DPolyPolygon()); - ::basegfx::B3DPolyPolygon aPolAA(rSliceA.getB3DPolyPolygon()); + basegfx::B3DPolyPolygon aPrev(rSlicePrev.getB3DPolyPolygon()); + basegfx::B3DPolyPolygon aPolAA(rSliceA.getB3DPolyPolygon()); if(SLICETYPE_FRONTCAP == rSlicePrev.getSliceType()) { - ::basegfx::B3DPolyPolygon aFront(rSlicePrev.getB3DPolyPolygon()); + basegfx::B3DPolyPolygon aFront(rSlicePrev.getB3DPolyPolygon()); const bool bHasSlant(aPolAA != aPrev); if(bCreateTextureCoordinates) { - aFront = ::basegfx::tools::applyDefaultTextureCoordinatesParallel(aFront, aTexRangeFront); + aFront = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFront, aTexRangeFront); } if(bCreateNormals) { - const ::basegfx::B3DVector aNormal(aFront.count() ? -aFront.getB3DPolygon(0L).getNormal() : ::basegfx::B3DVector(0.0, 0.0, -1.0)); + const basegfx::B3DVector aNormal(aFront.count() ? -aFront.getB3DPolygon(0L).getNormal() : basegfx::B3DVector(0.0, 0.0, -1.0)); impSetNormal(aFront, aNormal); if(bHasSlant) @@ -704,22 +704,22 @@ namespace drawinglayer { const sal_uInt32 nIndNext((a + 2L) % nNumSlices); const slice& rSliceNext(rSliceVector[nIndNext]); - ::basegfx::B3DPolyPolygon aNext(rSliceNext.getB3DPolyPolygon()); - ::basegfx::B3DPolyPolygon aPolBB(rSliceB.getB3DPolyPolygon()); + basegfx::B3DPolyPolygon aNext(rSliceNext.getB3DPolyPolygon()); + basegfx::B3DPolyPolygon aPolBB(rSliceB.getB3DPolyPolygon()); if(SLICETYPE_BACKCAP == rSliceNext.getSliceType()) { - ::basegfx::B3DPolyPolygon aBack(rSliceNext.getB3DPolyPolygon()); + basegfx::B3DPolyPolygon aBack(rSliceNext.getB3DPolyPolygon()); const bool bHasSlant(aPolBB != aNext); if(bCreateTextureCoordinates) { - aBack = ::basegfx::tools::applyDefaultTextureCoordinatesParallel(aBack, aTexRangeBack); + aBack = basegfx::tools::applyDefaultTextureCoordinatesParallel(aBack, aTexRangeBack); } if(bCreateNormals) { - const ::basegfx::B3DVector aNormal(aBack.count() ? aBack.getB3DPolygon(0L).getNormal() : ::basegfx::B3DVector(0.0, 0.0, 1.0)); + const basegfx::B3DVector aNormal(aBack.count() ? aBack.getB3DPolygon(0L).getNormal() : basegfx::B3DVector(0.0, 0.0, 1.0)); impSetNormal(aBack, aNormal); if(bHasSlant) @@ -812,12 +812,12 @@ namespace drawinglayer for(a = 0L; a < aEdgeRounding.count(); a++) { - rFill.push_back(::basegfx::B3DPolyPolygon(aEdgeRounding.getB3DPolygon(a))); + rFill.push_back(basegfx::B3DPolyPolygon(aEdgeRounding.getB3DPolygon(a))); } } } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx index 764b0c30d650..117274b3ca42 100644 --- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrextrudeprimitive3d.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2006-06-02 13:58:02 $ + * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -69,9 +69,9 @@ namespace drawinglayer { - namespace primitive + namespace primitive3d { - void sdrExtrudePrimitive3D::decompose(primitiveVector& rTarget, const ::drawinglayer::geometry::viewInformation& rViewInformation) + void sdrExtrudePrimitive3D::decompose(primitiveVector3D& rTarget) { // get slices const sliceVector& rSliceVector = getSlices(); @@ -82,22 +82,22 @@ namespace drawinglayer if(getSdrLFSAttribute().getFill()) { sal_uInt32 a; - ::basegfx::B3DRange aRange; + basegfx::B3DRange aRange; // decide what to create const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind()); const bool bCreateTextureCoordiantesX(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionX()); const bool bCreateTextureCoordiantesY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY()); double fRelativeTextureWidth(1.0); - ::basegfx::B2DHomMatrix aTexTransform; + basegfx::B2DHomMatrix aTexTransform; if(bCreateTextureCoordiantesX || bCreateTextureCoordiantesY) { - const ::basegfx::B2DPolygon aFirstPolygon(maCorrectedPolyPolygon.getB2DPolygon(0L)); - const double fFrontLength(::basegfx::tools::getLength(aFirstPolygon)); - const double fFrontArea(::basegfx::tools::getArea(aFirstPolygon)); + const basegfx::B2DPolygon aFirstPolygon(maCorrectedPolyPolygon.getB2DPolygon(0L)); + const double fFrontLength(basegfx::tools::getLength(aFirstPolygon)); + const double fFrontArea(basegfx::tools::getArea(aFirstPolygon)); const double fSqrtFrontArea(sqrt(fFrontArea)); - fRelativeTextureWidth = ::basegfx::fTools::equalZero(fSqrtFrontArea) ? 1.0 : fFrontLength / fSqrtFrontArea; + fRelativeTextureWidth = basegfx::fTools::equalZero(fSqrtFrontArea) ? 1.0 : fFrontLength / fSqrtFrontArea; fRelativeTextureWidth = (double)((sal_uInt32)(fRelativeTextureWidth - 0.5)); if(fRelativeTextureWidth < 1.0) @@ -112,7 +112,7 @@ namespace drawinglayer } // create geometry - ::std::vector< ::basegfx::B3DPolyPolygon > aFill; + ::std::vector< basegfx::B3DPolyPolygon > aFill; extractPlanesFromSlice(aFill, rSliceVector, bCreateNormals, mbSmoothHorizontalNormals, mbSmoothNormals, mbSmoothLids, false, 0.5, 0.6, bCreateTextureCoordiantesX || bCreateTextureCoordiantesY, aTexTransform); @@ -120,7 +120,7 @@ namespace drawinglayer // get full range for(a = 0L; a < aFill.size(); a++) { - aRange.expand(::basegfx::tools::getRange(aFill[a])); + aRange.expand(basegfx::tools::getRange(aFill[a])); } // normal creation @@ -128,11 +128,11 @@ namespace drawinglayer if(::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind()) { // create sphere normals - const ::basegfx::B3DPoint aCenter(aRange.getCenter()); + const basegfx::B3DPoint aCenter(aRange.getCenter()); for(a = 0L; a < aFill.size(); a++) { - aFill[a] = ::basegfx::tools::applyDefaultNormalsSphere(aFill[a], aCenter); + aFill[a] = basegfx::tools::applyDefaultNormalsSphere(aFill[a], aCenter); } } else if(::com::sun::star::drawing::NormalsKind_FLAT == getSdr3DObjectAttribute().getNormalsKind()) @@ -148,7 +148,7 @@ namespace drawinglayer // invert normals for(a = 0L; a < aFill.size(); a++) { - aFill[a] = ::basegfx::tools::invertNormals(aFill[a]); + aFill[a] = basegfx::tools::invertNormals(aFill[a]); } } } @@ -169,23 +169,23 @@ namespace drawinglayer for(a = 0L; a < aFill.size(); a++) { - aFill[a] = ::basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill[a], aRange, bParallelX, bParallelY); + aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill[a], aRange, bParallelX, bParallelY); } } if(bSphereX || bSphereY) { // apply spherical texture coordinates in X and/or Y - const ::basegfx::B3DPoint aCenter(aRange.getCenter()); + const basegfx::B3DPoint aCenter(aRange.getCenter()); for(a = 0L; a < aFill.size(); a++) { - aFill[a] = ::basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill[a], aCenter, bSphereX, bSphereY); + aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill[a], aCenter, bSphereX, bSphereY); } } // transform texture coordinates to texture size - ::basegfx::B2DHomMatrix aTexMatrix; + basegfx::B2DHomMatrix aTexMatrix; aTexMatrix.scale(maTextureSize.getX(), maTextureSize.getY()); for(a = 0L; a < aFill.size(); a++) @@ -204,7 +204,7 @@ namespace drawinglayer // add line if(getSdrLFSAttribute().getLine()) { - ::basegfx::B3DPolyPolygon aLine; + basegfx::B3DPolyPolygon aLine; extractLinesFromSlice(aLine, rSliceVector, false); add3DPolyPolygonLinePrimitive(aLine, maTransform, rTarget, *maSdrLFSAttribute.getLine()); } @@ -223,8 +223,8 @@ namespace drawinglayer // prepare the polygon maCorrectedPolyPolygon.removeDoublePoints(); - maCorrectedPolyPolygon = ::basegfx::tools::correctOrientations(maCorrectedPolyPolygon); - maCorrectedPolyPolygon = ::basegfx::tools::correctOutmostPolygon(maCorrectedPolyPolygon); + maCorrectedPolyPolygon = basegfx::tools::correctOrientations(maCorrectedPolyPolygon); + maCorrectedPolyPolygon = basegfx::tools::correctOutmostPolygon(maCorrectedPolyPolygon); // prepare slices as geometry createExtrudeSlices(maSlices, maCorrectedPolyPolygon, mfBackScale, mfDiagonal, mfDepth, mbCharacterMode, mbCloseFront, mbCloseBack); @@ -242,11 +242,11 @@ namespace drawinglayer } sdrExtrudePrimitive3D::sdrExtrudePrimitive3D( - const ::basegfx::B3DHomMatrix& rTransform, - const ::basegfx::B2DVector& rTextureSize, - const sdrLineFillShadowAttribute& rSdrLFSAttribute, - const sdr3DObjectAttribute& rSdr3DObjectAttribute, - const ::basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::B3DHomMatrix& rTransform, + const basegfx::B2DVector& rTextureSize, + const attribute::sdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::sdr3DObjectAttribute& rSdr3DObjectAttribute, + const basegfx::B2DPolyPolygon& rPolyPolygon, double fDepth, double fDiagonal, double fBackScale, @@ -269,17 +269,17 @@ namespace drawinglayer mbCloseBack(bCloseBack) { // make sure depth is positive - if(::basegfx::fTools::lessOrEqual(mfDepth, 0.0)) + if(basegfx::fTools::lessOrEqual(mfDepth, 0.0)) { mfDepth = 0.0; } // make sure the percentage value mfDiagonal is between 0.0 and 1.0 - if(::basegfx::fTools::lessOrEqual(mfDiagonal, 0.0)) + if(basegfx::fTools::lessOrEqual(mfDiagonal, 0.0)) { mfDiagonal = 0.0; } - else if(::basegfx::fTools::moreOrEqual(mfDiagonal, 1.0)) + else if(basegfx::fTools::moreOrEqual(mfDiagonal, 1.0)) { mfDiagonal = 1.0; } @@ -301,7 +301,7 @@ namespace drawinglayer { } - bool sdrExtrudePrimitive3D::operator==(const basePrimitive& rPrimitive) const + bool sdrExtrudePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const { if(sdrPrimitive3D::operator==(rPrimitive)) { @@ -326,7 +326,7 @@ namespace drawinglayer return CreatePrimitiveID('S', 'X', 'T', '3'); } - ::basegfx::B3DRange sdrExtrudePrimitive3D::get3DRange(const ::drawinglayer::geometry::viewInformation& rViewInformation) const + basegfx::B3DRange sdrExtrudePrimitive3D::get3DRange() const { // use defaut from sdrPrimitive3D which uses transformation expanded by line width/2 // The parent implementation which uses the ranges of the decomposition would be more @@ -334,9 +334,9 @@ namespace drawinglayer // the range of the non-transformed geometry and transform it then. This leads to different // ranges where the new method is more correct, but the need to keep the old behaviour // has priority here. - return get3DRangeFromSlices(getSlices(), rViewInformation); + return get3DRangeFromSlices(getSlices()); } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx index 0a1bc369001d..5ef59dbeedec 100644 --- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrlatheprimitive3d.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2006-06-02 13:58:02 $ + * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -65,29 +65,29 @@ namespace drawinglayer { - namespace primitive + namespace primitive3d { - void sdrLathePrimitive3D::decompose(primitiveVector& rTarget, const ::drawinglayer::geometry::viewInformation& rViewInformation) + void sdrLathePrimitive3D::decompose(primitiveVector3D& rTarget) { // get slices const sliceVector& rSliceVector = getSlices(); if(rSliceVector.size()) { - const bool bBackScale(!::basegfx::fTools::equal(mfBackScale, 1.0)); - const bool bClosedRotation(!bBackScale && mnHorizontalSegments && ::basegfx::fTools::equal(mfRotation, F_2PI)); + const bool bBackScale(!basegfx::fTools::equal(mfBackScale, 1.0)); + const bool bClosedRotation(!bBackScale && mnHorizontalSegments && basegfx::fTools::equal(mfRotation, F_2PI)); // add fill if(getSdrLFSAttribute().getFill()) { sal_uInt32 a; - ::basegfx::B3DRange aRange; + basegfx::B3DRange aRange; // decide what to create const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind()); const bool bCreateTextureCoordiantesX(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionX()); const bool bCreateTextureCoordiantesY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY()); - ::basegfx::B2DHomMatrix aTexTransform; + basegfx::B2DHomMatrix aTexTransform; if(bCreateTextureCoordiantesX || bCreateTextureCoordiantesY) { @@ -102,7 +102,7 @@ namespace drawinglayer } // create geometry - ::std::vector< ::basegfx::B3DPolyPolygon > aFill; + ::std::vector< basegfx::B3DPolyPolygon > aFill; extractPlanesFromSlice(aFill, rSliceVector, bCreateNormals, mbSmoothHorizontalNormals, mbSmoothNormals, mbSmoothLids, bClosedRotation, 0.85, 0.6, bCreateTextureCoordiantesX || bCreateTextureCoordiantesY, aTexTransform); @@ -110,7 +110,7 @@ namespace drawinglayer // get full range for(a = 0L; a < aFill.size(); a++) { - aRange.expand(::basegfx::tools::getRange(aFill[a])); + aRange.expand(basegfx::tools::getRange(aFill[a])); } // normal creation @@ -118,11 +118,11 @@ namespace drawinglayer if(::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind()) { // create sphere normals - const ::basegfx::B3DPoint aCenter(aRange.getCenter()); + const basegfx::B3DPoint aCenter(aRange.getCenter()); for(a = 0L; a < aFill.size(); a++) { - aFill[a] = ::basegfx::tools::applyDefaultNormalsSphere(aFill[a], aCenter); + aFill[a] = basegfx::tools::applyDefaultNormalsSphere(aFill[a], aCenter); } } else if(::com::sun::star::drawing::NormalsKind_FLAT == getSdr3DObjectAttribute().getNormalsKind()) @@ -138,7 +138,7 @@ namespace drawinglayer // invert normals for(a = 0L; a < aFill.size(); a++) { - aFill[a] = ::basegfx::tools::invertNormals(aFill[a]); + aFill[a] = basegfx::tools::invertNormals(aFill[a]); } } } @@ -159,23 +159,23 @@ namespace drawinglayer for(a = 0L; a < aFill.size(); a++) { - aFill[a] = ::basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill[a], aRange, bParallelX, bParallelY); + aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill[a], aRange, bParallelX, bParallelY); } } if(bSphereX || bSphereY) { // apply spherical texture coordinates in X and/or Y - const ::basegfx::B3DPoint aCenter(aRange.getCenter()); + const basegfx::B3DPoint aCenter(aRange.getCenter()); for(a = 0L; a < aFill.size(); a++) { - aFill[a] = ::basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill[a], aCenter, bSphereX, bSphereY); + aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill[a], aCenter, bSphereX, bSphereY); } } // transform texture coordinates to texture size - ::basegfx::B2DHomMatrix aTexMatrix; + basegfx::B2DHomMatrix aTexMatrix; aTexMatrix.scale(maTextureSize.getX(), maTextureSize.getY()); for(a = 0L; a < aFill.size(); a++) @@ -194,7 +194,7 @@ namespace drawinglayer // add line if(getSdrLFSAttribute().getLine()) { - ::basegfx::B3DPolyPolygon aLine; + basegfx::B3DPolyPolygon aLine; extractLinesFromSlice(aLine, rSliceVector, bClosedRotation); add3DPolyPolygonLinePrimitive(aLine, maTransform, rTarget, *maSdrLFSAttribute.getLine()); } @@ -210,20 +210,20 @@ namespace drawinglayer void sdrLathePrimitive3D::impCreateSlices() { // prepare the polygon - ::basegfx::B2DPolyPolygon aCandidate(::basegfx::tools::adaptiveSubdivideByDistance(maPolyPolygon)); + basegfx::B2DPolyPolygon aCandidate(basegfx::tools::adaptiveSubdivideByDistance(maPolyPolygon)); aCandidate.removeDoublePoints(); - aCandidate = ::basegfx::tools::correctOrientations(aCandidate); - aCandidate = ::basegfx::tools::correctOutmostPolygon(aCandidate); + aCandidate = basegfx::tools::correctOrientations(aCandidate); + aCandidate = basegfx::tools::correctOutmostPolygon(aCandidate); // check edge count of first sub-polygon. If different, reSegment polyPolygon. This ensures // that for polyPolygons, the subPolys 1..n only get reSegmented when polygon 0L is different // at all (and not always) - const ::basegfx::B2DPolygon aSubCandidate(aCandidate.getB2DPolygon(0L)); + const basegfx::B2DPolygon aSubCandidate(aCandidate.getB2DPolygon(0L)); const sal_uInt32 nSubEdgeCount(aSubCandidate.isClosed() ? aSubCandidate.count() : (aSubCandidate.count() ? aSubCandidate.count() - 1L : 0L)); if(nSubEdgeCount != mnVerticalSegments) { - aCandidate = ::basegfx::tools::reSegmentPolyPolygon(aCandidate, mnVerticalSegments); + aCandidate = basegfx::tools::reSegmentPolyPolygon(aCandidate, mnVerticalSegments); } // prepare slices as geometry @@ -242,11 +242,11 @@ namespace drawinglayer } sdrLathePrimitive3D::sdrLathePrimitive3D( - const ::basegfx::B3DHomMatrix& rTransform, - const ::basegfx::B2DVector& rTextureSize, - const sdrLineFillShadowAttribute& rSdrLFSAttribute, - const sdr3DObjectAttribute& rSdr3DObjectAttribute, - const ::basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::B3DHomMatrix& rTransform, + const basegfx::B2DVector& rTextureSize, + const attribute::sdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::sdr3DObjectAttribute& rSdr3DObjectAttribute, + const basegfx::B2DPolyPolygon& rPolyPolygon, sal_uInt32 nHorizontalSegments, sal_uInt32 nVerticalSegments, double fDiagonal, @@ -273,17 +273,17 @@ namespace drawinglayer mbCloseBack(bCloseBack) { // make sure Rotation is positive - if(::basegfx::fTools::lessOrEqual(mfRotation, 0.0)) + if(basegfx::fTools::lessOrEqual(mfRotation, 0.0)) { mfRotation = 0.0; } // make sure the percentage value mfDiagonal is between 0.0 and 1.0 - if(::basegfx::fTools::lessOrEqual(mfDiagonal, 0.0)) + if(basegfx::fTools::lessOrEqual(mfDiagonal, 0.0)) { mfDiagonal = 0.0; } - else if(::basegfx::fTools::moreOrEqual(mfDiagonal, 1.0)) + else if(basegfx::fTools::moreOrEqual(mfDiagonal, 1.0)) { mfDiagonal = 1.0; } @@ -305,7 +305,7 @@ namespace drawinglayer { } - bool sdrLathePrimitive3D::operator==(const basePrimitive& rPrimitive) const + bool sdrLathePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const { if(sdrPrimitive3D::operator==(rPrimitive)) { @@ -332,7 +332,7 @@ namespace drawinglayer return CreatePrimitiveID('S', 'L', 'A', '3'); } - ::basegfx::B3DRange sdrLathePrimitive3D::get3DRange(const ::drawinglayer::geometry::viewInformation& rViewInformation) const + basegfx::B3DRange sdrLathePrimitive3D::get3DRange() const { // use defaut from sdrPrimitive3D which uses transformation expanded by line width/2 // The parent implementation which uses the ranges of the decomposition would be more @@ -340,9 +340,9 @@ namespace drawinglayer // the range of the non-transformed geometry and transform it then. This leads to different // ranges where the new method is more correct, but the need to keep the old behaviour // has priority here. - return get3DRangeFromSlices(getSlices(), rViewInformation); + return get3DRangeFromSlices(getSlices()); } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx index 7d3f481c4004..bc7f5a7878bc 100644 --- a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrprimitive3d.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2006-06-02 13:58:03 $ + * last change: $Author: aw $ $Date: 2006-08-09 16:51:15 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,8 +37,8 @@ #include <drawinglayer/primitive3d/sdrprimitive3d.hxx> #endif -#ifndef _DRAWINGLAYER_PRIMITIVE_SDRATTRIBUTE_HXX -#include <drawinglayer/primitive/sdrattribute.hxx> +#ifndef _DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX +#include <drawinglayer/attribute/sdrattribute.hxx> #endif #ifndef _BGFX_POLYPOLYGON_B3DPOLYGONTOOLS_HXX @@ -49,18 +49,18 @@ namespace drawinglayer { - namespace primitive + namespace primitive3d { - ::basegfx::B3DRange sdrPrimitive3D::getStandard3DRange(const ::drawinglayer::geometry::viewInformation& rViewInformation) const + basegfx::B3DRange sdrPrimitive3D::getStandard3DRange() const { - ::basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); + basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); aUnitRange.transform(getTransform()); if(maSdrLFSAttribute.getLine()) { - const sdrLineAttribute& rLine = *maSdrLFSAttribute.getLine(); + const attribute::sdrLineAttribute& rLine = *maSdrLFSAttribute.getLine(); - if(rLine.isVisible() && !::basegfx::fTools::equalZero(rLine.getWidth())) + if(rLine.isVisible() && !basegfx::fTools::equalZero(rLine.getWidth())) { // expand by hald LineWidth as tube radius aUnitRange.grow(rLine.getWidth() / 2.0); @@ -70,24 +70,24 @@ namespace drawinglayer return aUnitRange; } - ::basegfx::B3DRange sdrPrimitive3D::get3DRangeFromSlices(const sliceVector& rSlices, const ::drawinglayer::geometry::viewInformation& rViewInformation) const + basegfx::B3DRange sdrPrimitive3D::get3DRangeFromSlices(const sliceVector& rSlices) const { - ::basegfx::B3DRange aRetval; + basegfx::B3DRange aRetval; if(rSlices.size()) { for(sal_uInt32 a(0L); a < rSlices.size(); a++) { - aRetval.expand(::basegfx::tools::getRange(rSlices[a].getB3DPolyPolygon())); + aRetval.expand(basegfx::tools::getRange(rSlices[a].getB3DPolyPolygon())); } aRetval.transform(getTransform()); if(maSdrLFSAttribute.getLine()) { - const sdrLineAttribute& rLine = *maSdrLFSAttribute.getLine(); + const attribute::sdrLineAttribute& rLine = *maSdrLFSAttribute.getLine(); - if(rLine.isVisible() && !::basegfx::fTools::equalZero(rLine.getWidth())) + if(rLine.isVisible() && !basegfx::fTools::equalZero(rLine.getWidth())) { // expand by hald LineWidth as tube radius aRetval.grow(rLine.getWidth() / 2.0); @@ -99,11 +99,12 @@ namespace drawinglayer } sdrPrimitive3D::sdrPrimitive3D( - const ::basegfx::B3DHomMatrix& rTransform, - const ::basegfx::B2DVector& rTextureSize, - const sdrLineFillShadowAttribute& rSdrLFSAttribute, - const sdr3DObjectAttribute& rSdr3DObjectAttribute) - : maTransform(rTransform), + const basegfx::B3DHomMatrix& rTransform, + const basegfx::B2DVector& rTextureSize, + const attribute::sdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::sdr3DObjectAttribute& rSdr3DObjectAttribute) + : basePrimitive3D(), + maTransform(rTransform), maTextureSize(rTextureSize), maSdrLFSAttribute(rSdrLFSAttribute), maSdr3DObjectAttribute(rSdr3DObjectAttribute) @@ -114,7 +115,7 @@ namespace drawinglayer { } - bool sdrPrimitive3D::operator==(const basePrimitive& rPrimitive) const + bool sdrPrimitive3D::operator==(const basePrimitive3D& rPrimitive) const { if(getID() == rPrimitive.getID()) { @@ -128,7 +129,7 @@ namespace drawinglayer return false; } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx index 7f12d62b0835..66f31f67deb8 100644 --- a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrsphereprimitive3d.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2006-06-02 13:58:03 $ + * last change: $Author: aw $ $Date: 2006-08-09 16:51:16 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -61,11 +61,11 @@ namespace drawinglayer { - namespace primitive + namespace primitive3d { - void sdrSpherePrimitive3D::decompose(primitiveVector& rTarget, const ::drawinglayer::geometry::viewInformation& rViewInformation) + void sdrSpherePrimitive3D::decompose(primitiveVector3D& rTarget) { - const ::basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); + const basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); // add fill if(getSdrLFSAttribute().getFill()) @@ -74,14 +74,14 @@ namespace drawinglayer || ::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind()); // create unit geometry - ::basegfx::B3DPolyPolygon aFill(::basegfx::tools::createSphereFillPolyPolygonFromB3DRange(aUnitRange, + basegfx::B3DPolyPolygon aFill(basegfx::tools::createSphereFillPolyPolygonFromB3DRange(aUnitRange, getHorizontalSegments(), getVerticalSegments(), bCreateNormals)); // normal inversion if(bCreateNormals && getSdr3DObjectAttribute().getNormalsInvert() && aFill.areNormalsUsed()) { // invert normals - aFill = ::basegfx::tools::invertNormals(aFill); + aFill = basegfx::tools::invertNormals(aFill); } // texture coordinates @@ -99,8 +99,8 @@ namespace drawinglayer if(bParallelX || bParallelY) { // apply parallel texture coordinates in X and/or Y - const ::basegfx::B3DRange aRange(::basegfx::tools::getRange(aFill)); - aFill = ::basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill, aRange, bParallelX, bParallelY); + const basegfx::B3DRange aRange(basegfx::tools::getRange(aFill)); + aFill = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill, aRange, bParallelX, bParallelY); } if(bSphereX || bObjectSpecificX || bSphereY || bObjectSpecificY) @@ -114,38 +114,38 @@ namespace drawinglayer // create a old version from it by rotating to old state before applying // the texture coordinates to emulate old behaviour fRelativeAngle = F_2PI * ((double)((getHorizontalSegments() >> 1L) - 1L) / (double)getHorizontalSegments()); - ::basegfx::B3DHomMatrix aRot; + basegfx::B3DHomMatrix aRot; aRot.rotate(0.0, fRelativeAngle, 0.0); aFill.transform(aRot); } // apply spherical texture coordinates in X and/or Y - const ::basegfx::B3DRange aRange(::basegfx::tools::getRange(aFill)); - const ::basegfx::B3DPoint aCenter(aRange.getCenter()); - aFill = ::basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill, aCenter, + const basegfx::B3DRange aRange(basegfx::tools::getRange(aFill)); + const basegfx::B3DPoint aCenter(aRange.getCenter()); + aFill = basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill, aCenter, bSphereX || bObjectSpecificX, bSphereY || bObjectSpecificY); if(bObjectSpecificX) { // rotate back again - ::basegfx::B3DHomMatrix aRot; + basegfx::B3DHomMatrix aRot; aRot.rotate(0.0, -fRelativeAngle, 0.0); aFill.transform(aRot); } } // transform texture coordinates to texture size - ::basegfx::B2DHomMatrix aTexMatrix; + basegfx::B2DHomMatrix aTexMatrix; aTexMatrix.scale(maTextureSize.getX(), maTextureSize.getY()); aFill.transformTextureCoordiantes(aTexMatrix); } // build vector of PolyPolygons - ::std::vector< ::basegfx::B3DPolyPolygon > a3DPolyPolygonVector; + ::std::vector< basegfx::B3DPolyPolygon > a3DPolyPolygonVector; for(sal_uInt32 a(0L); a < aFill.count(); a++) { - a3DPolyPolygonVector.push_back(::basegfx::B3DPolyPolygon(aFill.getB3DPolygon(a))); + a3DPolyPolygonVector.push_back(basegfx::B3DPolyPolygon(aFill.getB3DPolygon(a))); } // create single PolyPolygonFill primitives @@ -158,7 +158,7 @@ namespace drawinglayer // add line if(maSdrLFSAttribute.getLine()) { - ::basegfx::B3DPolyPolygon aSphere(::basegfx::tools::createSpherePolyPolygonFromB3DRange(aUnitRange, getHorizontalSegments(), getVerticalSegments())); + basegfx::B3DPolyPolygon aSphere(basegfx::tools::createSpherePolyPolygonFromB3DRange(aUnitRange, getHorizontalSegments(), getVerticalSegments())); add3DPolyPolygonLinePrimitive(aSphere, maTransform, rTarget, *maSdrLFSAttribute.getLine()); } @@ -170,10 +170,10 @@ namespace drawinglayer } sdrSpherePrimitive3D::sdrSpherePrimitive3D( - const ::basegfx::B3DHomMatrix& rTransform, - const ::basegfx::B2DVector& rTextureSize, - const sdrLineFillShadowAttribute& rSdrLFSAttribute, - const sdr3DObjectAttribute& rSdr3DObjectAttribute, + const basegfx::B3DHomMatrix& rTransform, + const basegfx::B2DVector& rTextureSize, + const attribute::sdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::sdr3DObjectAttribute& rSdr3DObjectAttribute, sal_uInt32 nHorizontalSegments, sal_uInt32 nVerticalSegments) : sdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute), mnHorizontalSegments(nHorizontalSegments), @@ -185,7 +185,7 @@ namespace drawinglayer { } - bool sdrSpherePrimitive3D::operator==(const basePrimitive& rPrimitive) const + bool sdrSpherePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const { if(sdrPrimitive3D::operator==(rPrimitive)) { @@ -202,7 +202,7 @@ namespace drawinglayer return CreatePrimitiveID('S', 'S', 'P', '3'); } - ::basegfx::B3DRange sdrSpherePrimitive3D::get3DRange(const ::drawinglayer::geometry::viewInformation& rViewInformation) const + basegfx::B3DRange sdrSpherePrimitive3D::get3DRange() const { // use defaut from sdrPrimitive3D which uses transformation expanded by line width/2 // The parent implementation which uses the ranges of the decomposition would be more @@ -210,9 +210,9 @@ namespace drawinglayer // the range of the non-transformed geometry and transform it then. This leads to different // ranges where the new method is more correct, but the need to keep the old behaviour // has priority here. - return getStandard3DRange(rViewInformation); + return getStandard3DRange(); } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive3d/shadowprimitive3d.cxx b/drawinglayer/source/primitive3d/shadowprimitive3d.cxx index 1848fc897c48..f806265eefc2 100644 --- a/drawinglayer/source/primitive3d/shadowprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/shadowprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: shadowprimitive3d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-06-02 13:58:03 $ + * last change: $Author: aw $ $Date: 2006-08-09 16:51:16 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -41,12 +41,12 @@ namespace drawinglayer { - namespace primitive + namespace primitive3d { shadowPrimitive3D::shadowPrimitive3D( - const ::basegfx::B2DHomMatrix& rShadowTransform, const ::basegfx::BColor& rShadowColor, - double fShadowTransparence, bool bShadow3D, const primitiveVector& rPrimitiveVector) - : vectorPrimitive(rPrimitiveVector), + const basegfx::B2DHomMatrix& rShadowTransform, const basegfx::BColor& rShadowColor, + double fShadowTransparence, bool bShadow3D, const primitiveVector3D& rPrimitiveVector) + : vectorPrimitive3D(rPrimitiveVector), maShadowTransform(rShadowTransform), maShadowColor(rShadowColor), mfShadowTransparence(fShadowTransparence), @@ -58,9 +58,9 @@ namespace drawinglayer { } - bool shadowPrimitive3D::operator==(const basePrimitive& rPrimitive) const + bool shadowPrimitive3D::operator==(const basePrimitive3D& rPrimitive) const { - if(vectorPrimitive::operator==(rPrimitive)) + if(vectorPrimitive3D::operator==(rPrimitive)) { const shadowPrimitive3D& rCompare = (shadowPrimitive3D&)rPrimitive; return (maShadowTransform == rCompare.maShadowTransform @@ -76,7 +76,7 @@ namespace drawinglayer { return CreatePrimitiveID('S', 'H', 'D', '3'); } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive3d/textureprimitive3d.cxx b/drawinglayer/source/primitive3d/textureprimitive3d.cxx index 135fcd5b4df3..a220c5c76ae4 100644 --- a/drawinglayer/source/primitive3d/textureprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/textureprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: textureprimitive3d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-06-02 13:58:03 $ + * last change: $Author: aw $ $Date: 2006-08-09 16:51:16 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -41,13 +41,13 @@ namespace drawinglayer { - namespace primitive + namespace primitive3d { texturePrimitive3D::texturePrimitive3D( - const primitiveVector& rPrimitiveVector, - const ::basegfx::B2DVector& rTextureSize, + const primitiveVector3D& rPrimitiveVector, + const basegfx::B2DVector& rTextureSize, bool bModulate, bool bFilter) - : vectorPrimitive(rPrimitiveVector), + : vectorPrimitive3D(rPrimitiveVector), maTextureSize(rTextureSize), mbModulate(bModulate), mbFilter(bFilter) @@ -58,9 +58,9 @@ namespace drawinglayer { } - bool texturePrimitive3D::operator==(const basePrimitive& rPrimitive) const + bool texturePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const { - if(vectorPrimitive::operator==(rPrimitive)) + if(vectorPrimitive3D::operator==(rPrimitive)) { const texturePrimitive3D& rCompare = (texturePrimitive3D&)rPrimitive; return (mbModulate == rCompare.mbModulate && mbFilter == rCompare.mbFilter); @@ -68,16 +68,16 @@ namespace drawinglayer return false; } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { - namespace primitive + namespace primitive3d { - void simpleTransparenceTexturePrimitive3D::decompose(primitiveVector& rTarget, const ::drawinglayer::geometry::viewInformation& rViewInformation) + void simpleTransparenceTexturePrimitive3D::decompose(primitiveVector3D& rTarget) { if(0.0 == mfTransparence) { @@ -87,10 +87,10 @@ namespace drawinglayer else if(mfTransparence > 0.0 && mfTransparence < 1.0) { // create transparenceTexturePrimitive3D with fixed transparence as replacement - const ::basegfx::BColor aGray(mfTransparence, mfTransparence, mfTransparence); - const fillGradientAttribute aFillGradient(GRADIENTSTYLE_LINEAR, 0.0, 0.0, 0.0, 0.0, aGray, aGray, 1); - basePrimitive* pNewTransparenceTexturePrimitive3D = new transparenceTexturePrimitive3D(aFillGradient, maPrimitiveVector, maTextureSize); - rTarget.push_back(referencedPrimitive(*pNewTransparenceTexturePrimitive3D)); + const basegfx::BColor aGray(mfTransparence, mfTransparence, mfTransparence); + const attribute::fillGradientAttribute aFillGradient(attribute::GRADIENTSTYLE_LINEAR, 0.0, 0.0, 0.0, 0.0, aGray, aGray, 1); + basePrimitive3D* pNewTransparenceTexturePrimitive3D = new transparenceTexturePrimitive3D(aFillGradient, maPrimitiveVector, maTextureSize); + rTarget.push_back(referencedPrimitive3D(*pNewTransparenceTexturePrimitive3D)); } else { @@ -100,8 +100,8 @@ namespace drawinglayer simpleTransparenceTexturePrimitive3D::simpleTransparenceTexturePrimitive3D( double fTransparence, - const primitiveVector& rPrimitiveVector) - : texturePrimitive3D(rPrimitiveVector, ::basegfx::B2DVector(), false, false), + const primitiveVector3D& rPrimitiveVector) + : texturePrimitive3D(rPrimitiveVector, basegfx::B2DVector(), false, false), mfTransparence(fTransparence) { } @@ -110,7 +110,7 @@ namespace drawinglayer { } - bool simpleTransparenceTexturePrimitive3D::operator==(const basePrimitive& rPrimitive) const + bool simpleTransparenceTexturePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const { if(texturePrimitive3D::operator==(rPrimitive)) { @@ -125,24 +125,24 @@ namespace drawinglayer { return CreatePrimitiveID('S', 'T', 'X', '3'); } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { - namespace primitive + namespace primitive3d { - void gradientTexturePrimitive3D::decompose(primitiveVector& rTarget, const ::drawinglayer::geometry::viewInformation& rViewInformation) + void gradientTexturePrimitive3D::decompose(primitiveVector3D& rTarget) { rTarget.insert(rTarget.end(), maPrimitiveVector.begin(), maPrimitiveVector.end()); } gradientTexturePrimitive3D::gradientTexturePrimitive3D( - const fillGradientAttribute& rGradient, - const primitiveVector& rPrimitiveVector, - const ::basegfx::B2DVector& rTextureSize, + const attribute::fillGradientAttribute& rGradient, + const primitiveVector3D& rPrimitiveVector, + const basegfx::B2DVector& rTextureSize, bool bModulate, bool bFilter) : texturePrimitive3D(rPrimitiveVector, rTextureSize, bModulate, bFilter), @@ -154,7 +154,7 @@ namespace drawinglayer { } - bool gradientTexturePrimitive3D::operator==(const basePrimitive& rPrimitive) const + bool gradientTexturePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const { if(texturePrimitive3D::operator==(rPrimitive)) { @@ -169,24 +169,24 @@ namespace drawinglayer { return CreatePrimitiveID('G', 'R', 'X', '3'); } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { - namespace primitive + namespace primitive3d { - void bitmapTexturePrimitive3D::decompose(primitiveVector& rTarget, const ::drawinglayer::geometry::viewInformation& rViewInformation) + void bitmapTexturePrimitive3D::decompose(primitiveVector3D& rTarget) { rTarget.insert(rTarget.end(), maPrimitiveVector.begin(), maPrimitiveVector.end()); } bitmapTexturePrimitive3D::bitmapTexturePrimitive3D( - const fillBitmapAttribute& rBitmap, - const primitiveVector& rPrimitiveVector, - const ::basegfx::B2DVector& rTextureSize, + const attribute::fillBitmapAttribute& rBitmap, + const primitiveVector3D& rPrimitiveVector, + const basegfx::B2DVector& rTextureSize, bool bModulate, bool bFilter) : texturePrimitive3D(rPrimitiveVector, rTextureSize, bModulate, bFilter), maBitmap(rBitmap) @@ -197,7 +197,7 @@ namespace drawinglayer { } - bool bitmapTexturePrimitive3D::operator==(const basePrimitive& rPrimitive) const + bool bitmapTexturePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const { if(texturePrimitive3D::operator==(rPrimitive)) { @@ -212,19 +212,19 @@ namespace drawinglayer { return CreatePrimitiveID('B', 'M', 'X', '3'); } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { - namespace primitive + namespace primitive3d { transparenceTexturePrimitive3D::transparenceTexturePrimitive3D( - const fillGradientAttribute& rGradient, - const primitiveVector& rPrimitiveVector, - const ::basegfx::B2DVector& rTextureSize) + const attribute::fillGradientAttribute& rGradient, + const primitiveVector3D& rPrimitiveVector, + const basegfx::B2DVector& rTextureSize) : gradientTexturePrimitive3D(rGradient, rPrimitiveVector, rTextureSize, false, false) { } @@ -233,7 +233,7 @@ namespace drawinglayer { } - bool transparenceTexturePrimitive3D::operator==(const basePrimitive& rPrimitive) const + bool transparenceTexturePrimitive3D::operator==(const basePrimitive3D& rPrimitive) const { return (gradientTexturePrimitive3D::operator==(rPrimitive)); } @@ -242,7 +242,7 @@ namespace drawinglayer { return CreatePrimitiveID('T', 'R', 'X', '3'); } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive3d/transformprimitive3d.cxx b/drawinglayer/source/primitive3d/transformprimitive3d.cxx index 7464ea0187fc..22fafbcac2b2 100644 --- a/drawinglayer/source/primitive3d/transformprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/transformprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: transformprimitive3d.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: aw $ $Date: 2006-06-02 14:12:39 $ + * last change: $Author: aw $ $Date: 2006-08-09 16:51:16 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -41,10 +41,10 @@ namespace drawinglayer { - namespace primitive + namespace primitive3d { - transformPrimitive3D::transformPrimitive3D(const ::basegfx::B3DHomMatrix& rTransformation, const primitiveVector& rPrimitiveVector) - : vectorPrimitive(rPrimitiveVector), + transformPrimitive3D::transformPrimitive3D(const basegfx::B3DHomMatrix& rTransformation, const primitiveVector3D& rPrimitiveVector) + : vectorPrimitive3D(rPrimitiveVector), maTransformation(rTransformation) { } @@ -53,9 +53,9 @@ namespace drawinglayer { } - bool transformPrimitive3D::operator==(const basePrimitive& rPrimitive) const + bool transformPrimitive3D::operator==(const basePrimitive3D& rPrimitive) const { - if(vectorPrimitive::operator==(rPrimitive)) + if(vectorPrimitive3D::operator==(rPrimitive)) { const transformPrimitive3D& rCompare = static_cast< const transformPrimitive3D& >(rPrimitive); return (maTransformation == rCompare.maTransformation); @@ -69,13 +69,13 @@ namespace drawinglayer return CreatePrimitiveID('T', 'R', 'N', '3'); } - ::basegfx::B3DRange transformPrimitive3D::get3DRange(const ::drawinglayer::geometry::viewInformation& rViewInformation) const + basegfx::B3DRange transformPrimitive3D::get3DRange() const { - ::basegfx::B3DRange aRetval(::drawinglayer::primitive::get3DRangeFromVector(maPrimitiveVector, rViewInformation)); + basegfx::B3DRange aRetval(get3DRangeFromVector(maPrimitiveVector)); aRetval.transform(maTransformation); return aRetval; } - } // end of namespace primitive + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// |