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