JScript DrawTool

Log-in or register.

JScript DrawTool

DrawTool is a global object accessible in the JScript document operation and enables usage of drawing tools from scripts.

Methods and properties

  • int <mode_value> (get) - returns a constant identifying a mode. The supported modes are listed below.
  • int BlendMode (get/set) - active blending mode.
  • int RasterizationMode (get/set) - rasterization mode.
  • int ShapeFillMode (get/set) - shape filling and outline drawing mode.
  • int CoordinatesMode (get/set) - coordinates mode (has little effect when used from script).
  • float OutlineWidth (get/set) - outline width in pixels.
  • float GammaOverride (get/set) - override for gamma correction. This value is not supported by all tools and tells the tool to assume that the image is gamma corrected using the specified value. Value of 0 means no override.
  • void SetColor1(float red, float green, float blue, float alpha) - sets the primary color.
  • void SetColor2(float red, float green, float blue, float alpha) - sets the secondary color.
  • void SetFillStyle(string styleID, string styleParams) - changes the active fill style. The specified fill style is only used if it is enabled using ShapeFillMode. The meaning of the styleParams value depends on the actual style.
  • void Execute(object document, string toolID, string toolParams) - uses the tool identified by toolID with the parameters specified by toolParams to draw to document. The meaning of the toolParams value depends on the actual tool.
  • void '<tool_id>(object document, ...) - simplified version of the Execute method. <tool_id> is case sensitive. There may be arbitrary number of parameters following document and the are converted to strings, concatenated, separated by , and used as the toolParams value of the Execute method.

Modes

BMDrawOver - paint over the background (the common blending mode).
BMReplace - replace pixels. This mode differs from the previous
            in cases where the color is semitransparent.
BMDrawUnder - the result will be visible only if the background is semitransparent.
RMBinary - jagged edges.
RMSmooth - with antialiasing.
SFMOutline - draw outlines of shapes.
SFMFilled - draw shapes using active fill-style.
SFMCombined - draw outlines and fill interior using active fill-style.
CMArbitrary - use arbitrary (non-integral) coordinates.
CMIntegral - integral coordinates.

Example

// set color to green and fill shapes with that color
DrawTool.SetColor1(0, 1, 0, 1);
DrawTool.ShapeFillMode = DrawTool.SFMFilled;
// use the simplified method to draw a circle with center at [30, 40]
// and diameter of 20 pixels:
DrawTool.ELLIPSE(Document, 30, 40, 20);
// the previous command is internally translated to:
// DrawTool.Execute(Document, "ELLIPSE", "30,40,20");

Recent comments

user icon Anonymous on April 1st 2013

If I want to use JScript DrawTool to create a custom tool, this tool can draw an arrow image.But I can not get the coordinates of the starting point and end point coordinates.I would like to ask how can I do? Thank you
:-)

my Email is peng198849@126.com
contact me

user icon Anonymous
What about ICL files?
Select background