Language

The Free and Open Productivity Suite
Released: Apache OpenOffice 4.1.15

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

unpublished interface XCanvas
Base Interfaces
XCanvas
┗ ::com::sun::star::uno::XInterface

::com::sun::star::uno::XInterface
Description
Central interface for rendering.

This is the central interface for graphical output production, and the place where all draw methods are located.

Some notes are in order to explain the concepts used here. The XCanvas interface is free of client-modifiable state, i.e. it can be used safely and without external synchronization in a multi-threaded environment. On the other hand, this implies that for nearly every canvas operation, external state is required. This is provided by ViewState and RenderState in a unified fashion, supplemented by a few extra state parameters for some methods (e.g. textured polygons or text rendering).

When used careless, this scheme can be inefficient to some extend, because internally, view, render and other states have to be combined before rendering. This is especially expensive for complex clip polygons, i.e. when both ViewState and RenderState have a complex clip polygon set, which have to be intersected before rendering. It is therefore recommended to combine ViewState and RenderState already at the client side, when objects are organized in a hierarchical way: the classic example are grouped draw shapes, whose parent group object imposes a common clipping and a common transformation on its siblings. The group object would therefore merge the ViewState and the RenderState it is called with into a new ViewState , and call its siblings with a RenderState containing only the local offset (and no extra clipping).

Furtheron, this stateless nature provides easy ways for caching. Every non-trivial operation on XCanvas returns a cache object, which, when called to redraw, renders the primitive usually much more quickly than the original method. Note that such caching is a lot more complicated, should the actual rendering a method yields depend on internal state (which is the case e.g. for the ::com::sun::star::drawing::XGraphics interface).

Since
OOo 2.0.0

Methods' Summary
drawPoint Draw a point in device resolution on the device.  
drawLine Draw a line in device resolution width (i.e. one device pixel wide).  
drawBezier Draw a cubic bezier curve in device resolution width (i.e. one device pixel wide).  
drawPolyPolygon Draw a poly-polygon in device resolution line width (i.e. the lines are one device pixel wide).  
strokePolyPolygon Stroke each polygon of the provided poly-polygon with the specified stroke attributes.  
strokeTexturedPolyPolygon Stroke each polygon of the provided poly-polygon with the specified stroke attributes, fill the stroked outline with the specified texture graphics.  
strokeTextureMappedPolyPolygon Stroke each polygon of the provided poly-polygon with the specified stroke attributes, fill the stroked outline with the specified texture graphics, map the texture to the outline via the specified texture mapping.  
queryStrokeShapes Query the polygonal representation of the stroke outlines, as it would be generated by the strokePolyPolygon methods.  
fillPolyPolygon Fill the given poly-polygon.  
fillTexturedPolyPolygon Fill the given poly-polygon with a texture.  
fillTextureMappedPolyPolygon Fill the given poly-polygon with a mapped texture.  
createFont Create a suitable font for the specified font description.  
queryAvailableFonts Query font information, specific to this canvas.  
drawText Draw the text given by the substring of the specified string with the given font.  
drawTextLayout Draw the formatted text given by the text layout.  
drawBitmap Render the given bitmap.  
drawBitmapModulated Render the given bitmap, with a global color modulation.  
getDevice Request the associated graphic device for this canvas.  
Methods' Details
drawPoint
void
drawPoint( [in] ::com::sun::star::geometry::RealPoint2D  aPoint,
[in] ViewState  aViewState,
[in] RenderState  aRenderState )
raises( ::com::sun::star::lang::IllegalArgumentException );

Description
Draw a point in device resolution on the device.
Parameter aPoint
The point to draw.
Parameter aViewState
The viewstate to be used when drawing this point.
Parameter aRenderState
The renderstate to be used when drawing this point.
Throws
com::sun::star::lang::IllegalArgumentException if one of the view and renderstate parameters are outside the specified range.
drawLine
void
drawLine( [in] ::com::sun::star::geometry::RealPoint2D  aStartPoint,
[in] ::com::sun::star::geometry::RealPoint2D  aEndPoint,
[in] ViewState  aViewState,
[in] RenderState  aRenderState )
raises( ::com::sun::star::lang::IllegalArgumentException );

