1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27#ifndef __com_sun_star_rendering_XSimpleCanvas_idl__
28#define __com_sun_star_rendering_XSimpleCanvas_idl__
29
30#ifndef __com_sun_star_util_Color_idl__
31#include <com/sun/star/util/Color.idl>
32#endif
33#ifndef __com_sun_star_geometry_RealPoint2D_idl__
34#include <com/sun/star/geometry/RealPoint2D.idl>
35#endif
36#ifndef __com_sun_star_geometry_RealRectangle2D_idl__
37#include <com/sun/star/geometry/RealRectangle2D.idl>
38#endif
39#ifndef __com_sun_star_geometry_AffineMatrix2D_idl__
40#include <com/sun/star/geometry/AffineMatrix2D.idl>
41#endif
42#ifndef __com_sun_star_rendering_StringContext_idl__
43#include <com/sun/star/rendering/StringContext.idl>
44#endif
45#ifndef __com_sun_star_rendering_ViewState_idl__
46#include <com/sun/star/rendering/ViewState.idl>
47#endif
48#ifndef __com_sun_star_rendering_RenderState_idl__
49#include <com/sun/star/rendering/RenderState.idl>
50#endif
51#ifndef __com_sun_star_rendering_FontMetrics_idl__
52#include <com/sun/star/rendering/FontMetrics.idl>
53#endif
54
55//=============================================================================
56
57module com {  module sun {  module star {  module rendering {
58
59interface XCanvas;
60interface XCanvasFont;
61interface XBitmap;
62interface XGraphicDevice;
63interface XPolyPolygon2D;
64
65/** Provides the basic graphical output operations for a canvas.<p>
66
67    This interface is a simplified version of the <type>XCanvas</type>
68    interface. It holds explicit state, i.e. the pen and fill color,
69    the current transformation, clip and font are persistently
70    remembered.<p>
71
72    In contrast to the <type>XCanvas</type> interface, XSimpleCanvas
73    does not distinguish between stroke and fill operations; instead,
74    switching between stroke and fill (or taking both) works by
75    setting appropriate pen and fill colors.<p>
76 */
77interface XSimpleCanvas: com::sun::star::uno::XInterface
78{
79    /** Select a font.<p>
80
81        This method selects the specified font (or a close substitute)
82        as the current font for text output.<p>
83
84        @param sFontName
85        The name of the font (like e.g. Arial)
86
87        @param size
88        The size of the font (note that this is not the usual points
89        unit, but in the same coordinate system as the other rendering
90        operations - usually, device pixel).
91
92        @param bold
93        When true, selected font is bold.
94
95        @param italic
96        When true, selected font is italic
97     */
98    void selectFont( [in] string sFontName, [in]double size, [in] boolean bold, [in] boolean italic );
99
100    //-------------------------------------------------------------------------
101
102    /** Sets the color used by line and text operations.<p>
103
104        To disable stroking, simply set this color to something with
105        zero alpha (i.e. fully transparent).<p>
106
107        @param nsRgbaColor
108        RGBA color tuple, interpreted in the sRGB color space.
109     */
110    void setPenColor( [in] com::sun::star::util::Color nsRgbaColor );
111
112    //-------------------------------------------------------------------------
113
114    /** Sets the fill color.<p>
115
116        To disable filling, simply set this color to something with
117        zero alpha (i.e. fully transparent).<p>
118
119        @param nsRgbaColor
120        RGBA color tuple, interpreted in the sRGB color space.
121     */
122    void setFillColor( [in] com::sun::star::util::Color nsRgbaColor );
123
124    //-------------------------------------------------------------------------
125
126    /** Sets the clip to the specified rectangle.<p>
127     */
128    void setRectClip( [in] ::com::sun::star::geometry::RealRectangle2D aRect );
129
130    //-------------------------------------------------------------------------
131
132    /** Set the current transform matrix.<p>
133     */
134    void setTransformation( [in] ::com::sun::star::geometry::AffineMatrix2D aTransform );
135
136    //-------------------------------------------------------------------------
137
138    /** Sets a single pixel on the canvas.<p>
139     */
140    void drawPixel( [in] ::com::sun::star::geometry::RealPoint2D aPoint );
141
142    //-------------------------------------------------------------------------
143
144    /** Draws a line on the canvas.<p>
145     */
146    void drawLine( [in] ::com::sun::star::geometry::RealPoint2D aStartPoint,
147                   [in] ::com::sun::star::geometry::RealPoint2D aEndPoint );
148
149    //-------------------------------------------------------------------------
150
151    /** Draws a rectangle on the canvas.<p>
152     */
153    void drawRect( [in] ::com::sun::star::geometry::RealRectangle2D aRect );
154
155    //-------------------------------------------------------------------------
156
157    /** Draws a poly-polygon on the canvas.<p>
158     */
159    void drawPolyPolygon( [in] XPolyPolygon2D xPolyPolygon );
160
161    //-------------------------------------------------------------------------
162
163    /** Draws text on the canvas.<p>
164
165        @param aText
166        Text to render. The text color is the current pen color.
167
168        @param aOutPos
169        Output position of the text. This is the left or right edge,
170        depending on nTextDirection. Output position is always
171        relative to the font baseline.
172
173        @param nTextDirection
174        A value from the <type>TextDirection</type> collection,
175        denoting the main writing direction for this string. The main
176        writing direction determines the origin of the text output,
177        i.e. the left edge for left-to-right and the right edge for
178        right-to-left text.
179     */
180    void drawText( [in] StringContext aText,
181                   [in] ::com::sun::star::geometry::RealPoint2D aOutPos,
182                   [in] byte nTextDirection );
183
184    //-------------------------------------------------------------------------
185
186    /** Draws the bitmap on the canvas.<p>
187
188        @param xBitmap
189        Bitmap to render
190
191        @param aLeftTop
192        Left, top position of the bitmap on the destination canvas.
193     */
194    void drawBitmap( [in] XBitmap xBitmap,
195                     [in] ::com::sun::star::geometry::RealPoint2D aLeftTop );
196
197    //-------------------------------------------------------------------------
198
199    /** Request the associated graphic device for this canvas.<p>
200
201        A graphic device provides methods specific to the underlying
202        output device capabilities, which are common for all canvases
203        rendering to such a device. This includes device resolution,
204        color space, or bitmap formats.<p>
205
206        @return the associated <type>XGraphicDevice</type>.
207     */
208    XGraphicDevice getDevice();
209
210    //-------------------------------------------------------------------------
211
212    /** Query the underlying <type>XCanvas</type>.<p>
213
214        @return the canvas interface this object is internally based
215        on.
216     */
217    XCanvas getCanvas();
218
219    //-------------------------------------------------------------------------
220
221    /** Request the font metrics of the current font.<p>
222
223        @return the font metrics of the currently selected font.
224     */
225    FontMetrics getFontMetrics();
226
227    //-------------------------------------------------------------------------
228
229    /** Retrieve currently selected font.<p>
230
231        @return the font instance that's currently used for rendering
232        text.
233     */
234    XCanvasFont getCurrentFont();
235
236    //-------------------------------------------------------------------------
237
238    /** Retrieve color currently used for lines.
239     */
240    com::sun::star::util::Color getCurrentPenColor();
241
242    //-------------------------------------------------------------------------
243
244    /** Retrieve color currently used for fills
245     */
246    com::sun::star::util::Color getCurrentFillColor();
247
248    //-------------------------------------------------------------------------
249
250    /** Retrieve current clip rect
251     */
252    com::sun::star::geometry::RealRectangle2D getCurrentClipRect();
253
254    //-------------------------------------------------------------------------
255
256    /** Retrieve current transformation matrix
257     */
258    com::sun::star::geometry::AffineMatrix2D getCurrentTransformation();
259
260    //-------------------------------------------------------------------------
261
262    /** Retrieve view state.<p>
263
264        @return the view state, that would generate matching output,
265        when rendering to an XCanvas instead.
266     */
267    ViewState getCurrentViewState();
268
269    //-------------------------------------------------------------------------
270
271    /** Retrieve render state.<p>
272
273        @param bUseFillColor
274        When true, the Color member of the RenderState is initialized
275        with the current fill color; when false, the current pen color
276        is used.
277
278        @return the render state, that would generate matching output,
279        when rendering to an XCanvas instead.
280     */
281    RenderState getCurrentRenderState( [in] boolean bUseFillColor );
282
283    //-------------------------------------------------------------------------
284
285};
286
287//=============================================================================
288
289}; }; }; };
290
291#endif
292