Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / drawinglayer / texture / texture3d.hxx
blob489c631b0b27abd77e8564ac7c5adafe41c7597f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX
21 #define INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <drawinglayer/texture/texture.hxx>
26 #include <vcl/bitmapex.hxx>
28 namespace drawinglayer { namespace primitive3d {
29 class HatchTexturePrimitive3D;
32 namespace drawinglayer
34 namespace texture
36 class DRAWINGLAYER_DLLPUBLIC GeoTexSvxMono : public GeoTexSvx
38 protected:
39 basegfx::BColor maSingleColor;
40 double mfOpacity;
42 public:
43 GeoTexSvxMono(
44 const basegfx::BColor& rSingleColor,
45 double fOpacity);
47 // compare operator
48 virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const override;
49 virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override;
50 virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const override;
52 } // end of namespace texture
53 } // end of namespace drawinglayer
55 namespace drawinglayer
57 namespace texture
59 class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmapEx : public GeoTexSvx
61 protected:
62 BitmapEx maBitmapEx;
63 Bitmap maBitmap; // Bitmap held within maBitmapEx, to exist during mpReadBitmap scope
64 Bitmap::ScopedReadAccess mpReadBitmap;
65 Bitmap maTransparence;
66 Bitmap::ScopedReadAccess mpReadTransparence;
67 basegfx::B2DPoint maTopLeft;
68 basegfx::B2DVector maSize;
69 double mfMulX;
70 double mfMulY;
72 bool mbIsAlpha : 1;
73 bool mbIsTransparent : 1;
75 // helpers
76 bool impIsValid(const basegfx::B2DPoint& rUV, sal_Int32& rX, sal_Int32& rY) const;
77 sal_uInt8 impGetTransparence(sal_Int32& rX, sal_Int32& rY) const;
79 public:
80 GeoTexSvxBitmapEx(
81 const BitmapEx& rBitmapEx,
82 const basegfx::B2DRange& rRange);
83 virtual ~GeoTexSvxBitmapEx() override;
85 virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override;
86 virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const override;
88 } // end of namespace texture
89 } // end of namespace drawinglayer
91 namespace drawinglayer
93 namespace texture
95 class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmapExTiled : public GeoTexSvxBitmapEx
97 protected:
98 double mfOffsetX;
99 double mfOffsetY;
101 bool mbUseOffsetX : 1;
102 bool mbUseOffsetY : 1;
104 // helpers
105 basegfx::B2DPoint impGetCorrected(const basegfx::B2DPoint& rUV) const;
107 public:
108 GeoTexSvxBitmapExTiled(
109 const BitmapEx& rBitmapEx,
110 const basegfx::B2DRange& rRange,
111 double fOffsetX,
112 double fOffsetY);
114 virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override;
115 virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const override;
117 } // end of namespace texture
118 } // end of namespace drawinglayer
120 namespace drawinglayer
122 namespace texture
124 class DRAWINGLAYER_DLLPUBLIC GeoTexSvxMultiHatch : public GeoTexSvx
126 protected:
127 basegfx::BColor maColor;
128 double mfLogicPixelSize;
129 GeoTexSvxHatch* mp0;
130 GeoTexSvxHatch* mp1;
131 GeoTexSvxHatch* mp2;
133 bool mbFillBackground : 1;
135 // helpers
136 bool impIsOnHatch(const basegfx::B2DPoint& rUV) const;
138 public:
139 GeoTexSvxMultiHatch(const primitive3d::HatchTexturePrimitive3D& rPrimitive, double fLogicPixelSize);
140 virtual ~GeoTexSvxMultiHatch() override;
141 virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override;
142 virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const override;
144 } // end of namespace texture
145 } // end of namespace drawinglayer
147 #endif // INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */