The editor supports several functions which can be invoked from JavaScript.
To access the functions in JavaScript you have to specify the applet attribute name,
for example:
<applet name="painter" ... >
...
</applet>
and call the function as follows:
document.applets['painter'].somefunc();
Below you find the list of available functions (remember that function names are case sensitive).
getBase64Image(options) Parameters: options - the list of save_options. The list can be empty. Returns: The image file encoded by BASE64 method. |
loadImage(imageURL, bgimageURL, inseparable_bgimage_URL, mask_URL)
Allows loading new images without reloading current web page.
Parameters:
imageURL - URL of the main (editable) image.
bgimageURL - URL of the background image.
inseparable_bgimage_URL - URL of the inseparable background image.
mask_URL - URL of the mask image.
Notes:
* If one or more images is unnecessary the parameter should be set to empty string.
* URLs can be specified as absolute or relative to the current page.
* Instead of loading images by URL you can pass BASE64 encoded images using
the data URI:
data:<MIME-type>;base64,<your_base64_image_data>
Example:
data:image/gif;base64,
R0lGODlhMgAyAPABAAAAAP///yH5BAAAAAAALAAAAAAyADIAAAKSjI+py+0Po5y02ouz3rz7D4ai
ApTm2JgAeaJBKcHiWtGebOGanfGX3wv+FsAYpliEJCPJJcNJQugSUCqlesBmrxOtoamSGscPnlfr
zaLJV+x6qGQzW+UuKp1O+fCdKZ8DlAc2Z5WTUldo+LQ09SJEhES04aQSlriTpwaSmUnoeUen1ujy
Ukl6ipqqusra6vqqWgAAOw==
|
saveImage(save_script_url,save_options)
Triggers saving of the image. The specified script is requested on the server. save('save.php','format:png');
|
addSaveField(name,value)
Allows to add custom fields in the save request.
This function (if necessary) should be invoked before addSaveField('image_title','Picture 1');
|
showProgress(text)
Displays the progress box with the specified text. |
setMode(mode)
Sets the current drawing mode. This function allows to set the current tool, color, stroke, texture, font. The parameter mode is a string in the following format: tool:tool_name; color:color_spec; stroke:stroke_name; texture:texture_name; font:font_specExamples:
setMode('tool:curve; color:#FF0000; stroke:solid2;');
setMode('tool:filled_rect; color:#000000; texture:solid;');
setMode('tool:text; color:#0000FF; font:Monospaced-plain-16;');
Each item (tool, color, stroke, texture, font) is optional, i.e. if anyone is not specified it stays unchanged.
|
getMode(item)
Returns: the value of the specified mode item. |
doAction(action)
Executes one of the following actions: doAction('clear');
|
isChanged() Returns: true if the image has been changed, otherwise returns false. |
getImageWidth()Returns: the image width. |
getImageHeight()Returns: the image height. |