Skip to content
Member Filters
Show Inherited
Show Protected
Show abstract
GR32🞂TBitmap32🞂LineToMethodPublic
Inherited from:TCustomBitmap32.LineTo

TBitmap32.LineTo

Draws 1-pixel wide line segments from the current pen position to target coordinates using integer, fixed-point, or floating-point positioning, updating pen position afterwards.

Declaration ​

pascal
procedure LineToS(X, Y: Integer);
procedure LineToTS(X, Y: Integer);
procedure LineToAS(X, Y: Integer);
procedure LineToXS(X, Y: TFixed);
procedure LineToFS(X, Y: Single);
procedure LineToXSP(X, Y: TFixed);
procedure LineToFSP(X, Y: Single);

Parameters ​

ParameterTypeDescription
X, Y-Target end pixel coordinates.

Description ​

The LineTo methods draw a 1-pixel wide straight line segment from the current pen position (PenPos / PenPosF) to specified target coordinates (X, Y). Upon completing the line segment, the current pen position is automatically updated to (X, Y).

Note

By design, LineTo does not draw the last pixel of the line segment. This is done so it can be used to draw contiguous polyline segments without double-rendering vertices.

Internally LineTo is implemented as:

pascal
Line(PenPos.X, PenPos.Y, X, Y, PenColor, False);
PenPos.X := X;
PenPos.Y := Y;

Method variants provide specific combinations of coordinate types (Integer, TFixed, Single), boundary clipping (S), alpha transparency (T), anti-aliasing (A, X, F), and pattern stippling (P).

Variants ​

VariantCoordinate TypeModifiersDescription
LineToSIntegerSafeClipped integer line drawing from current pen position using PenColor.
LineToTSIntegerTransparent + SafeClipped integer line drawing with alpha blending using PenColor.
LineToASIntegerAnti-aliased + SafeClipped anti-aliased integer line drawing using Wu's algorithm.
LineToXSTFixedFixed Sub-pixel + SafeClipped 16.16 fixed-point anti-aliased line drawing.
LineToFSSingleFloat Sub-pixel + SafeClipped floating-point anti-aliased line drawing.
LineToXSPTFixedFixed + Stipple + SafeClipped 16.16 fixed-point stippled line drawing using active stipple pattern.
LineToFSPSingleFloat + Stipple + SafeClipped floating-point stippled line drawing using active stipple pattern.

Example ​

pascal
Bitmap.PenColor := clRed32;
Bitmap.MoveTo(10, 10);
Bitmap.LineToS(100, 10);
Bitmap.LineToS(100, 100);
Bitmap.LineToS(10, 10);

See also ​