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