LibreOffice
LibreOffice 24.2 SDK API Reference
|
Central interface for rendering. More...
import"XCanvas.idl";
Public Member Functions | |
void | clear () |
Clear the whole canvas area. More... | |
void | drawPoint ([in] ::com::sun::star::geometry::RealPoint2D aPoint, [in] ViewState aViewState, [in] RenderState aRenderState) raises (com::sun::star::lang::IllegalArgumentException) |
Draw a point in device resolution on the device. More... | |
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) |
Draw a line in device resolution width (i.e. More... | |
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) |
Draw a cubic Bezier curve in device resolution width (i.e. More... | |
XCachedPrimitive | drawPolyPolygon ([in] XPolyPolygon2D xPolyPolygon, [in] ViewState aViewState, [in] RenderState aRenderState) raises (com::sun::star::lang::IllegalArgumentException) |
Draw a poly-polygon in device resolution line width (i.e. More... | |
XCachedPrimitive | strokePolyPolygon ([in] XPolyPolygon2D xPolyPolygon, [in] ViewState aViewState, [in] RenderState aRenderState, [in] StrokeAttributes aStrokeAttributes) raises (com::sun::star::lang::IllegalArgumentException) |
Stroke each polygon of the provided poly-polygon with the specified stroke attributes. More... | |
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) |
Stroke each polygon of the provided poly-polygon with the specified stroke attributes, fill the stroked outline with the specified texture graphics. More... | |
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) |
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. More... | |
XPolyPolygon2D | queryStrokeShapes ([in] XPolyPolygon2D xPolyPolygon, [in] ViewState aViewState, [in] RenderState aRenderState, [in] StrokeAttributes aStrokeAttributes) raises (com::sun::star::lang::IllegalArgumentException) |
Query the polygonal representation of the stroke outlines, as it would be generated by the strokePolyPolygon methods. More... | |
XCachedPrimitive | fillPolyPolygon ([in] XPolyPolygon2D xPolyPolygon, [in] ViewState aViewState, [in] RenderState aRenderState) raises (com::sun::star::lang::IllegalArgumentException) |
Fill the given poly-polygon. More... | |
XCachedPrimitive | fillTexturedPolyPolygon ([in] XPolyPolygon2D xPolyPolygon, [in] ViewState aViewState, [in] RenderState aRenderState, [in] sequence< Texture > xTextures) raises (com::sun::star::lang::IllegalArgumentException, VolatileContentDestroyedException) |
Fill the given poly-polygon with a texture. More... | |
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) |
Fill the given poly-polygon with a mapped texture. More... | |
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) |
Create a suitable font for the specified font description. More... | |
sequence< FontInfo > | queryAvailableFonts ([in] FontInfo aFilter, [in] sequence< ::com::sun::star::beans::PropertyValue > aFontProperties) raises (com::sun::star::lang::IllegalArgumentException) |
Query font information, specific to this canvas. More... | |
XCachedPrimitive | drawText ([in] StringContext aText, [in] XCanvasFont xFont, [in] ViewState aViewState, [in] RenderState aRenderState, [in] byte nTextDirection) raises (com::sun::star::lang::IllegalArgumentException) |
Draw the text given by the substring of the specified string with the given font. More... | |
XCachedPrimitive | drawTextLayout ([in] XTextLayout xLayoutetText, [in] ViewState aViewState, [in] RenderState aRenderState) raises (com::sun::star::lang::IllegalArgumentException) |
Draw the formatted text given by the text layout. More... | |
XCachedPrimitive | drawBitmap ([in] XBitmap xBitmap, [in] ViewState aViewState, [in] RenderState aRenderState) raises (com::sun::star::lang::IllegalArgumentException, VolatileContentDestroyedException) |
Render the given bitmap. More... | |
XCachedPrimitive | drawBitmapModulated ([in] XBitmap xBitmap, [in] ViewState aViewState, [in] RenderState aRenderState) raises (com::sun::star::lang::IllegalArgumentException, VolatileContentDestroyedException) |
Render the given bitmap, with a global color modulation. More... | |
XGraphicDevice | getDevice () |
Request the associated graphic device for this canvas. More... | |
Public Member Functions inherited from XInterface | |
any | queryInterface ([in] type aType) |
queries for a new interface to an existing UNO object. More... | |
void | acquire () |
increases the reference counter by one. More... | |
void | release () |
decreases the reference counter by one. More... | |
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).
Further on, this stateless nature provides easy ways for caching. Every non-trivial operation on XCanvas can return 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::awt::XGraphics interface). Please note, though, that deciding whether to return an XCachedPrimitive is completely up to the implementation - don't rely on the methods returning something (this is because there might be cases when returning such a cache object will actually be a pessimization, since it involves memory allocation and comparisons).
Things that need more than a small, fixed amount of data are encapsulated in own interfaces, e.g. polygons and bitmaps. You can, in principle, roll your own implementations of these interfaces, wrap it around your internal representation of polygons and bitmaps, and render them. It might just not be overly fast, because the XCanvas would need to convert for each render call. It is therefore recommended to create such objects via the XGraphicDevice factory (to be retrieved from every canvas object via the getDevice() call) - they will then internally optimize to the underlying graphics subsystem.
void clear | ( | ) |
Clear the whole canvas area.
This method clears the whole canvas area to the device default color (e.g. white for a printer, transparent for an XCustomSprite).
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 | |
) |
Create a suitable font for the specified font description.
aFontRequest | |
aExtraFontProperties | Additional font properties to be applied when selecting this font. Normally, you should not need this parameter. Currently, the following property is recognized: |
aFontMatrix | Font-specific transformation matrix, which affects both the glyphs as well as the advancement. |
com::sun::star::lang::IllegalArgumentException | if one of the parameters is not within the allowed range. |
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 | |
) |
Draw a cubic Bezier curve in device resolution width (i.e.
one device pixel wide).
aBezierSegment | The start and the two control points of the Bezier curve. |
aEndPoint | The end point of the Bezier curve. |
aViewState | The view state to be used when drawing this curve. |
aRenderState | The render state to be used when drawing this curve. |
com::sun::star::lang::IllegalArgumentException | if one of the view and render state parameters are outside the specified range. |
XCachedPrimitive drawBitmap | ( | [in] XBitmap | xBitmap, |
[in] ViewState | aViewState, | ||
[in] RenderState | aRenderState | ||
) | |||
raises | ( | com::sun::star::lang::IllegalArgumentException, | |
VolatileContentDestroyedException | |||
) |
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.
xBitmap | The bitmap to render. |
aViewState | The view state to be used when drawing this text. |
aRenderState | The render state to be used when drawing this text. |
com::sun::star::lang::IllegalArgumentException | if one of the view and render state parameters are outside the specified range. |
VolatileContentDestroyedException | if a texture bitmap was volatile, and the content was destroyed before the rendering could take place. |
XCachedPrimitive drawBitmapModulated | ( | [in] XBitmap | xBitmap, |
[in] ViewState | aViewState, | ||
[in] RenderState | aRenderState | ||
) | |||
raises | ( | com::sun::star::lang::IllegalArgumentException, | |
VolatileContentDestroyedException | |||
) |
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.
xBitmap | The bitmap to render. |
aViewState | The view state to be used when drawing this text. |
aRenderState | The render state to be used when drawing this text. The device color entry in the render state 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. |
com::sun::star::lang::IllegalArgumentException | if one of the view and render state parameters are outside the specified range. |
VolatileContentDestroyedException | if a texture bitmap was volatile, and the content was destroyed before the rendering could take place. |
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 | |
) |
Draw a line in device resolution width (i.e.
one device pixel wide).
aStartPoint | The start point of the line to draw. |
aEndPoint | The end point of the line to draw. |
aViewState | The view state to be used when drawing this line. |
aRenderState | The render state to be used when drawing this line. |
com::sun::star::lang::IllegalArgumentException | if one of the view and render state parameters are outside the specified range. |
void drawPoint | ( | [in] ::com::sun::star::geometry::RealPoint2D | aPoint, |
[in] ViewState | aViewState, | ||
[in] RenderState | aRenderState | ||
) | |||
raises | ( | com::sun::star::lang::IllegalArgumentException | |
) |
Draw a point in device resolution on the device.
aPoint | The point to draw. |
aViewState | The view state to be used when drawing this point. |
aRenderState | The render state to be used when drawing this point. |
com::sun::star::lang::IllegalArgumentException | if one of the view and render state parameters are outside the specified range. |
XCachedPrimitive drawPolyPolygon | ( | [in] XPolyPolygon2D | xPolyPolygon, |
[in] ViewState | aViewState, | ||
[in] RenderState | aRenderState | ||
) | |||
raises | ( | com::sun::star::lang::IllegalArgumentException | |
) |
Draw a poly-polygon in device resolution line width (i.e.
the lines are one device pixel wide).
xPolyPolygon | The poly-polygon to draw. |
aViewState | The view state to be used when drawing this polygon. |
aRenderState | The render state to be used when drawing this polygon. |
com::sun::star::lang::IllegalArgumentException | if one of the view and render state parameters are outside the specified range. |
XCachedPrimitive drawText | ( | [in] StringContext | aText, |
[in] XCanvasFont | xFont, | ||
[in] ViewState | aViewState, | ||
[in] RenderState | aRenderState, | ||
[in] byte | nTextDirection | ||
) | |||
raises | ( | com::sun::star::lang::IllegalArgumentException | |
) |
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.
aText | The text to output. |
xFont | The font retrieved from this canvas to be used when drawing the text. |
aViewState | The view state to be used when drawing this text. |
aRenderState | The render state to be used when drawing this text. |
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. |
com::sun::star::lang::IllegalArgumentException | if one of the view and render state parameters are outside the specified range. |
XCachedPrimitive drawTextLayout | ( | [in] XTextLayout | xLayoutetText, |
[in] ViewState | aViewState, | ||
[in] RenderState | aRenderState | ||
) | |||
raises | ( | com::sun::star::lang::IllegalArgumentException | |
) |
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).
xLayoutetText | An interface to the readily layouted text, obtained from a XCanvasFont created at this canvas. The text layout already carries intrinsic font information. |
aViewState | The view state to be used when drawing this text. |
aRenderState | The render state to be used when drawing this text. |
com::sun::star::lang::IllegalArgumentException | if one of the view and render state parameters are outside the specified range. |
XCachedPrimitive fillPolyPolygon | ( | [in] XPolyPolygon2D | xPolyPolygon, |
[in] ViewState | aViewState, | ||
[in] RenderState | aRenderState | ||
) | |||
raises | ( | com::sun::star::lang::IllegalArgumentException | |
) |
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.
xPolyPolygon | The poly-polygon to render. |
aViewState | The view state to be used when filling this polygon. |
aRenderState | The render state to be used when filling this polygon. |
com::sun::star::lang::IllegalArgumentException | if one of the view and render state parameters are outside the specified range. |
XCachedPrimitive fillTexturedPolyPolygon | ( | [in] XPolyPolygon2D | xPolyPolygon, |
[in] ViewState | aViewState, | ||
[in] RenderState | aRenderState, | ||
[in] sequence< Texture > | xTextures | ||
) | |||
raises | ( | com::sun::star::lang::IllegalArgumentException, | |
VolatileContentDestroyedException | |||
) |
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.
xPolyPolygon | The poly-polygon to render. |
aViewState | The view state to be used when filling this polygon. |
aRenderState | The render state to be used when filling this polygon. |
xTextures | A sequence of texture definitions, with which to fill the polygonal area. |
com::sun::star::lang::IllegalArgumentException | if one of the view and render state parameters are outside the specified range. |
VolatileContentDestroyedException | if a texture bitmap was volatile, and the content was destroyed before the rendering could take place. |
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 | |||
) |
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.
xPolyPolygon | The poly-polygon to render. |
aViewState | The view state to be used when filling this polygon. |
aRenderState | The render state to be used when filling this polygon. |
xTextures | A sequence of texture definitions, with which to fill the polygonal area. |
xMapping | A bilinear mapping function which defines the warping of the textures on the output area. |
com::sun::star::lang::IllegalArgumentException | if one of the view and render state parameters are outside the specified range. |
VolatileContentDestroyedException | if a texture bitmap was volatile, and the content was destroyed before the rendering could take place. |
XGraphicDevice getDevice | ( | ) |
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.
sequence< FontInfo > queryAvailableFonts | ( | [in] FontInfo | aFilter, |
[in] sequence< ::com::sun::star::beans::PropertyValue > | aFontProperties | ||
) | |||
raises | ( | com::sun::star::lang::IllegalArgumentException | |
) |
Query font information, specific to this canvas.
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. |
aFontProperties | This interface can provide additional font properties to filter the list of available fonts against. |
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. |
XPolyPolygon2D queryStrokeShapes | ( | [in] XPolyPolygon2D | xPolyPolygon, |
[in] ViewState | aViewState, | ||
[in] RenderState | aRenderState, | ||
[in] StrokeAttributes | aStrokeAttributes | ||
) | |||
raises | ( | com::sun::star::lang::IllegalArgumentException | |
) |
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.
xPolyPolygon | The poly-polygon to render. |
aViewState | The view state to be used when generating the outline. |
aRenderState | The render state to be used when generating the outline. |
aStrokeAttributes | Further attributes used to parameterize the stroking. |
com::sun::star::lang::IllegalArgumentException | if one of the view and render state parameters are outside the specified range. |
XCachedPrimitive strokePolyPolygon | ( | [in] XPolyPolygon2D | xPolyPolygon, |
[in] ViewState | aViewState, | ||
[in] RenderState | aRenderState, | ||
[in] StrokeAttributes | aStrokeAttributes | ||
) | |||
raises | ( | com::sun::star::lang::IllegalArgumentException | |
) |
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.
xPolyPolygon | The poly-polygon to render. |
aViewState | The view state to be used when stroking this polygon. |
aRenderState | The render state to be used when stroking this polygon. |
aStrokeAttributes | Further attributes used to parameterize the stroking. |
com::sun::star::lang::IllegalArgumentException | if one of the view and render state parameters are outside the specified range. |
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 | |||
) |
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.
xPolyPolygon | The poly-polygon to render. |
aViewState | The view state to be used when strokes this polygon. |
aRenderState | The render state to be used when stroking this polygon. |
aTextures | A sequence of texture definitions, with which to fill the stroked area. |
aStrokeAttributes | Further attributes used to parameterize the stroking. |
com::sun::star::lang::IllegalArgumentException | if one of the view and render state parameters are outside the specified range. |
VolatileContentDestroyedException | if a texture bitmap was volatile, and the content was destroyed before the rendering could take place. |
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 | |||
) |
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.
xPolyPolygon | The poly-polygon to render. |
aViewState | The view state to be used when stroking this polygon. |
aRenderState | The render state to be used when stroking this polygon. |
aTextures | A sequence of texture definitions, with which to fill the stroked area. |
xMapping | A bilinear mapping function which defines the warping of the textures on the output area. |
aStrokeAttributes | Further attributes used to parameterize the stroking. |
com::sun::star::lang::IllegalArgumentException | if one of the view and render state parameters are outside the specified range. |
VolatileContentDestroyedException | if a texture bitmap was volatile, and the content was destroyed before the rendering could take place. |