Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX
30 : : #define INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX
31 : :
32 : : #include <drawinglayer/drawinglayerdllapi.h>
33 : :
34 : : #include <drawinglayer/texture/texture.hxx>
35 : : #include <vcl/bitmap.hxx>
36 : :
37 : : //////////////////////////////////////////////////////////////////////////////
38 : : // predeclarations
39 : :
40 : : namespace drawinglayer { namespace primitive3d {
41 : : class HatchTexturePrimitive3D;
42 : : }}
43 : :
44 : : //////////////////////////////////////////////////////////////////////////////
45 : :
46 : : namespace drawinglayer
47 : : {
48 : : namespace texture
49 : : {
50 [ # # ]: 0 : class DRAWINGLAYER_DLLPUBLIC GeoTexSvxMono : public GeoTexSvx
51 : : {
52 : : protected:
53 : : basegfx::BColor maSingleColor;
54 : : double mfOpacity;
55 : :
56 : : public:
57 : : GeoTexSvxMono(const basegfx::BColor& rSingleColor, double fOpacity);
58 : :
59 : : // compare operator
60 : : virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
61 : : virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
62 : : virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
63 : : };
64 : : } // end of namespace texture
65 : : } // end of namespace drawinglayer
66 : :
67 : : //////////////////////////////////////////////////////////////////////////////
68 : :
69 : : namespace drawinglayer
70 : : {
71 : : namespace texture
72 : : {
73 : : class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmap : public GeoTexSvx
74 : : {
75 : : protected:
76 : : Bitmap maBitmap;
77 : : BitmapReadAccess* mpRead;
78 : : basegfx::B2DPoint maTopLeft;
79 : : basegfx::B2DVector maSize;
80 : : double mfMulX;
81 : : double mfMulY;
82 : :
83 : : // helpers
84 : : bool impIsValid(const basegfx::B2DPoint& rUV, sal_Int32& rX, sal_Int32& rY) const;
85 : :
86 : : public:
87 : : GeoTexSvxBitmap(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize);
88 : : virtual ~GeoTexSvxBitmap();
89 : : virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
90 : : virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
91 : : };
92 : : } // end of namespace texture
93 : : } // end of namespace drawinglayer
94 : :
95 : : //////////////////////////////////////////////////////////////////////////////
96 : :
97 : : namespace drawinglayer
98 : : {
99 : : namespace texture
100 : : {
101 [ # # ]: 0 : class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmapTiled : public GeoTexSvxBitmap
102 : : {
103 : : protected:
104 : : // helpers
105 : 0 : basegfx::B2DPoint impGetCorrected(const basegfx::B2DPoint& rUV) const
106 : : {
107 : 0 : double fX(fmod(rUV.getX() - maTopLeft.getX(), maSize.getX()));
108 : 0 : double fY(fmod(rUV.getY() - maTopLeft.getY(), maSize.getY()));
109 : :
110 [ # # ]: 0 : if(fX < 0.0)
111 : : {
112 : 0 : fX += maSize.getX();
113 : : }
114 : :
115 [ # # ]: 0 : if(fY < 0.0)
116 : : {
117 : 0 : fY += maSize.getY();
118 : : }
119 : :
120 : 0 : return basegfx::B2DPoint(fX + maTopLeft.getX(), fY + maTopLeft.getY());
121 : : }
122 : :
123 : : public:
124 : : GeoTexSvxBitmapTiled(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize);
125 : : virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
126 : : virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
127 : : };
128 : : } // end of namespace texture
129 : : } // end of namespace drawinglayer
130 : :
131 : : //////////////////////////////////////////////////////////////////////////////
132 : :
133 : : namespace drawinglayer
134 : : {
135 : : namespace texture
136 : : {
137 : : class DRAWINGLAYER_DLLPUBLIC GeoTexSvxMultiHatch : public GeoTexSvx
138 : : {
139 : : protected:
140 : : basegfx::BColor maColor;
141 : : double mfLogicPixelSize;
142 : : GeoTexSvxHatch* mp0;
143 : : GeoTexSvxHatch* mp1;
144 : : GeoTexSvxHatch* mp2;
145 : :
146 : : // bitfield
147 : : unsigned mbFillBackground : 1;
148 : :
149 : : // helpers
150 : : bool impIsOnHatch(const basegfx::B2DPoint& rUV) const;
151 : :
152 : : public:
153 : : GeoTexSvxMultiHatch(const primitive3d::HatchTexturePrimitive3D& rPrimitive, double fLogicPixelSize);
154 : : virtual ~GeoTexSvxMultiHatch();
155 : : virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
156 : : virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
157 : :
158 : : // dada access
159 : : bool getFillBackground() const { return mbFillBackground; }
160 : : };
161 : : } // end of namespace texture
162 : : } // end of namespace drawinglayer
163 : :
164 : : //////////////////////////////////////////////////////////////////////////////
165 : :
166 : : #endif // INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX
167 : :
168 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|