Line drawing tool

Log-in or register.

Line drawing tool

rsrc/line-tool.png image LINE is a drawing tool for drawing of arbitrary poly-lines. Line works similarly as the rsrc/curve-tool.png image Curve tool and makes use of fill styles.

rsrc/line-sample.png image
Lines using various cap and join modes.

Line configuration panel

rsrc/line-tool-config-2013.png image
Version 2013.1
rsrc/line-tool-config.png image
Older versions.

The Closed option only affects a poly-line that has at least 3 vertices. In that case, the last vertex is connected to the first one.

The Cap mode of the Line tool controls how to decorate the ends of a line. You may select either nothing, a rounded cap or a square cap. Square cap means that the line reaches behind the end point (by an amount equal to width of the line divided by 2).

The Join mode controls how to draw the interior vertices of a poly-line. They may either be rounded, beveled, or sharp (miter joins). This setting only affects poly-lines, not simple straight lines.

The Width option controls the width of the line in pixels. This value must be greater than 0 and it does not need to be a whole number. For example, width of 2.8 pixels is allowed.

The Dashing pattern is a sequence of "-" (minus) and " " (space) characters and controls how to dash the line. "-" indicates a line segment equal to line width, while " " means nothing will be drawn. Note that the ends of dash segments are decorated according to the selected Cap mode. Choosing Square caps will effectively cover a single gap in the dashing. You may want to use a different Cap mode or place two or more consecutive spaces in the dash pattern.

How to use the Line tool

With the Line tool selected (in the toolbar above the canvas), click on the canvas and keep holding the left mouse button. Then move the mouse and release the button. This will create a straight line.

After you release the button, control handles will appear. Line has two kinds of control handles:

  • vertex control handles and
  • segment control handles.

Initially, there will be 2 vertex control handles at the end of the line and 1 segment control handle in the middle of the line. You can drag the control handles with your mouse. Dragging the vertex handle will move the vertex. Dragging the segment handle will split the segment into two parts and a new vertex will be added to the line (making it a poly-line).

The whole poly-line can be moved with the arrow keys or by dragging it.

If you are working in a vector layer, you may also scale and rotate the poly-line by holding down the SHIFT key while dragging the line.

Any fill style can be used with a Line tool and in some cases, additional control handles of the fill style will be shown. Currently, outlines are not supported for Lines.

Scripting parameters

LINE tool can be used from scripts. The command in script must have the following arguments:

  • width - line width in pixels
  • dash_pattern (optional) - a string consisting of spaces and minus signs (example:-- -- - -). Maximum length of the dash pattern is 32 characters.
  • join_style (optional) - one of "JROUND", "JBEVEL" (default), "JMITER".
  • cap_style (optional) - one of "CROUND", "CBUTT", "CSQUARE" (default).
  • coords - pairs of floating point numbers representing coordinates. There must be at least 4 numbers to define X and Y coordinates of two points.
  • poly (optional) - "CLOSE" or "OPEN" (default). If "CLOSE" is specified, the last point will be connected to the first one.

Example

DrawTool.LINE(Document, 5, "-   -", "JROUND", "CROUND", 10, 10, 90, 10, 10, 90);

See also: DrawTool object, Document object

Recent comments

user icon Anonymous on January 31st

how do you push enter??? :-(

user icon Vlasta site administrator on February 1st

on your keyboard

user icon Anonymous on June 25th

How do you mov th painting? :-o

user icon Anonymous on August 16th

How do you make sharp pixelated lines? like old MS Paint lines.
Should I use Photoshop for that?

user icon Vlasta site administrator on August 16th

If you really want to make a pixelated line, turn off smoothing. The second icon on this page is what you are looking for. Or try the Pencil tool.

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