1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
27 #ifndef __com_sun_star_rendering_XSimpleCanvas_idl__
28 #define __com_sun_star_rendering_XSimpleCanvas_idl__
30 #ifndef __com_sun_star_util_Color_idl__
31 #include
<com
/sun
/star
/util
/Color.idl
>
33 #ifndef __com_sun_star_geometry_RealPoint2D_idl__
34 #include
<com
/sun
/star
/geometry
/RealPoint2D.idl
>
36 #ifndef __com_sun_star_geometry_RealRectangle2D_idl__
37 #include
<com
/sun
/star
/geometry
/RealRectangle2D.idl
>
39 #ifndef __com_sun_star_geometry_AffineMatrix2D_idl__
40 #include
<com
/sun
/star
/geometry
/AffineMatrix2D.idl
>
42 #ifndef __com_sun_star_rendering_StringContext_idl__
43 #include
<com
/sun
/star
/rendering
/StringContext.idl
>
45 #ifndef __com_sun_star_rendering_ViewState_idl__
46 #include
<com
/sun
/star
/rendering
/ViewState.idl
>
48 #ifndef __com_sun_star_rendering_RenderState_idl__
49 #include
<com
/sun
/star
/rendering
/RenderState.idl
>
51 #ifndef __com_sun_star_rendering_FontMetrics_idl__
52 #include
<com
/sun
/star
/rendering
/FontMetrics.idl
>
55 //=============================================================================
57 module com
{ module sun
{ module star
{ module rendering
{
60 interface XCanvasFont
;
62 interface XGraphicDevice
;
63 interface XPolyPolygon2D
;
65 /** Provides the basic graphical output operations for a canvas.<p>
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
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>
77 interface XSimpleCanvas
: com
::sun
::star
::uno
::XInterface
81 This method selects the specified font (or a close substitute)
82 as the current font for text output.<p>
85 The name of the font (like e.g. Arial)
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).
93 When true, selected font is bold.
96 When true, selected font is italic
98 void selectFont
( [in] string sFontName
, [in]double size
, [in] boolean bold
, [in] boolean italic
);
100 //-------------------------------------------------------------------------
102 /** Sets the color used by line and text operations.<p>
104 To disable stroking, simply set this color to something with
105 zero alpha (i.e. fully transparent).<p>
108 RGBA color tuple, interpreted in the sRGB color space.
110 void setPenColor
( [in] com
::sun
::star
::util
::Color nsRgbaColor
);
112 //-------------------------------------------------------------------------
114 /** Sets the fill color.<p>
116 To disable filling, simply set this color to something with
117 zero alpha (i.e. fully transparent).<p>
120 RGBA color tuple, interpreted in the sRGB color space.
122 void setFillColor
( [in] com
::sun
::star
::util
::Color nsRgbaColor
);
124 //-------------------------------------------------------------------------
126 /** Sets the clip to the specified rectangle.<p>
128 void setRectClip
( [in] ::com
::sun
::star
::geometry
::RealRectangle2D aRect
);
130 //-------------------------------------------------------------------------
132 /** Set the current transform matrix.<p>
134 void setTransformation
( [in] ::com
::sun
::star
::geometry
::AffineMatrix2D aTransform
);
136 //-------------------------------------------------------------------------
138 /** Sets a single pixel on the canvas.<p>
140 void drawPixel
( [in] ::com
::sun
::star
::geometry
::RealPoint2D aPoint
);
142 //-------------------------------------------------------------------------
144 /** Draws a line on the canvas.<p>
146 void drawLine
( [in] ::com
::sun
::star
::geometry
::RealPoint2D aStartPoint
,
147 [in] ::com
::sun
::star
::geometry
::RealPoint2D aEndPoint
);
149 //-------------------------------------------------------------------------
151 /** Draws a rectangle on the canvas.<p>
153 void drawRect
( [in] ::com
::sun
::star
::geometry
::RealRectangle2D aRect
);
155 //-------------------------------------------------------------------------
157 /** Draws a poly-polygon on the canvas.<p>
159 void drawPolyPolygon
( [in] XPolyPolygon2D xPolyPolygon
);
161 //-------------------------------------------------------------------------
163 /** Draws text on the canvas.<p>
166 Text to render. The text color is the current pen color.
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.
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
180 void drawText
( [in] StringContext aText
,
181 [in] ::com
::sun
::star
::geometry
::RealPoint2D aOutPos
,
182 [in] byte nTextDirection
);
184 //-------------------------------------------------------------------------
186 /** Draws the bitmap on the canvas.<p>
192 Left, top position of the bitmap on the destination canvas.
194 void drawBitmap
( [in] XBitmap xBitmap
,
195 [in] ::com
::sun
::star
::geometry
::RealPoint2D aLeftTop
);
197 //-------------------------------------------------------------------------
199 /** Request the associated graphic device for this canvas.<p>
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>
206 @return the associated <type>XGraphicDevice</type>.
208 XGraphicDevice getDevice
();
210 //-------------------------------------------------------------------------
212 /** Query the underlying <type>XCanvas</type>.<p>
214 @return the canvas interface this object is internally based
219 //-------------------------------------------------------------------------
221 /** Request the font metrics of the current font.<p>
223 @return the font metrics of the currently selected font.
225 FontMetrics getFontMetrics
();
227 //-------------------------------------------------------------------------
229 /** Retrieve currently selected font.<p>
231 @return the font instance that's currently used for rendering
234 XCanvasFont getCurrentFont
();
236 //-------------------------------------------------------------------------
238 /** Retrieve color currently used for lines.
240 com
::sun
::star
::util
::Color getCurrentPenColor
();
242 //-------------------------------------------------------------------------
244 /** Retrieve color currently used for fills
246 com
::sun
::star
::util
::Color getCurrentFillColor
();
248 //-------------------------------------------------------------------------
250 /** Retrieve current clip rect
252 com
::sun
::star
::geometry
::RealRectangle2D getCurrentClipRect
();
254 //-------------------------------------------------------------------------
256 /** Retrieve current transformation matrix
258 com
::sun
::star
::geometry
::AffineMatrix2D getCurrentTransformation
();
260 //-------------------------------------------------------------------------
262 /** Retrieve view state.<p>
264 @return the view state, that would generate matching output,
265 when rendering to an XCanvas instead.
267 ViewState getCurrentViewState
();
269 //-------------------------------------------------------------------------
271 /** Retrieve render state.<p>
274 When true, the Color member of the RenderState is initialized
275 with the current fill color; when false, the current pen color
278 @return the render state, that would generate matching output,
279 when rendering to an XCanvas instead.
281 RenderState getCurrentRenderState
( [in] boolean bUseFillColor
);
283 //-------------------------------------------------------------------------
287 //=============================================================================