Description
Draw a line in device resolution width (i.e. one device pixel wide).
Parameter aStartPoint
The start point of the line to draw.
Parameter aEndPoint
The end point of the line to draw.
Parameter aViewState
The viewstate to be used when drawing this line.
Parameter aRenderState
The renderstate to be used when drawing this line.
Throws
com::sun::star::lang::IllegalArgumentException if one of the view and renderstate parameters are outside the specified range.
drawBezier
void
drawBezier( [in] ::com::sun::star::geometry::RealBezierSegment2D  aBezierSegment,
[in] ::com::sun::star::geometry::RealPoint2D  aEndPoint,
[in] ViewState  aViewState,
[in] RenderState  aRenderState )
raises( ::com::sun::star::lang::IllegalArgumentException );

Description
Draw a cubic bezier curve in device resolution width (i.e. one device pixel wide).
Parameter aBezierSegment
The start and the two control points of the bezier curve.
Parameter aEndPoint
The end point of the bezier curve.
Parameter aViewState
The viewstate to be used when drawing this curve.
Parameter aRenderState
The renderstate to be used when drawing this curve.
Throws
com::sun::star::lang::IllegalArgumentException if one of the view and renderstate parameters are outside the specified range.
drawPolyPolygon
XCachedPrimitive
drawPolyPolygon( [in] XPolyPolygon2D  xPolyPolygon,
[in] ViewState  aViewState,
[in] RenderState  aRenderState )
raises( ::com::sun::star::lang::IllegalArgumentException );

Description
Draw a poly-polygon in device resolution line width (i.e. the lines are one device pixel wide).
Parameter xPolyPolygon
The poly-polygon to draw.
Parameter aViewState
The viewstate to be used when drawing this polygon.
Parameter aRenderState
The renderstate to be used when drawing this polygon.
Returns
a handle to the cached rendering output.
Throws
com::sun::star::lang::IllegalArgumentException if one of the view and renderstate parameters are outside the specified range.
strokePolyPolygon
XCachedPrimitive
strokePolyPolygon( [in] XPolyPolygon2D  xPolyPolygon,
[in] ViewState  aViewState,
[in] RenderState  aRenderState,
[in] StrokeAttributes  aStrokeAttributes )
raises( ::com::sun::star::lang::IllegalArgumentException );

Description
Stroke each polygon of the provided poly-polygon with the specified stroke attributes.

This method considers the stroking of all polygons as an atomic operation in relation to the RenderState 's ::CompositeOperationy operation. That means, overlapping strokes from distinct polygons will look exactly as overlapping segments of the same polygon, even with transparency.

Parameter xPolyPolygon
The poly-polygon to render.
Parameter aViewState
The viewstate to be used when stroking this polygon.
Parameter aRenderState
The renderstate to be used when stroking this polygon.
Parameter aStrokeAttributes
Further attributes used to parameterize the stroking.
Returns
a handle to the cached rendering output.
Throws
com::sun::star::lang::IllegalArgumentException if one of the view and renderstate parameters are outside the specified range.
strokeTexturedPolyPolygon
XCachedPrimitive
strokeTexturedPolyPolygon( [in] XPolyPolygon2D  xPolyPolygon,
[in] ViewState  aViewState,
[in] RenderState  aRenderState,
[in] sequence< Texture >  aTextures,
[in] StrokeAttributes  aStrokeAttributes )
raises( ::com::sun::star::lang::IllegalArgumentException,
VolatileContentDestroyedException );

Description
Stroke each polygon of the provided poly-polygon with the specified stroke attributes, fill the stroked outline with the specified texture graphics.

This method considers the stroking of all polygons as an atomic operation in relation to the RenderState 's ::CompositeOp operation. That means, overlapping strokes from distinct polygons will look exactly as overlapping segments of the same polygon, even with transparency.

