fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / view / inc / 3DChartObjects.hxx
blob39d09b419c3a98ec6fe69b7ea58938424a3dd922
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/.
8 */
10 #ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_3DCHARTOBJECTS_HXX
11 #define INCLUDED_CHART2_SOURCE_VIEW_INC_3DCHARTOBJECTS_HXX
13 #include <glm/glm.hpp>
14 #include <tools/color.hxx>
15 #include <vcl/bitmapex.hxx>
17 #include <vcl/opengl/OpenGLContext.hxx>
18 #include "GL3DRenderer.hxx"
20 #include <boost/ptr_container/ptr_map.hpp>
21 #include <boost/shared_array.hpp>
23 namespace chart {
25 namespace opengl3D {
27 struct TextCacheItem
29 TextCacheItem(sal_uInt8 *pPixels, ::Size aSize)
30 : maSize(aSize), maPixels(pPixels)
33 ::Size maSize;
34 boost::shared_array<sal_uInt8> maPixels;
37 class TextCache
39 public:
40 const TextCacheItem &getText(OUString const & rText, bool bIs3dText = false);
41 private:
42 typedef boost::ptr_map<OUString const, TextCacheItem> TextCacheType;
44 TextCacheType maTextCache;
47 class Renderable3DObject
49 public:
50 Renderable3DObject(OpenGL3DRenderer* pRenderer, sal_uInt32 nId);
52 virtual ~Renderable3DObject() {};
54 virtual void render();
56 OpenGL3DRenderer* getRender();
58 protected:
59 OpenGL3DRenderer* mpRenderer;
60 sal_uInt32 mnUniqueId;
63 class Bar : public Renderable3DObject
65 public:
66 Bar(OpenGL3DRenderer* pRenderer, const glm::mat4& rPosition, sal_uInt32 nColor, sal_uInt32 nId);
68 virtual void render() SAL_OVERRIDE;
69 private:
70 bool mbRoundedCorners;
71 glm::mat4 maPos;
72 Color maColor; // RGBA fill color
75 class Line : public Renderable3DObject
77 public:
78 Line(OpenGL3DRenderer* pRenderer, sal_uInt32 nId);
80 virtual void render() SAL_OVERRIDE;
82 void setPosition(const glm::vec3& rBegin, const glm::vec3& rEnd);
83 void setLineColor(const Color& rColor);
85 private:
86 glm::vec3 maPosBegin;
87 glm::vec3 maPosEnd;
88 Color maLineColor; // RGBA line color
91 class Text : public Renderable3DObject
93 public:
94 Text(OpenGL3DRenderer* pRenderer, TextCache& rTextCache, const OUString& rStr, sal_uInt32 nId);
95 virtual void render() SAL_OVERRIDE;
97 Size getSize() const { return maText.maSize;}
99 void setPosition(const glm::vec3& rTopLeft, const glm::vec3& rTopRight, const glm::vec3& rBottomRight);
101 private:
102 TextCacheItem maText;
103 glm::vec3 maTopLeft;
104 glm::vec3 maTopRight;
105 glm::vec3 maBottomRight;
108 class ScreenText : public Renderable3DObject
110 public:
111 ScreenText(OpenGL3DRenderer* pRenderer, TextCache& rTextCache,
112 const OUString& rStr, glm::vec4 rColor, sal_uInt32 nId, bool bIs3dText = false);
114 virtual void render() SAL_OVERRIDE;
115 void setPosition(const glm::vec2& rTopLeft, const glm::vec2& rBottomRight,
116 const glm::vec3& r3DPos = glm::vec3(0.0, 0.0, 0.0));
118 private:
119 TextCacheItem maText;
120 glm::vec2 maTopLeft;
121 glm::vec2 maBottomRight;
122 glm::vec3 ma3DPos;
123 glm::vec4 maColor;
126 class Rectangle : public Renderable3DObject
128 public:
129 Rectangle(OpenGL3DRenderer* pRenderer, sal_uInt32 nId);
130 virtual void render() SAL_OVERRIDE;
132 void setPosition(const glm::vec3& rTopLeft, const glm::vec3& rTopRight, const glm::vec3& rBottomRight);
133 void setFillColor(const Color& rColor);
134 void setLineColor(const Color& rColor);
136 private:
137 glm::vec3 maTopLeft;
138 glm::vec3 maTopRight;
139 glm::vec3 maBottomRight;
140 Color maColor; // RGBA fill color
141 Color maLineColor; // RGBA line color
144 class Camera : public Renderable3DObject
146 public:
147 Camera(OpenGL3DRenderer* pRenderer);
148 virtual void render() SAL_OVERRIDE;
150 void setPosition(const glm::vec3& rPos);
151 void setDirection(const glm::vec3& rPos);
153 private:
154 glm::vec3 maPos;
155 glm::vec3 maUp;
156 glm::vec3 maDirection;
163 #endif // INCLUDED_CHART2_SOURCE_VIEW_INC_3DCHARTOBJECTS_HXX
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */