Language

The Free and Open Productivity Suite
Released: Apache OpenOffice 4.1.15

API

SDK

Tips ‘n’ Tricks

Miscellaneous


:: com :: sun :: star :: rendering ::

unpublished interface XSimpleCanvas
Usage Restrictions
not published
Description
Provides the basic graphical output operations for a canvas.

This interface is a simplified version of the XCanvas interface. It holds explicit state, i.e. the pen and fill color, the current transformation, clip and font are persistently remembered.

In contrast to the XCanvas interface, XSimpleCanvas does not distinguish between stroke and fill operations; instead, switching between stroke and fill (or taking both) works by setting appropriate pen and fill colors.


Methods' Summary
selectFont Select a font. 
setPenColor Sets the color used by line and text operations. 
setFillColor Sets the fill color. 
setRectClip Sets the clip to the specified rectangle. 
setTransformation Set the current transform matrix. 
drawPixel Sets a single pixel on the canvas. 
drawLine Draws a line on the canvas. 
drawRect Draws a rectangle on the canvas. 
drawPolyPolygon Draws a poly-polygon on the canvas. 
drawText Draws text on the canvas. 
drawBitmap Draws the bitmap on the canvas. 
getDevice Request the associated graphic device for this canvas. 
getCanvas Query the underlying XCanvas
getFontMetrics Request the font metrics of the current font. 
getCurrentFont Retrieve currently selected font. 
getCurrentPenColor Retrieve color currently used for lines.  
getCurrentFillColor Retrieve color currently used for fills  
getCurrentClipRect Retrieve current clip rect  
getCurrentTransformation Retrieve current transformation matrix  
getCurrentViewState Retrieve view state. 
getCurrentRenderState Retrieve render state. 
Methods' Details
selectFont
void
selectFont( [in] string  sFontName,
[in] double  size,
[in] boolean  bold,
[in] boolean  italic );

Description
Select a font.

This method selects the specified font (or a close substitute) as the current font for text output.

Parameter sFontName
The name of the font (like e.g. Arial)
Parameter size
The size of the font (note that this is not the usual points unit, but in the same coordinate system as the other rendering operations - usually, device pixel).
Parameter bold
When true, selected font is bold.
Parameter italic
When true, selected font is italic
setPenColor
void
setPenColor( [in] ::com::sun::star::util::Color  nsRgbaColor );

Description
Sets the color used by line and text operations.

To disable stroking, simply set this color to something with zero alpha (i.e. fully transparent).

Parameter nsRgbaColor
RGBA color tuple, interpreted in the sRGB color space.
setFillColor
void
setFillColor( [in] ::com::sun::star::util::Color  nsRgbaColor );

Description
Sets the fill color.

To disable filling, simply set this color to something with zero alpha (i.e. fully transparent).

Parameter nsRgbaColor
RGBA color tuple, interpreted in the sRGB color space.
setRectClip
void
setRectClip( [in] ::com::sun::star::geometry::RealRectangle2D  aRect );

Description
Sets the clip to the specified rectangle.

setTransformation
void
setTransformation( [in] ::com::sun::star::geometry::AffineMatrix2D  aTransform );

Description
Set the current transform matrix.

drawPixel
void
drawPixel( [in] ::com::sun::star::geometry::RealPoint2D  aPoint );

Description
Sets a single pixel on the canvas.

drawLine
void
drawLine( [in] ::com::sun::star::geometry::RealPoint2D  aStartPoint,
[in] ::com::sun::star::geometry::RealPoint2D  aEndPoint );

Description
Draws a line on the canvas.

drawRect
void
drawRect( [in] ::com::sun::star::geometry::RealRectangle2D  aRect );

Description
Draws a rectangle on the canvas.

drawPolyPolygon
void
drawPolyPolygon( [in] XPolyPolygon2D  xPolyPolygon );

Description
Draws a poly-polygon on the canvas.

drawText
void
drawText( [in] StringContext  aText,
[in] ::com::sun::star::geometry::RealPoint2D  aOutPos,
[in] byte  nTextDirection );

Description
Draws text on the canvas.

Parameter aText
Text to render. The text color is the current pen color.
Parameter aOutPos
Output position of the text. This is the left or right edge, depending on nTextDirection. Output position is always relative to the font baseline.
Parameter nTextDirection
A value from the TextDirection collection, denoting the main writing direction for this string. The main writing direction determines the origin of the text output, i.e. the left edge for left-to-right and the right edge for right-to-left text.
drawBitmap
void
drawBitmap( [in] XBitmap  xBitmap,
[in] ::com::sun::star::geometry::RealPoint2D  aLeftTop );

Description
Draws the bitmap on the canvas.

Parameter xBitmap
Bitmap to render
Parameter aLeftTop
Left, top position of the bitmap on the destination canvas.
getDevice
XGraphicDevice
getDevice();

Description
Request the associated graphic device for this canvas.

A graphic device provides methods specific to the underlying output device capabilities, which are common for all canvases rendering to such a device. This includes device resolution, color space, or bitmap formats.

Returns
the associated XGraphicDevice.
getCanvas
XCanvas
getCanvas();

Description
Query the underlying XCanvas.

Returns
the canvas interface this object is internally based on.
getFontMetrics
FontMetrics
getFontMetrics();

Description
Request the font metrics of the current font.

Returns
the font metrics of the currently selected font.
getCurrentFont
XCanvasFont
getCurrentFont();

Description
Retrieve currently selected font.

Returns
the font instance that's currently used for rendering text.
getCurrentPenColor
::com::sun::star::util::Color
getCurrentPenColor();

Description
Retrieve color currently used for lines.
getCurrentFillColor
::com::sun::star::util::Color
getCurrentFillColor();

Description
Retrieve color currently used for fills
getCurrentClipRect
::com::sun::star::geometry::RealRectangle2D
getCurrentClipRect();

Description
Retrieve current clip rect
getCurrentTransformation
::com::sun::star::geometry::AffineMatrix2D
getCurrentTransformation();

Description
Retrieve current transformation matrix
getCurrentViewState
ViewState
getCurrentViewState();

Description
Retrieve view state.

Returns
the view state, that would generate matching output, when rendering to an XCanvas instead.
getCurrentRenderState
RenderState
getCurrentRenderState( [in] boolean  bUseFillColor );

Description
Retrieve render state.

Parameter bUseFillColor
When true, the Color member of the RenderState is initialized with the current fill color; when false, the current pen color is used.
Returns
the render state, that would generate matching output, when rendering to an XCanvas instead.
Top of Page

Apache Software Foundation

Copyright & License | Privacy | Contact Us | Donate | Thanks

Apache, OpenOffice, OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. The Apache feather logo is a trademark of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.