1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XSimpleCanvas.idl,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef __com_sun_star_rendering_XSimpleCanvas_idl__
31 #define __com_sun_star_rendering_XSimpleCanvas_idl__
33 #ifndef __com_sun_star_util_Color_idl__
34 #include
<com
/sun
/star
/util
/Color.idl
>
36 #ifndef __com_sun_star_geometry_RealPoint2D_idl__
37 #include
<com
/sun
/star
/geometry
/RealPoint2D.idl
>
39 #ifndef __com_sun_star_geometry_RealRectangle2D_idl__
40 #include
<com
/sun
/star
/geometry
/RealRectangle2D.idl
>
42 #ifndef __com_sun_star_geometry_AffineMatrix2D_idl__
43 #include
<com
/sun
/star
/geometry
/AffineMatrix2D.idl
>
45 #ifndef __com_sun_star_rendering_StringContext_idl__
46 #include
<com
/sun
/star
/rendering
/StringContext.idl
>
48 #ifndef __com_sun_star_rendering_ViewState_idl__
49 #include
<com
/sun
/star
/rendering
/ViewState.idl
>
51 #ifndef __com_sun_star_rendering_RenderState_idl__
52 #include
<com
/sun
/star
/rendering
/RenderState.idl
>
54 #ifndef __com_sun_star_rendering_FontMetrics_idl__
55 #include
<com
/sun
/star
/rendering
/FontMetrics.idl
>
58 //=============================================================================
60 module com
{ module sun
{ module star
{ module rendering
{
63 interface XCanvasFont
;
65 interface XGraphicDevice
;
66 interface XPolyPolygon2D
;
68 /** Provides the basic graphical output operations for a canvas.<p>
70 This interface is a simplified version of the <type>XCanvas</type>
71 interface. It holds explicit state, i.e. the pen and fill color,
72 the current transformation, clip and font are persistently
75 In contrast to the <type>XCanvas</type> interface, XSimpleCanvas
76 does not distinguish between stroke and fill operations; instead,
77 switching between stroke and fill (or taking both) works by
78 setting appropriate pen and fill colors.<p>
80 interface XSimpleCanvas
: com
::sun
::star
::uno
::XInterface
84 This method selects the specified font (or a close substitute)
85 as the current font for text output.<p>
88 The name of the font (like e.g. Arial)
91 The size of the font (note that this is not the usual points
92 unit, but in the same coordinate system as the other rendering
93 operations - usually, device pixel).
96 When true, selected font is bold.
99 When true, selected font is italic
101 void selectFont
( [in] string sFontName
, [in]double size
, [in] boolean bold
, [in] boolean italic
);
103 //-------------------------------------------------------------------------
105 /** Sets the color used by line and text operations.<p>
107 To disable stroking, simply set this color to something with
108 zero alpha (i.e. fully transparent).<p>
111 RGBA color tuple, interpreted in the sRGB color space.
113 void setPenColor
( [in] com
::sun
::star
::util
::Color nsRgbaColor
);
115 //-------------------------------------------------------------------------
117 /** Sets the fill color.<p>
119 To disable filling, simply set this color to something with
120 zero alpha (i.e. fully transparent).<p>
123 RGBA color tuple, interpreted in the sRGB color space.
125 void setFillColor
( [in] com
::sun
::star
::util
::Color nsRgbaColor
);
127 //-------------------------------------------------------------------------
129 /** Sets the clip to the specified rectangle.<p>
131 void setRectClip
( [in] ::com
::sun
::star
::geometry
::RealRectangle2D aRect
);
133 //-------------------------------------------------------------------------
135 /** Set the current transform matrix.<p>
137 void setTransformation
( [in] ::com
::sun
::star
::geometry
::AffineMatrix2D aTransform
);
139 //-------------------------------------------------------------------------
141 /** Sets a single pixel on the canvas.<p>
143 void drawPixel
( [in] ::com
::sun
::star
::geometry
::RealPoint2D aPoint
);
145 //-------------------------------------------------------------------------
147 /** Draws a line on the canvas.<p>
149 void drawLine
( [in] ::com
::sun
::star
::geometry
::RealPoint2D aStartPoint
,
150 [in] ::com
::sun
::star
::geometry
::RealPoint2D aEndPoint
);
152 //-------------------------------------------------------------------------
154 /** Draws a rectangle on the canvas.<p>
156 void drawRect
( [in] ::com
::sun
::star
::geometry
::RealRectangle2D aRect
);
158 //-------------------------------------------------------------------------
160 /** Draws a poly-polygon on the canvas.<p>
162 void drawPolyPolygon
( [in] XPolyPolygon2D xPolyPolygon
);
164 //-------------------------------------------------------------------------
166 /** Draws text on the canvas.<p>
169 Text to render. The text color is the current pen color.
172 Output position of the text. This is the left or right edge,
173 depending on nTextDirection. Output position is always
174 relative to the font baseline.
176 @param nTextDirection
177 A value from the <type>TextDirection</type> collection,
178 denoting the main writing direction for this string. The main
179 writing direction determines the origin of the text output,
180 i.e. the left edge for left-to-right and the right edge for
183 void drawText
( [in] StringContext aText
,
184 [in] ::com
::sun
::star
::geometry
::RealPoint2D aOutPos
,
185 [in] byte nTextDirection
);
187 //-------------------------------------------------------------------------
189 /** Draws the bitmap on the canvas.<p>
195 Left, top position of the bitmap on the destination canvas.
197 void drawBitmap
( [in] XBitmap xBitmap
,
198 [in] ::com
::sun
::star
::geometry
::RealPoint2D aLeftTop
);
200 //-------------------------------------------------------------------------
202 /** Request the associated graphic device for this canvas.<p>
204 A graphic device provides methods specific to the underlying
205 output device capabilities, which are common for all canvases
206 rendering to such a device. This includes device resolution,
207 color space, or bitmap formats.<p>
209 @return the associated <type>XGraphicDevice</type>.
211 XGraphicDevice getDevice
();
213 //-------------------------------------------------------------------------
215 /** Query the underlying <type>XCanvas</type>.<p>
217 @return the canvas interface this object is internally based
222 //-------------------------------------------------------------------------
224 /** Request the font metrics of the current font.<p>
226 @return the font metrics of the currently selected font.
228 FontMetrics getFontMetrics
();
230 //-------------------------------------------------------------------------
232 /** Retrieve currently selected font.<p>
234 @return the font instance that's currently used for rendering
237 XCanvasFont getCurrentFont
();
239 //-------------------------------------------------------------------------
241 /** Retrieve color currently used for lines.
243 com
::sun
::star
::util
::Color getCurrentPenColor
();
245 //-------------------------------------------------------------------------
247 /** Retrieve color currently used for fills
249 com
::sun
::star
::util
::Color getCurrentFillColor
();
251 //-------------------------------------------------------------------------
253 /** Retrieve current clip rect
255 com
::sun
::star
::geometry
::RealRectangle2D getCurrentClipRect
();
257 //-------------------------------------------------------------------------
259 /** Retrieve current transformation matrix
261 com
::sun
::star
::geometry
::AffineMatrix2D getCurrentTransformation
();
263 //-------------------------------------------------------------------------
265 /** Retrieve view state.<p>
267 @return the view state, that would generate matching output,
268 when rendering to an XCanvas instead.
270 ViewState getCurrentViewState
();
272 //-------------------------------------------------------------------------
274 /** Retrieve render state.<p>
277 When true, the Color member of the RenderState is initialized
278 with the current fill color; when false, the current pen color
281 @return the render state, that would generate matching output,
282 when rendering to an XCanvas instead.
284 RenderState getCurrentRenderState
( [in] boolean bUseFillColor
);
286 //-------------------------------------------------------------------------
290 //=============================================================================