Parameter xPolyPolygon
The poly-polygon to render.
Parameter aViewState
The viewstate to be used when strokes this polygon.
Parameter aRenderState
The renderstate to be used when stroking this polygon.
Parameter aTextures
A sequence of texture definitions, with which to fill the stroked area.
Parameter aStrokeAttributes
Further attributes used to parameterize the stroking.
Returns
a handle to the cached rendering output.
Throws
com::sun::star::lang::IllegalArgumentException if one of the view and renderstate parameters are outside the specified range.
Throws
VolatileContentDestroyedException if a texture bitmap was volatile, and the content was destroyed before the rendering could take place.
strokeTextureMappedPolyPolygon
XCachedPrimitive
strokeTextureMappedPolyPolygon( [in] XPolyPolygon2D  xPolyPolygon,
[in] ViewState  aViewState,
[in] RenderState  aRenderState,
[in] sequence< Texture >  aTextures,
[in] ::com::sun::star::geometry::XMapping2D  xMapping,
[in] StrokeAttributes  aStrokeAttributes )
raises( ::com::sun::star::lang::IllegalArgumentException,
VolatileContentDestroyedException );

Description
Stroke each polygon of the provided poly-polygon with the specified stroke attributes, fill the stroked outline with the specified texture graphics, map the texture to the outline via the specified texture mapping.

This method considers the stroking of all polygons as an atomic operation in relation to the RenderState 's ::CompositeOp operation. That means, overlapping strokes from distinct polygons will look exactly as overlapping segments of the same polygon, even with transparency.

Parameter xPolyPolygon
The poly-polygon to render.
Parameter aViewState
The viewstate to be used when stroking this polygon.
Parameter aRenderState
The renderstate to be used when stroking this polygon.
Parameter aTextures
A sequence of texture definitions, with which to fill the stroked area.
Parameter xMapping
A bilinear mapping function which defines the warping of the textures on the output area.
Parameter aStrokeAttributes
Further attributes used to parameterize the stroking.
Returns
a handle to the cached rendering output.
Throws
com::sun::star::lang::IllegalArgumentException if one of the view and renderstate parameters are outside the specified range.
Throws
VolatileContentDestroyedException if a texture bitmap was volatile, and the content was destroyed before the rendering could take place.
queryStrokeShapes
XPolyPolygon2D
queryStrokeShapes( [in] XPolyPolygon2D  xPolyPolygon,
[in] ViewState  aViewState,
[in] RenderState  aRenderState,
[in] StrokeAttributes  aStrokeAttributes )
raises( ::com::sun::star::lang::IllegalArgumentException );

Description
Query the polygonal representation of the stroke outlines, as it would be generated by the strokePolyPolygon methods.

This method can be used to e.g. set a clipping which covers the same area as a stroke.

Parameter xPolyPolygon
The poly-polygon to render.
Parameter aViewState
The viewstate to be used when generating the outline.
Parameter aRenderState
The renderstate to be used when generating the outline.
Parameter aStrokeAttributes
Further attributes used to parameterize the stroking.
Returns
a poly-polygon describing the outline of the stroked area.
Throws
com::sun::star::lang::IllegalArgumentException if one of the view and renderstate parameters are outside the specified range.
fillPolyPolygon
XCachedPrimitive
fillPolyPolygon( [in] XPolyPolygon2D  xPolyPolygon,
[in] ViewState  aViewState,
[in] RenderState  aRenderState )
raises( ::com::sun::star::lang::IllegalArgumentException );

Description
Fill the given poly-polygon.

This method fills the given poly-polygon according to the RenderState 's color and the poly-polygon's fill rule.

Parameter xPolyPolygon
The poly-polygon to render.
Parameter aViewState
The viewstate to be used when filling this polygon.
Parameter aRenderState
The renderstate to be used when filling this polygon.
Returns
a handle to the cached rendering output.
Throws
com::sun::star::lang::IllegalArgumentException if one of the view and renderstate parameters are outside the specified range.
fillTexturedPolyPolygon
XCachedPrimitive
fillTexturedPolyPolygon( [in] XPolyPolygon2D  xPolyPolygon,
[in] ViewState  aViewState,
[in] RenderState  aRenderState,
[in] sequence< Texture >  xTextures )
raises( ::com::sun::star::lang::IllegalArgumentException,
VolatileContentDestroyedException );

Description
Fill the given poly-polygon with a texture.

This method fills the given poly-polygon according to the RenderState 's color, the given textures and poly-polygon's fill rule.

