Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX
21 : #define INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX
22 :
23 : #include <drawinglayer/drawinglayerdllapi.h>
24 :
25 : #include <drawinglayer/texture/texture.hxx>
26 : #include <vcl/bitmap.hxx>
27 :
28 : //////////////////////////////////////////////////////////////////////////////
29 : // predeclarations
30 :
31 : namespace drawinglayer { namespace primitive3d {
32 : class HatchTexturePrimitive3D;
33 : }}
34 :
35 : //////////////////////////////////////////////////////////////////////////////
36 :
37 : namespace drawinglayer
38 : {
39 : namespace texture
40 : {
41 0 : class DRAWINGLAYER_DLLPUBLIC GeoTexSvxMono : public GeoTexSvx
42 : {
43 : protected:
44 : basegfx::BColor maSingleColor;
45 : double mfOpacity;
46 :
47 : public:
48 : GeoTexSvxMono(const basegfx::BColor& rSingleColor, double fOpacity);
49 :
50 : // compare operator
51 : virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
52 : virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
53 : virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
54 : };
55 : } // end of namespace texture
56 : } // end of namespace drawinglayer
57 :
58 : //////////////////////////////////////////////////////////////////////////////
59 :
60 : namespace drawinglayer
61 : {
62 : namespace texture
63 : {
64 : class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmap : public GeoTexSvx
65 : {
66 : protected:
67 : Bitmap maBitmap;
68 : BitmapReadAccess* mpRead;
69 : basegfx::B2DPoint maTopLeft;
70 : basegfx::B2DVector maSize;
71 : double mfMulX;
72 : double mfMulY;
73 :
74 : // helpers
75 : bool impIsValid(const basegfx::B2DPoint& rUV, sal_Int32& rX, sal_Int32& rY) const;
76 :
77 : public:
78 : GeoTexSvxBitmap(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize);
79 : virtual ~GeoTexSvxBitmap();
80 : virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
81 : virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
82 : };
83 : } // end of namespace texture
84 : } // end of namespace drawinglayer
85 :
86 : //////////////////////////////////////////////////////////////////////////////
87 :
88 : namespace drawinglayer
89 : {
90 : namespace texture
91 : {
92 0 : class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmapTiled : public GeoTexSvxBitmap
93 : {
94 : protected:
95 : // helpers
96 0 : basegfx::B2DPoint impGetCorrected(const basegfx::B2DPoint& rUV) const
97 : {
98 0 : double fX(fmod(rUV.getX() - maTopLeft.getX(), maSize.getX()));
99 0 : double fY(fmod(rUV.getY() - maTopLeft.getY(), maSize.getY()));
100 :
101 0 : if(fX < 0.0)
102 : {
103 0 : fX += maSize.getX();
104 : }
105 :
106 0 : if(fY < 0.0)
107 : {
108 0 : fY += maSize.getY();
109 : }
110 :
111 0 : return basegfx::B2DPoint(fX + maTopLeft.getX(), fY + maTopLeft.getY());
112 : }
113 :
114 : public:
115 : GeoTexSvxBitmapTiled(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize);
116 : virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
117 : virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
118 : };
119 : } // end of namespace texture
120 : } // end of namespace drawinglayer
121 :
122 : //////////////////////////////////////////////////////////////////////////////
123 :
124 : namespace drawinglayer
125 : {
126 : namespace texture
127 : {
128 : class DRAWINGLAYER_DLLPUBLIC GeoTexSvxMultiHatch : public GeoTexSvx
129 : {
130 : protected:
131 : basegfx::BColor maColor;
132 : double mfLogicPixelSize;
133 : GeoTexSvxHatch* mp0;
134 : GeoTexSvxHatch* mp1;
135 : GeoTexSvxHatch* mp2;
136 :
137 : // bitfield
138 : unsigned mbFillBackground : 1;
139 :
140 : // helpers
141 : bool impIsOnHatch(const basegfx::B2DPoint& rUV) const;
142 :
143 : public:
144 : GeoTexSvxMultiHatch(const primitive3d::HatchTexturePrimitive3D& rPrimitive, double fLogicPixelSize);
145 : virtual ~GeoTexSvxMultiHatch();
146 : virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
147 : virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
148 :
149 : // dada access
150 : bool getFillBackground() const { return mbFillBackground; }
151 : };
152 : } // end of namespace texture
153 : } // end of namespace drawinglayer
154 :
155 : //////////////////////////////////////////////////////////////////////////////
156 :
157 : #endif // INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX
158 :
159 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|