Rectangle drawing tool

Log-in or register.

Rectangle drawing tool

rsrc/rectangle-tool.png image RECTANGLE is a drawing tool capable of drawing filled rectangles and/or rectangle outlines. The corners of the rectangles may be rounded and the rectangles can be rotated.

How to use the Rectangle tool

A new rectangle is created by dragging with mouse from one of its corners to the opposite one.

After the mouse button is released, control handles appear and it is possible to further modify the shape, color, and other properties of the rectangle. If arbitrary coordinates mode is enabled, the rectangle can be rotated by arbitrary angle by dragging the extra control handle. In integral coordinates mode, rectangle can only by rotated by multiplies of 90 degrees.

Definition is finished by explicitly confirming the action (-> Apply button, Enter key, mouse gesture), by switching tool, by running certain commands (for example Save) or by starting a new rectangle.

Rectangle respects the current shape-fill mode: it is capable of drawing filled shape, shape outline or combination thereof. The outline if drawn with primary color, while the interior uses the active fill style.

rsrc/rectangle-tool-config.png image

The rectangle can have rounded corners. Corner radius is set in the tool properties panel. It is also possible to switch to square mode that forces the height and width of the rectangle to be the same.

After the initial definition (while control handles are visible), it is possible to adjust position and size of the rectangle using keyboard. Arrow keys move the rectangle. Holding SHIFT key and using arrow keys resizes the rectangle.

Rectangle can be successfully combined with many meta-tools (select, stylize, eraser) to achieve various effects.

rsrc/sample-rectangles.png image

The left rectangle uses 10 pixels corner radius, 5 pixels outline width and outline shape-fill mode is enabled. The middle rectangle is filled by predefined pattern. The right rectangle uses generated clouds texture and the stylize meta-tool to add a shadow and blur background behind the rectangle.

Scripting parameters

RECTANGLE tool can be used from scripts. The command in script may have 4 to 6 parameters:

  • radius - corner radius in pixels; use 0 to make the corners sharp.
  • centerX, centerY - center of the drawn rectangle.
  • sizeX - width of the rectangle.
  • sizeY (optional) - height of the rectangle; if this argument is missing, sizeY defaults to sizeX resulting in a square.
  • angle (optional) - clockwise rotation of the rectangle in radians (default is 0 radians).

Example

DrawTool.RECTANGLE(Document, 0, 100, 100, 50, 30);

See also: DrawTool object, Document object

Recent comments

user icon Anonymous on December 25th 2022

:-D

user icon Anonymous
I wish there were...
What about ICL files?