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