ActiveGIF --- Interface
S.Draw: Visual Platform, Draw and Process Images With JavaScript and VBScript
ActiveGIF Methods --- General
- About()
Returns the license text.
- Init(width, height)
Create a blank image. This is always the first method to call.
Parameter: width: width of the image, in pixels;
height: height of the image, in pixels.
Returns true if successful.
- SetGIFTransparent(transparent, maskRed, maskGreen, maskBlue)
Set the transparent attribute of the image.
JavaScript example: SetGIFTransparent(true, 255, 255, 255)
- SaveAsGIF(path)
Save the image to a GIF file.
Returns true if successful.
- SaveAsBMP(path)
Save the image to a Bitmap file.
Returns true if successful.
ActiveGIF Methods --- Text
- SetFont(face, height)
Set the font for subsequent text printing.
The height is in pixels.
JavaScript example: SetFont("Arial", 12);
- SetTextColor(red, green, blue)
Set text color.
The value of any the three parameters must be between 0 and 255.
JavaScript example:
SetTextColor(255, 0, 0);
- SetTextStyle(bold, italic, strikeout, underline)
The value of any the four parameters must be true or false.
JavaScript example:
SetTextStyle(true, false, false, true);
- CalcTextWidthSingleLine(text)
Returns the width of the text, in pixels.
- CalcTextHeightSingleLine(text)
Returns the height of the text, in pixels.
- DrawTextSingleLine(x, y, text)
Draw a single line text, left aligned to x and top aligned to y.
- CalcTextWidthMultipleLines(text, maxWidth)
Returns the width of the text, in pixels.
- CalcTextHeightMultipleLines(text, maxWidth)
Returns the width of the text, in pixels.
- DrawTextMultipleLines(left, top, width, height, text)
Draw text within the area restricted by left, top, width and height. If no enough space is available, the exceeding part will be printed as ellipses.
ActiveGIF Methods --- Images
- LoadImage(path)
Open the image file specified by path,
and returns an Image object if successful. Supports .bmp, .gif, .jpg, etc.
Image methods:
| Method |
Description |
| GetWidth() |
Returns the width of the image, in pixels |
| GetHeight() |
Returns the height of the image, in pixels |
- DrawImage(img, x, y, width, height)
Draw the image. The image object is previously loaded by calling LoadImage.
ActiveGIF Methods --- Lines
- SetLineColor(red, green, blue)
The line color will be used to draw all subsequent lines and outlines of shapes.
- DrawLine(x1, y1, x2, y2, lineWidth)
Draw a line from (x1,y1) to (x2, y2).
The meanings of lineWidth values:
| Value |
Line Width |
Style |
| -5 |
1 pixel (device unit) |
Every other pixel is set |
| -4 |
1 pixel (device unit) |
Dash-Dot-Dot |
| -3 |
1 pixel (device unit) |
Dash-Dot |
| -2 |
1 pixel (device unit) |
Dot |
| -1 |
1 pixel (device unit) |
Dash |
| 0 |
1 pixel (device unit) |
Solid |
| w>0 |
w pixels |
Solid |
- DrawLineEx(ptarray, lineWidth, fillRed, fillGreen, fillBlue)
Connect multiple points by straight lines and optionally fill the enclosed area with color specified by fillRed, fillGreen, fillBlue.
See DrawLine for the meanings of lineWidth.
See CreatePTArray for description about ptarray.
If one of fillRed, fillGreen or fillBlue is negtive,
the enclosed area will not be filled.
ActiveGIF Methods --- Shapes
- DrawCircle(x, y, radius, lineWidth, fillRed, fillGreen, fillBlue)
Draw a circle specified by x, y and radius,
and optionally fill the shape with color.
If one of fillRed, fillGreen or fillBlue is negtive, the shape will not be filled.
- DrawEllipse(left, top, width, height, lineWidth, fillRed, fillGreen, long fillBlue)
Draw an ellipse within the bounding rectangle specified by left, top, width and height,
and optionally fill the shape with color.
If one of fillRed, fillGreen or fillBlue is negtive, the shape will not be filled.
- DrawBox(left, top, width, height, lineWidth, fillRed, fillGreen, fillBlue)
Draw a rectangle specified by left, top, width and height,
and optionally fill the shape with color.
If one of fillRed, fillGreen or fillBlue is negtive, the shape will not be filled.
ActiveGIF Methods --- Points Array
- CreatePTArray()
Returns a PTArray object, which will be used for DrawLineEx.
PTArray methods:
| Method |
Description |
| Add(x, y) |
Add a point to the array |
| Reset() |
Delete all the elements in the array. |