http://onionworks.net/2006/imageservice/canvas
createCanvas (workspaceOrImage : nodeset, [fontQuality : string]) : nodeset
This method creates a canvas making drawing into a picture possible. A picture or a workspace must be transferred to the parameter “workspaceOrImage”. These are created with “createImage” and “createWorkspace” of the imageservice core functions.
The parameter “fontQuality” can be specified as an option. If the parameter is not transferred, then the value “Antialiased” is set. Possible values can be seen in the following list.
- Default
- Draft
- Proof
- Antialiased
- ClearType
The following example shows the creation of a canvas when transferring a workspace:
<xsl:variable name="workspace" select="is:createWorkspace(@src, true())" />
<xsl:variable name="canvas" select="iscan:createCanvas($workspace)" />
The use of the method is shown in the following source code example.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ise="http://onionworks.net/2006/imageservice/encoders" xmlns:iscan="http://onionworks.net/2006/imageservice/canvas" xmlns:is="http://onionworks.net/2006/imageservice" xmlns:b="http://onionworks.net/2004/renderengine/binary" xmlns:onion="http://onionworks.net/2004/data" version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" indent="no" />
<xsl:template match="/recordcard">
</xsl:stylesheet><xsl:variable name="workspace" select="is:createWorkspace(picture, true())" />
<xsl:variable name="drawText" select="iscan:drawText(iscan:createCanvas($workspace),'Beispieltext', is:createPoint(0,0),is:createFont('Arial',10,'Bold'), is:createSolidFill(127,255,255,255))" />
<xsl:variable name="doWrite" select="is:writeWorkspace($workspace, ise:createJpegEncoder(80))" />
<b:output mimeType="{picture/@onion:mimeType}">
</xsl:template><b:webResponse expires="60" />
</b:output>Inserting text
In the example, the text "sample text" is written in text size 10 and bold character font Arial into an existing picture at the position (0,0).