http://onionworks.net/2006/imageservice

createColor ([alpha : number], red : number, green : number, blue : number) : nodeset

This method enables the creation of a colour on the basis of the hexadecimal colour code or of an RGB value. The RGB colour values can be extended to include the factor alpha.

The syntax of the method when transferring an RGB colour value can be seen in the following example. The alpha value is optional and does not have to be transferred.

<xsl:variable name="red" select="is:createColor(255,0,0)" />

The variable "red" produced in the example has the following content:

<color red="255" cssValue="#FF0000" green="0" blue="0" alpha="255" />

In the following example, how the method is used is shown in an application example.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ise="http://onionworks.net/2006/imageservice/encoders" 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="/resource">
<xsl:variable name="red" select="is:createColor(255,0,0)" />
<xsl:variable name="workspace" select="is:createWorkspace(320,240,'Pixel32bppBgra',$red)" />
<xsl:variable name="doWrite" select="is:writeWorkspace($workspace, ise:createJpegEncoder(60))" />
<b:output mimeType="{@onion:src.mimeType}">
<b:webResponse expires="60" />
</b:output>
</xsl:template>
</xsl:stylesheet>
Drawing a red line

This example produces a red workspace with the size 320 * 240 pixels in a colour depth of 32 bits.