1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23#ifndef __com_sun_star_rendering_XGraphicDevice_idl__
24#define __com_sun_star_rendering_XGraphicDevice_idl__
25
26#ifndef __com_sun_star_uno_XInterface_idl__
27#include <com/sun/star/uno/XInterface.idl>
28#endif
29#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
30#include <com/sun/star/lang/IllegalArgumentException.idl>
31#endif
32#ifndef __com_sun_star_geometry_IntegerSize2D_idl__
33#include <com/sun/star/geometry/IntegerSize2D.idl>
34#endif
35#ifndef __com_sun_star_geometry_RealSize2D_idl__
36#include <com/sun/star/geometry/RealSize2D.idl>
37#endif
38#ifndef __com_sun_star_rendering_XLinePolyPolygon2D_idl__
39#include <com/sun/star/rendering/XLinePolyPolygon2D.idl>
40#endif
41#ifndef __com_sun_star_rendering_XBezierPolyPolygon2D_idl__
42#include <com/sun/star/rendering/XBezierPolyPolygon2D.idl>
43#endif
44#ifndef __com_sun_star_rendering_XColorSpace_idl__
45#include <com/sun/star/rendering/XColorSpace.idl>
46#endif
47#ifndef __com_sun_star_lang_XMultiServiceFactory_idl__
48#include <com/sun/star/lang/XMultiServiceFactory.idl>
49#endif
50
51module com { module sun { module star { module rendering {
52
53published interface XBitmap;
54published interface XVolatileBitmap;
55published interface XBufferController;
56
57/* TODO: There's obviously a concept called window missing here, where
58   methods such as bufferController, fullscreen mode etc . belong
59   to. But see below
60 */
61
62/** This interface provides access to a graphic device, such as a
63    printer, or a screen device. Every canvas (@see XCanvas) has
64    exactly one associated graphic device, into which its output is
65    rendered.
66
67    For a typical windowing system, the graphic device is equivalent
68    to a distinct OS window, with it's own clipped output area,
69    fullscreen and double-buffering attributes. That is, even if one
70    can have multiple canvases per system window, they all share the
71    same graphic device and thus e.g. fullscreen state. If the OS
72    restrictions are in such a way that fullscreen or double-buffering
73    is screen-exclusive, i.e. that per screen, only one object can
74    have this state, it might even be that all windows on the screen
75    share a common graphic device.
76 */
77published interface XGraphicDevice : ::com::sun::star::uno::XInterface
78{
79    /** Query the controller for multi buffering functionality on this
80        graphic device.
81
82        If there is no such functionality available, the NULL
83        reference is returned.
84     */
85    XBufferController                           getBufferController();
86
87    //-------------------------------------------------------------------------
88
89    /** Query the color space interface for this graphic device.
90
91        This is to be used when interpreting or setting device color
92        values.
93     */
94    XColorSpace		                            getDeviceColorSpace();
95
96    //-------------------------------------------------------------------------
97
98    /** Query the physical resolution of the device in pixel per
99        millimeter.
100
101        A special floating point value of +infinity here indicates
102        'unknown', i.e. at the time of rendering undetermined or
103        possibly infinite resolution along the corresponding
104        direction.
105     */
106    ::com::sun::star::geometry::RealSize2D	getPhysicalResolution();
107
108    //-------------------------------------------------------------------------
109
110    /** Query the physical dimensions of the device in millimeter.
111
112        A special floating point value of +infinity here indicates
113        'unknown', i.e. at the time of rendering undetermined or
114        possibly infinite resolution along the corresponding
115        direction.
116
117        @see XBitmap::getSize()
118     */
119    ::com::sun::star::geometry::RealSize2D	getPhysicalSize();
120
121    //-------------------------------------------------------------------------
122
123    /** Create a line poly-polygon which can internally use
124        device-optimized representations already.
125
126        @param points
127        The points of the poly-polygon, in a separate array for every polygon.
128     */
129    XLinePolyPolygon2D                  createCompatibleLinePolyPolygon( [in] sequence< sequence< ::com::sun::star::geometry::RealPoint2D > > points );
130
131    //-------------------------------------------------------------------------
132
133    /** Create a bezier poly-polygon which can internally use
134        device-optimized representations already.
135
136        @param points
137        The points of the poly-polygon, in a separate array for every polygon.
138     */
139    XBezierPolyPolygon2D            createCompatibleBezierPolyPolygon( [in] sequence< sequence< ::com::sun::star::geometry::RealBezierSegment2D > > points );
140
141    //-------------------------------------------------------------------------
142
143    /** Create a bitmap whose memory layout and sample model is
144        compatible to the graphic device.
145
146        @param size
147        Size of the requested bitmap in pixel. Both components of the
148        size must be greater than 0
149     */
150    XBitmap			                createCompatibleBitmap( [in] ::com::sun::star::geometry::IntegerSize2D size )
151        raises (com::sun::star::lang::IllegalArgumentException);
152
153    //-------------------------------------------------------------------------
154
155    /** Create a volatile bitmap that is usable with this graphic device.
156
157        A volatile bitmap's difference in comparison to a plain bitmap
158        (e.g. generated via createCompatibleBitmap()) is the fact that
159        its content might vanish at any point in time (making any
160        operation with them produce a
161        <type>VolatileContentDestroyedException</type>). The benefit,
162        on the other hand, is that they might be easy to
163        hardware-accelerate on certain platforms, without the need to
164        keep a safety copy of the content internally.
165
166        @param size
167        Size of the requested bitmap in pixel. Both components of the
168        size must be greater than 0
169     */
170    XVolatileBitmap	                createVolatileBitmap( [in] ::com::sun::star::geometry::IntegerSize2D size )
171        raises (com::sun::star::lang::IllegalArgumentException);
172
173    //-------------------------------------------------------------------------
174
175    /** Create a bitmap with alpha channel whose memory layout and
176        sample model is compatible to the graphic device.
177
178        @param size
179        Size of the requested bitmap in pixel. Both components of the
180        size must be greater than 0
181     */
182    XBitmap			                createCompatibleAlphaBitmap( [in] ::com::sun::star::geometry::IntegerSize2D size )
183        raises (com::sun::star::lang::IllegalArgumentException);
184
185    //-------------------------------------------------------------------------
186
187    /** Create a volatile bitmap with alpha channel that is usable
188        with this graphic device.
189
190        A volatile bitmap's difference in comparison to a plain bitmap
191        (e.g. generated via createCompatibleBitmap()) is the fact that
192        its content might vanish at any point in time (making any
193        operation with them produce a
194        <type>VolatileContentDestroyedException</type>). The benefit,
195        on the other hand, is that they might be easy to
196        hardware-accelerate on certain platforms, without the need to
197        keep a safety copy of the content internally.
198
199        @param size
200        Size of the requested bitmap in pixel. Both components of the
201        size must be greater than 0
202     */
203    XVolatileBitmap	                createVolatileAlphaBitmap( [in] ::com::sun::star::geometry::IntegerSize2D size )
204        raises (com::sun::star::lang::IllegalArgumentException);
205
206    //-------------------------------------------------------------------------
207
208    /** Get a reference to this device's parametric polygon factory.
209
210        @return a reference to this device's parametric polygon
211        factory. Although it is possible to use parametric polygons on
212        all canvases, regardless of the associated graphic device,
213        this is not advisable: each canvas implementation is free to
214        internally generate optimized parametric polygons, which can
215        be used more directly for e.g. texturing operations.
216
217        <pre>
218        Available services (all canvas implementations should provide
219        this minimal set, though are free to add more; just check the
220        getAvailableServiceNames() on the returned interface):
221
222        - Gradients - all gradients need to support two construction
223          parameters, "Colors" being a <type>sequence<Color></type>
224          and "Stops" being a <type>sequence<double></type>. Both must
225          have the same length, and at least two elements. See
226          http://www.w3.org/TR/SVG11/pservers.html#GradientStops for
227          the semantics of gradient stops and colors.
228          Required gradient services:
229
230          * "LinearGradient" - the gradient varies linearly between
231            the given colors. without coordinate system
232            transformation, the color interpolation happens in
233            increasing x direction, and is constant in y
234            direction. Equivalent to svg linear gradient
235            http://www.w3.org/TR/SVG11/pservers.html#LinearGradients
236
237          * "EllipticalGradient" - this gradient has zeroth color
238            index in the middle, and varies linearly between center
239            and final color. The services takes an additional
240            parameter named "AspectRatio" of <type>double</type>
241            (width divided by height), if this aspect ratio is 1, the
242            gradient is circular. If it's not 1, the gradient is
243            elliptical, with the special twist that the aspect ratio
244            is maintained also for the center color: the gradient will
245            not collapse into a single point, but become a line of
246            center color. If "AspectRatio" is missing, or equal to 1,
247            this gradient yields similar results as the svg radial
248            gradient
249            http://www.w3.org/TR/SVG11/pservers.html#RadialGradients
250
251          * "RectangularGradient" - this gradient has zeroth color
252            index in the middle, and varies linearly between center
253            and final color via rectangular boxes
254            around the center point. The services takes an additional
255            parameter named "AspectRatio" of <type>double</type>
256            (width divided by height), if this aspect ratio is 1, the
257            gradient is quadratic. If it's not 1, the gradient is
258            rectangular, with the special twist that the aspect ratio
259            is maintained also for the center color: the gradient will
260            not collapse into a single point, but become a line of
261            center color.
262
263        - Hatch patterns - Required hatch services:
264
265          * "VerticalLineHatch" - this hatching consists of vertical lines
266          * "OrthogonalLinesHatch" - this hatching consists of
267            crossing vertical and horizontal lines
268          * "ThreeCrossingLinesHatch" - this hatching consists of
269            vertical and horizontal lines plus diagonal lines from
270            left, top to bottom, right.
271          * "FourCrossingLinesHatch" - this hatching consists of
272            vertical and horizontal lines plus diagonal lines in both
273            directions.
274        </pre>
275     */
276    com::sun::star::lang::XMultiServiceFactory getParametricPolyPolygonFactory();
277
278    //-------------------------------------------------------------------------
279
280    /** Tells whether this graphic device has a full screen mode,
281        i.e. whether a window can cover the whole screen exclusively.
282     */
283    boolean			                hasFullScreenMode();
284
285    //-------------------------------------------------------------------------
286
287    /** Enter or leave the fullscreen mode, if possible. The return
288        value denotes the success of the operation.
289
290        @attention depending on the underlying operating system,
291        fullscreen mode can be left without a enterFullScreenMode(
292        false ) call.
293     */
294    boolean							enterFullScreenMode( [in] boolean bEnter );
295};
296
297}; }; }; };
298
299#endif
300