Move setting of LD_LIBRARY_PATH closer to invocation of cppunittester
[LibreOffice.git] / canvas / source / directx / dx_canvashelper.hxx
blob54731a08eb445f98a457db6a282efeb33a3a8caa
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 #pragma once
22 #include <com/sun/star/rendering/XCanvas.hpp>
23 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
24 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
26 #include <basegfx/vector/b2isize.hxx>
27 #include <basegfx/vector/b2dsize.hxx>
29 #include "dx_graphicsprovider.hxx"
30 #include "dx_gdiplususer.hxx"
31 #include "dx_impltools.hxx"
34 namespace dxcanvas
36 /** Helper class for basic canvas functionality. Also offers
37 optional backbuffer painting, when providing it with a second
38 HDC to render into.
40 class CanvasHelper
42 public:
43 CanvasHelper();
45 /// make noncopyable
46 CanvasHelper(const CanvasHelper&) = delete;
47 const CanvasHelper& operator=(const CanvasHelper&) = delete;
49 /// Release all references
50 void disposing();
52 /** Initialize canvas helper
54 This method late-initializes the canvas helper, providing
55 it with the necessary device and output objects. Note that
56 the CanvasHelper does <em>not</em> take ownership of the
57 passed rDevice reference, nor does it perform any
58 reference counting. Thus, to prevent the reference counted
59 SpriteCanvas object from deletion, the user of this class
60 is responsible for holding ref-counted references itself!
62 @param rDevice
63 Reference device this canvas is associated with
66 void setDevice( css::rendering::XGraphicDevice& rDevice );
68 /** Set the target for rendering operations
70 @param rTarget
71 Render target
73 void setTarget( const GraphicsProviderSharedPtr& rTarget );
75 /** Set the target for rendering operations
77 @param rTarget
78 Render target
80 @param rOutputOffset
81 Output offset in pixel
83 void setTarget( const GraphicsProviderSharedPtr& rTarget,
84 const ::basegfx::B2ISize& rOutputOffset );
87 // CanvasHelper functionality
88 // ==========================
90 // XCanvas (only providing, not implementing the
91 // interface. Also note subtle method parameter differences)
92 void clear();
93 void drawPoint( const css::rendering::XCanvas* pCanvas,
94 const css::geometry::RealPoint2D& aPoint,
95 const css::rendering::ViewState& viewState,
96 const css::rendering::RenderState& renderState );
97 void drawLine( const css::rendering::XCanvas* pCanvas,
98 const css::geometry::RealPoint2D& aStartPoint,
99 const css::geometry::RealPoint2D& aEndPoint,
100 const css::rendering::ViewState& viewState,
101 const css::rendering::RenderState& renderState );
102 void drawBezier( const css::rendering::XCanvas* pCanvas,
103 const css::geometry::RealBezierSegment2D& aBezierSegment,
104 const css::geometry::RealPoint2D& aEndPoint,
105 const css::rendering::ViewState& viewState,
106 const css::rendering::RenderState& renderState );
107 css::uno::Reference< css::rendering::XCachedPrimitive >
108 drawPolyPolygon( const css::rendering::XCanvas* pCanvas,
109 const css::uno::Reference<
110 css::rendering::XPolyPolygon2D >& xPolyPolygon,
111 const css::rendering::ViewState& viewState,
112 const css::rendering::RenderState& renderState );
113 css::uno::Reference< css::rendering::XCachedPrimitive >
114 strokePolyPolygon( const css::rendering::XCanvas* pCanvas,
115 const css::uno::Reference<
116 css::rendering::XPolyPolygon2D >& xPolyPolygon,
117 const css::rendering::ViewState& viewState,
118 const css::rendering::RenderState& renderState,
119 const css::rendering::StrokeAttributes& strokeAttributes );
120 css::uno::Reference< css::rendering::XCachedPrimitive >
121 strokeTexturedPolyPolygon( const css::rendering::XCanvas* pCanvas,
122 const css::uno::Reference<
123 css::rendering::XPolyPolygon2D >& xPolyPolygon,
124 const css::rendering::ViewState& viewState,
125 const css::rendering::RenderState& renderState,
126 const css::uno::Sequence<
127 css::rendering::Texture >& textures,
128 const css::rendering::StrokeAttributes& strokeAttributes );
129 css::uno::Reference< css::rendering::XCachedPrimitive >
130 strokeTextureMappedPolyPolygon( const css::rendering::XCanvas* pCanvas,
131 const css::uno::Reference<
132 css::rendering::XPolyPolygon2D >& xPolyPolygon,
133 const css::rendering::ViewState& viewState,
134 const css::rendering::RenderState& renderState,
135 const css::uno::Sequence<
136 css::rendering::Texture >& textures,
137 const css::uno::Reference<
138 css::geometry::XMapping2D >& xMapping,
139 const css::rendering::StrokeAttributes& strokeAttributes );
140 css::uno::Reference< css::rendering::XPolyPolygon2D >
141 queryStrokeShapes( const css::rendering::XCanvas* pCanvas,
142 const css::uno::Reference<
143 css::rendering::XPolyPolygon2D >& xPolyPolygon,
144 const css::rendering::ViewState& viewState,
145 const css::rendering::RenderState& renderState,
146 const css::rendering::StrokeAttributes& strokeAttributes );
147 css::uno::Reference< css::rendering::XCachedPrimitive >
148 fillPolyPolygon( const css::rendering::XCanvas* pCanvas,
149 const css::uno::Reference<
150 css::rendering::XPolyPolygon2D >& xPolyPolygon,
151 const css::rendering::ViewState& viewState,
152 const css::rendering::RenderState& renderState );
153 css::uno::Reference< css::rendering::XCachedPrimitive >
154 fillTexturedPolyPolygon( const css::rendering::XCanvas* pCanvas,
155 const css::uno::Reference<
156 css::rendering::XPolyPolygon2D >& xPolyPolygon,
157 const css::rendering::ViewState& viewState,
158 const css::rendering::RenderState& renderState,
159 const css::uno::Sequence<
160 css::rendering::Texture >& textures );
161 css::uno::Reference< css::rendering::XCachedPrimitive >
162 fillTextureMappedPolyPolygon( const css::rendering::XCanvas* pCanvas,
163 const css::uno::Reference<
164 css::rendering::XPolyPolygon2D >& xPolyPolygon,
165 const css::rendering::ViewState& viewState,
166 const css::rendering::RenderState& renderState,
167 const css::uno::Sequence<
168 css::rendering::Texture >& textures,
169 const css::uno::Reference<
170 css::geometry::XMapping2D >& xMapping );
172 css::uno::Reference< css::rendering::XCanvasFont >
173 createFont( const css::rendering::XCanvas* pCanvas,
174 const css::rendering::FontRequest& fontRequest,
175 const css::uno::Sequence<
176 css::beans::PropertyValue >& extraFontProperties,
177 const css::geometry::Matrix2D& fontMatrix );
179 css::uno::Sequence< css::rendering::FontInfo >
180 queryAvailableFonts( const css::rendering::XCanvas* pCanvas,
181 const css::rendering::FontInfo& aFilter,
182 const css::uno::Sequence<
183 css::beans::PropertyValue >& aFontProperties );
185 css::uno::Reference< css::rendering::XCachedPrimitive >
186 drawText( const css::rendering::XCanvas* pCanvas,
187 const css::rendering::StringContext& text,
188 const css::uno::Reference<
189 css::rendering::XCanvasFont >& xFont,
190 const css::rendering::ViewState& viewState,
191 const css::rendering::RenderState& renderState,
192 sal_Int8 textDirection );
194 css::uno::Reference< css::rendering::XCachedPrimitive >
195 drawTextLayout( const css::rendering::XCanvas* pCanvas,
196 const css::uno::Reference<
197 css::rendering::XTextLayout >& laidOutText,
198 const css::rendering::ViewState& viewState,
199 const css::rendering::RenderState& renderState );
201 css::uno::Reference< css::rendering::XCachedPrimitive >
202 drawBitmap( const css::rendering::XCanvas* pCanvas,
203 const css::uno::Reference<
204 css::rendering::XBitmap >& xBitmap,
205 const css::rendering::ViewState& viewState,
206 const css::rendering::RenderState& renderState );
207 css::uno::Reference< css::rendering::XCachedPrimitive >
208 drawBitmapModulated( const css::rendering::XCanvas* pCanvas,
209 const css::uno::Reference<
210 css::rendering::XBitmap >& xBitmap,
211 const css::rendering::ViewState& viewState,
212 const css::rendering::RenderState& renderState );
213 css::uno::Reference< css::rendering::XGraphicDevice >
214 getDevice();
216 // Flush drawing queue to screen
217 void flush() const;
219 /** Called from XCanvas base classes, to notify that content
220 is _about_ to change
222 void modifying() {}
224 protected:
225 /// Refcounted global GDI+ state container
226 GDIPlusUserSharedPtr mpGdiPlusUser;
228 /** Phyical output device
230 Deliberately not a refcounted reference, because of
231 potential circular references for spritecanvas.
233 css::rendering::XGraphicDevice* mpDevice;
235 /// Provides the Gdiplus::Graphics to render into
236 GraphicsProviderSharedPtr mpGraphicsProvider;
238 bool needOutput() const { return bool(mpGraphicsProvider); };
240 // returns transparency of color
241 void setupGraphicsState( GraphicsSharedPtr const & rGraphics,
242 const css::rendering::ViewState& viewState,
243 const css::rendering::RenderState& renderState );
245 Gdiplus::CompositingMode calcCompositingMode( sal_Int8 nMode );
247 /// Current (transformation-independent) output buffer offset
248 ::basegfx::B2ISize maOutputOffset;
252 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */