CONTENTS

How to place the applet on a web page

The editor can be placed on a web page with the tag <applet>, for example:

<applet width="640" height="480" code="Painter.class" codebase="./applet" archive="painter.jar,res.zip" >
    <param name="image_width"  value="400" >
    <param name="image_height" value="300" >
    <param name="save" value="save.php" >

    <param name="jnlp_href" value="plugin2.jnlp">
    <param name="codebase_lookup" value="false">
</applet>

Attributes

width and height Define the applet size on the page. Set them according to your page design.
codebase Specifies the directory where the files painter.jar and res.zip is located.
archive Must always be painter.jar,res.zip
DON'T specify the directory here! Use the attribute codebase for the directory, otherwise the applet will function improperly.
code Must always be Painter.class

Parameters

The parameters jnlp_href and codebase_lookup are necessary forever and should be set as shown in the example above. The other applet parameters are optional. Specify them only if necessary.
The parameters listed below are commmon. There are some additional parameters not listed here that depend on the current GUI scene.

 
image_width Defines the image width in pixels. Don't specify it if you load an existing image.
image_height Defines the image height in pixels. Don't specify it if you load an existing image.
save URL of the server script that receives the resulting image. See How to save image for details.
save_options Defines miscellaneous image save options. The following options are supported:
    width             - width of the output image
    height            - height of the output image
    format            - GIF or JPEG or PNG
    jpeg_quality      - an integer value in the range 1..100
    transparent_color - transparent color for GIF format (specified as #RRGGBB)
    superimpose       - defines what should be rendered on the saved image,
    			for example: bgimage+image+mask.
                        By default only the main image is saved.
The options should be specified as name:value pairs separated by semicolon, for example:
  <param name="save_options" value="format:JPEG; jpeg_quality:75">
blockunchanged If this parameter is set the editor doesn't allow saving unchanged pictures with the button Save. The parameter value is the message to be displayed in when the user is trying to save unchanged image.
 
load URL of the image to load at startup. The URL can be either absolute or relative to the current page.
bgimage URL of the background image. If you define the background image set the image_bgcolor to transparent.
inseparable_bgimage URL of unseparable background image. This image can't be separated from the user's drawing and saved along with it.
mask URL of the mask image. The mask image is displayed on the top of the main image. Usually it has transparent areas.
load_prescaling Specifies to scale-down big images when they are loaded. The limiting parameters can be width, height or pixels and should be specified as name:value pairs separated by semicolon.
Examples:
   <!-- the image should be withing the frame 2048x1546 -->
   <param name="load_prescaling" value="width:2048; height:1536">

   <!-- the image can be of any dimension but have no more then 4 Mpixels -->
   <param name="load_prescaling" value="pixels:4M">

   <!-- the image width should not exceed 1000 and number of pixles should not exceed 10K -->
   <param name="load_prescaling" value="width:1000; pixels:10K">
image_type Image type. Can be one of the following: RGB, ARGB, BYTE_GRAY, BYTE_INDEXED, BLACK_WHITE.
image_bgcolor Background color. Use #RRGGBB format or the keyword transparent.
(the default background is #FFFFFF - white).
paint_options Defines miscellaneous paint options. The options should be difined as name:value pairs separated by semicolon. The following options are supported.
anitaliasingWhether to use anialiasing. Can be true or false.
snapSpecifies rounding coordinates of lines, rectangles, circles, and polygons to the specified number of pixels, e.g. snap:4
select_transparentWhen the user selects a region for copying and this option is set to true the background color the selection is converted to transparent one.
cliparts_resizableSpecifies whether cliparts dropped on the canvas can be resized. The value must be true or false. The default is true.
cliparts_rotatableSpecifies whether cliparts dropped on the canvas can be rotated. The value must be true or false. The default is true.
eraser_sizeSpecifies size of the eraser tool in pixels. The default is 8.
arrow_widthSpecifies arrows width. The value is expressed in units of current stroke width. The default value is 4.
arrow_lengthSpecifies arrows length. The value is expressed in units of current stroke width. The default value is 6.
Example:
    <param name="paint_options" value="antialiasing:true; snap:8">
 
tool Sets the active drawing tool at startup. The value must is the identifier of one of available tools.
color Sets the active drawing color at startup. The value must a valid color definition.
stroke Sets the active stroke at startup. The value must the identifier of one of available stroke.
texture Sets the active texture at startup. The value must the identifier of one of available texture.
font Sets the active text font at startup. The value must a valid font specifier.
 
gui Allows choosing the GUI scene.
language Text language file specified as URL relative to the applet's codebase. Read more about the language file here.