Parameter xPolyPolygon
The poly-polygon to render.
Parameter aViewState
The viewstate to be used when filling this polygon.
Parameter aRenderState
The renderstate to be used when filling this polygon.
Parameter aTextures
A sequence of texture definitions, with which to fill the polygonal area.
Returns
a handle to the cached rendering output.
Throws
com::sun::star::lang::IllegalArgumentException if one of the view and renderstate parameters are outside the specified range.
Throws
VolatileContentDestroyedException if a texture bitmap was volatile, and the content was destroyed before the rendering could take place.
fillTextureMappedPolyPolygon
XCachedPrimitive
fillTextureMappedPolyPolygon( [in] XPolyPolygon2D  xPolyPolygon,
[in] ViewState  aViewState,
[in] RenderState  aRenderState,
[in] sequence< Texture >  xTextures,
[in] ::com::sun::star::geometry::XMapping2D  xMapping )
raises( ::com::sun::star::lang::IllegalArgumentException,
VolatileContentDestroyedException );

Description
Fill the given poly-polygon with a mapped texture.

This method fills the given poly-polygon according to the RenderState 's color, the given textures and poly-polygon's fill rule. The texture is mapped to the poly-polygon's interior via the given texture mapping.

Parameter xPolyPolygon
The poly-polygon to render.
Parameter aViewState
The viewstate to be used when filling this polygon.
Parameter aRenderState
The renderstate to be used when filling this polygon.
Parameter aTextures
A sequence of texture definitions, with which to fill the polygonal area.
Parameter xMapping
A bilinear mapping function which defines the warping of the textures on the output area.
Returns
a handle to the cached rendering output.
Throws
com::sun::star::lang::IllegalArgumentException if one of the view and renderstate parameters are outside the specified range.
Throws
VolatileContentDestroyedException if a texture bitmap was volatile, and the content was destroyed before the rendering could take place.
createFont
XCanvasFont
createFont( [in] FontRequest  aFontRequest,
[in] sequence< ::com::sun::star::beans::PropertyValue >  aExtraFontProperties,
[in] ::com::sun::star::geometry::Matrix2D  aFontMatrix )
raises( ::com::sun::star::lang::IllegalArgumentException );

Description
Create a suitable font for the specified font description.
Parameter aFontRequest
Parameter aExtraFontProperties
Additional font properties to be applied when selecting this font. Normally, you should not need this parameter. Currently, the following properties are recognized:
    Kerning: a ::double between 0 and 1, where 0 completely disables kerning. Whether kerning is on or off by default is font-dependent. IsEmphasisMarks: a ::boolean , where true enables automatic placements of emphasis marks, e.g. for Hebrew. The default value, if this property is not specified, is false . ExpandedSpacing: a ::double value which is added between all cell distances for this font. The default value for this property is zero. Use negative values for condensed output, and positive values for expanded output. OptionalLayoutFeatures: a sequence of ::PropertyValue listing font-specific optional layout features, like glyph variants.
Parameter aFontMatrix
Font-specific transformation matrix, which affects both the glyphs as well as the advancement.
Returns
the requested font, or an invalid reference, if the request failed.
Throws
com::sun::star::lang::IllegalArgumentException if one of the parameters is not within the allowed range.
queryAvailableFonts
sequence< FontInfo >
queryAvailableFonts( [in] FontInfo  aFilter,
[in] sequence< ::com::sun::star::beans::PropertyValue >  aFontProperties )
raises( ::com::sun::star::lang::IllegalArgumentException );

Description
Query font information, specific to this canvas.

Parameter aFilter
Filter parameter to reduce the list of returned fonts. Every member of FontInfo that is not the empty string or the "don't care" value restricts the list of returned fonts to contain only those that have the specified attribute.
Parameter xFontProperties
This interface can provide additional font properties to filter the list of available fonts against.
Returns
the list of fonts matching the filter set.
Throws
com::sun::star::lang::IllegalArgumentException if one of the font properties are invalid or not recognized, or if one of the FontInfo members is not within the permitted range.
drawText
XCachedPrimitive
drawText( [in] StringContext  aText,
[in] XCanvasFont  xFont,
[in] ViewState  aViewState,
[in] RenderState  aRenderState,
[in] byte  nTextDirection )
raises( ::com::sun::star::lang::IllegalArgumentException );

