Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / offapi / com / sun / star / rendering / XSimpleCanvas.idl
blob0e81b7f8cb24bbe811b3d8a96d08e1ed8680709a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef __com_sun_star_rendering_XSimpleCanvas_idl__
20 #define __com_sun_star_rendering_XSimpleCanvas_idl__
22 #include <com/sun/star/util/Color.idl>
23 #include <com/sun/star/geometry/RealPoint2D.idl>
24 #include <com/sun/star/geometry/RealRectangle2D.idl>
25 #include <com/sun/star/geometry/AffineMatrix2D.idl>
26 #include <com/sun/star/rendering/StringContext.idl>
27 #include <com/sun/star/rendering/ViewState.idl>
28 #include <com/sun/star/rendering/RenderState.idl>
29 #include <com/sun/star/rendering/FontMetrics.idl>
32 module com { module sun { module star { module rendering {
34 interface XCanvas;
35 interface XCanvasFont;
36 interface XBitmap;
37 interface XGraphicDevice;
38 interface XPolyPolygon2D;
40 /** Provides the basic graphical output operations for a canvas.<p>
42 This interface is a simplified version of the XCanvas
43 interface. It holds explicit state, i.e. the pen and fill color,
44 the current transformation, clip and font are persistently
45 remembered.<p>
47 In contrast to the XCanvas interface, XSimpleCanvas
48 does not distinguish between stroke and fill operations; instead,
49 switching between stroke and fill (or taking both) works by
50 setting appropriate pen and fill colors.<p>
52 interface XSimpleCanvas: com::sun::star::uno::XInterface
54 /** Select a font.<p>
56 This method selects the specified font (or a close substitute)
57 as the current font for text output.<p>
59 @param sFontName
60 The name of the font (like e.g. Arial)
62 @param size
63 The size of the font (note that this is not the usual points
64 unit, but in the same coordinate system as the other rendering
65 operations - usually, device pixel).
67 @param bold
68 When true, selected font is bold.
70 @param italic
71 When true, selected font is italic
73 void selectFont( [in] string sFontName, [in]double size, [in] boolean bold, [in] boolean italic );
76 /** Sets the color used by line and text operations.<p>
78 To disable stroking, simply set this color to something with
79 zero alpha (i.e. fully transparent).<p>
81 @param nsRgbaColor
82 RGBA color tuple, interpreted in the sRGB color space.
84 void setPenColor( [in] com::sun::star::util::Color nsRgbaColor );
87 /** Sets the fill color.<p>
89 To disable filling, simply set this color to something with
90 zero alpha (i.e. fully transparent).<p>
92 @param nsRgbaColor
93 RGBA color tuple, interpreted in the sRGB color space.
95 void setFillColor( [in] com::sun::star::util::Color nsRgbaColor );
98 /** Sets the clip to the specified rectangle.<p>
100 void setRectClip( [in] ::com::sun::star::geometry::RealRectangle2D aRect );
103 /** Set the current transform matrix.<p>
105 void setTransformation( [in] ::com::sun::star::geometry::AffineMatrix2D aTransform );
108 /** Sets a single pixel on the canvas.<p>
110 void drawPixel( [in] ::com::sun::star::geometry::RealPoint2D aPoint );
113 /** Draws a line on the canvas.<p>
115 void drawLine( [in] ::com::sun::star::geometry::RealPoint2D aStartPoint,
116 [in] ::com::sun::star::geometry::RealPoint2D aEndPoint );
119 /** Draws a rectangle on the canvas.<p>
121 void drawRect( [in] ::com::sun::star::geometry::RealRectangle2D aRect );
124 /** Draws a poly-polygon on the canvas.<p>
126 void drawPolyPolygon( [in] XPolyPolygon2D xPolyPolygon );
129 /** Draws text on the canvas.<p>
131 @param aText
132 Text to render. The text color is the current pen color.
134 @param aOutPos
135 Output position of the text. This is the left or right edge,
136 depending on nTextDirection. Output position is always
137 relative to the font baseline.
139 @param nTextDirection
140 A value from the TextDirection collection,
141 denoting the main writing direction for this string. The main
142 writing direction determines the origin of the text output,
143 i.e. the left edge for left-to-right and the right edge for
144 right-to-left text.
146 void drawText( [in] StringContext aText,
147 [in] ::com::sun::star::geometry::RealPoint2D aOutPos,
148 [in] byte nTextDirection );
151 /** Draws the bitmap on the canvas.<p>
153 @param xBitmap
154 Bitmap to render
156 @param aLeftTop
157 Left, top position of the bitmap on the destination canvas.
159 void drawBitmap( [in] XBitmap xBitmap,
160 [in] ::com::sun::star::geometry::RealPoint2D aLeftTop );
163 /** Request the associated graphic device for this canvas.<p>
165 A graphic device provides methods specific to the underlying
166 output device capabilities, which are common for all canvases
167 rendering to such a device. This includes device resolution,
168 color space, or bitmap formats.<p>
170 @return the associated XGraphicDevice.
172 XGraphicDevice getDevice();
175 /** Query the underlying XCanvas.<p>
177 @return the canvas interface this object is internally based
180 XCanvas getCanvas();
183 /** Request the font metrics of the current font.<p>
185 @return the font metrics of the currently selected font.
187 FontMetrics getFontMetrics();
190 /** Retrieve currently selected font.<p>
192 @return the font instance that's currently used for rendering
193 text.
195 XCanvasFont getCurrentFont();
198 /** Retrieve color currently used for lines.
200 com::sun::star::util::Color getCurrentPenColor();
203 /** Retrieve color currently used for fills
205 com::sun::star::util::Color getCurrentFillColor();
208 /** Retrieve current clip rect
210 com::sun::star::geometry::RealRectangle2D getCurrentClipRect();
213 /** Retrieve current transformation matrix
215 com::sun::star::geometry::AffineMatrix2D getCurrentTransformation();
218 /** Retrieve view state.<p>
220 @return the view state, that would generate matching output,
221 when rendering to an XCanvas instead.
223 ViewState getCurrentViewState();
226 /** Retrieve render state.<p>
228 @param bUseFillColor
229 When true, the Color member of the RenderState is initialized
230 with the current fill color; when false, the current pen color
231 is used.
233 @return the render state, that would generate matching output,
234 when rendering to an XCanvas instead.
236 RenderState getCurrentRenderState( [in] boolean bUseFillColor );
242 }; }; }; };
244 #endif
246 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */