Whitebeam Object Definition

Site Map
 
Home
 
Application Guide
Reference
  Installation
  Configuration
  XML Markup
  JavaScript Classes
  ROM
  Templates
  Environment
  Dev Process
  Tools
  External Links
  Example libraries
Community
Contact Whitebeam
To-Do
Download
Credits
Licence
Whitebeam Users
 
 
 

Whitebeam Object Definition

Method Description

GraphicImage.drawRectangle()

Draw a rectangle

Syntax

GraphicImage = GraphicImage.drawRectangle(topLeft, bottomRight, colour, options)

Parameters

The 'GraphicImage.drawRectangle' method takes 4 parameters:

Name Type/Value Range/Length Description
topLeftstruct GraphicImage.Pointsee definition Required. The coordinates of the starting point for this line
bottomRightstruct GraphicImage.Pointsee definition Required. The coordinates of the end point for this line
colournumber  Required. The colour to use for drawing this line. This can be any colour allocated with 'colourAlloc' or 'colourResolve', or can be the special valie 'GraphicImage.styled' to use the defined styled.
optionsMetaData  Optional. Object containing optional values that change how the rectangle is drawn

Results

The 'GraphicImage.drawRectangle' method returns GraphicImage:

Type/Value Range/Length Description
GraphicImage   Returns a reference to 'this' if the operation succeeds, otherwise throws an exception.

Remarks

Draw a rectanglem given it's top left and bottom right coordinates. By default the rectangle is drawn with a border but is not filled. Set the 'fill' option on the last parameter to cause the rectangle to be solid.

The last parameter to this call is an optional set of 'options' expressed as a JavaScript object. To specify a non-default value for one of these options, include the options object.

Currently defined flags are :

OptionDefaultDescription
antialiastrueIf set to 'true', for true-colour images, anti-aliasing techniques will be used to remove jagged edges
fillfalseIf 'true' this method will fill all the area within the rectangle with the specified colour

Example

  // Create an empty 100x100 pixel image
  var img = (new GraphicImage).create(100,100);

  // Draw a rectangle within the image, border 3 pixels wide
  var blue = img.colourAlloc(  0,0,255);

  img.setPenWidth(3);
  img.drawRectangle({x:10,y:10},{x:90,y:90}, red});
        
Whitebeam release 1.3.36
(loadtime : 13ms)