Description
Draw the text given by the substring of the specified string with the given font.

The local origin of this output operation is either the left end of the text baseline, for textDirection equal LEFT_TO_RIGHT, or the right end of the baseline, for textDirection equal to RIGHT_TO_LEFT, respectively.

Parameter aText
The text to output.
Parameter xFont
The font retrieved from this canvas to be used when drawing the text.
Parameter aViewState
The viewstate to be used when drawing this text.
Parameter aRenderState
The renderstate to be used when drawing this text.
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.
Returns
a handle to the cached rendering output.
Throws
com::sun::star::lang::IllegalArgumentException if one of the view and renderstate parameters are outside the specified range.
drawTextLayout
XCachedPrimitive
drawTextLayout( [in] XTextLayout  xLayoutetText,
[in] ViewState  aViewState,
[in] RenderState  aRenderState )
raises( ::com::sun::star::lang::IllegalArgumentException );

Description
Draw the formatted text given by the text layout.

The glyphs as represented by the text layout are always output with the reference position being the leftmost edge of the layout object's baseline. If the layout contains more than one baseline, the baseline of the first strong character in logical order is used here (strong in this context means that the character can be unambiguously assigned to a unicode script).

Parameter xLayoutetText
An interface to the readily layouted text, obtained from a XCanvasFont created at this canvas. The text layout already carries intrinsic font information.
Parameter aViewState
The viewstate to be used when drawing this text.
Parameter aRenderState
The renderstate to be used when drawing this text.
Returns
a handle to the cached rendering output.
Throws
com::sun::star::lang::IllegalArgumentException if one of the view and renderstate parameters are outside the specified range.
drawBitmap
XCachedPrimitive
drawBitmap( [in] XBitmap  xBitmap,
[in] ViewState  aViewState,
[in] RenderState  aRenderState )
raises( ::com::sun::star::lang::IllegalArgumentException,
VolatileContentDestroyedException );

Description
Render the given bitmap.

This method renders the bitmap, at a position and shape as specified by the combined view and render transformations. For fast render speed, the bitmap should be created by the corresponding XGraphicDevice 's XGraphicDevice::createCompatibleBitmap() method.

Parameter xBitmap
The bitmap to render.
Parameter aViewState
The viewstate to be used when drawing this text.
Parameter aRenderState
The renderstate to be used when drawing this text.
Returns
a handle to the cached rendering output.
Throws
com::sun::star::lang::IllegalArgumentException if one of the view and renderstate parameters are outside the specified range.
Throws
VolatileContentDestroyedException if a texture bitmap was volatile, and the content was destroyed before the rendering could take place.
drawBitmapModulated
XCachedPrimitive
drawBitmapModulated( [in] XBitmap  xBitmap,
[in] ViewState  aViewState,
[in] RenderState  aRenderState )
raises( ::com::sun::star::lang::IllegalArgumentException,
VolatileContentDestroyedException );

Description
Render the given bitmap, with a global color modulation.

This method renders the bitmap, at a position and shape as specified by the combined view and render transformations. For fast render speed, the bitmap should be created by the corresponding XGraphicDevice 's XGraphicDevice::createCompatibleBitmap() method. The bitmap's color channel values are multiplied with the device color values as specified in the render state.

Parameter xBitmap
The bitmap to render.
Parameter aViewState
The viewstate to be used when drawing this text.
Parameter aRenderState
The renderstate to be used when drawing this text. The device color entry in the renderstate is multiplied with every pixel color value, and only the result is rendered into the canvas. If, for example, the bitmap should be rendered with increased global transparency, set all device color channels to 1.0, except for the alpha channel, which should be set to the desired transparency.
Returns
a handle to the cached rendering output.
Throws
com::sun::star::lang::IllegalArgumentException if one of the view and renderstate parameters are outside the specified range.
Throws
VolatileContentDestroyedException if a texture bitmap was volatile, and the content was destroyed before the rendering could take place.
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 .
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.