Canvas¶
Qualified name: delphivcl.Canvas
- class Canvas¶
Bases:
Persistent
TCanvas provides an abstract drawing space for objects that must render their own images. Use TCanvas as a drawing surface for objects that draw an image of themselves. Standard window controls such as edit controls or list boxes do not require a canvas, as they are drawn by the system. TCanvas provides properties, events, and methods that assist in creating an image by:
Specifying the type of brush, pen, and font to use. Drawing and filling a variety of shapes and lines. Writing text. Rendering graphic images. Enabling a response to changes in the current image. TCanvas has two descendants, TControlCanvas and TMetafileCanvas, which assist in drawing images of controls and in creating metafile images for objects.
Methods
Draws an arc on the image along the perimeter of the circle defined by the parameters.
Draws an arc on the image along the perimeter of the ellipse bounded by the specified rectangle.
This is the same as TCanvas.Pixels[x, y].
This is the same as TCanvas.Pixels[x, y] := color Specifies the color of the pixels within the current ClipRect.
Attributes
Determines the color and pattern for filling graphical shapes and backgrounds.
Determines the orientation of the canvas as left-to-right or right-to-left.
ClassName
Returns the TObject.ClassName
Specifies the boundaries of the clipping rectangle.
Specifies how a graphical image is copied onto the canvas.
Specifies the font to use when writing text on the image.
Specifies the handle for this canvas.
HandleAllocated
Indicates the number of times the canvas has been locked to prevent interference from other threads.
Occurs when the image has just changed.
Occurs just before a change is made to the image.
Specifies the kind of pen the canvas uses for drawing lines and outlining shapes.
Specifies the current drawing position of the Pen.
int:
Specifies how text is written to the canvas.
- AngleArc(X: int, Y: int, Radius: int, StartAngle: float, SweepAngle: float) None ¶
Draws an arc on the image along the perimeter of the circle defined by the parameters. The AngleArc method draws a line from the current position to the starting point of the arc and then a counterclockwise circular arc to the arc endpoint. The arc traverses the perimeter of a circle whose center lies at (X,Y) and whose radius is Radius. The arc is drawn following the perimeter of the circle, counterclockwise, from the StartAngle with a sweep angle of SweepAngle. If the sweep angle is greater than 360 degrees, the entire circle is drawn and part of the arc is drawn multiple times. The current position is updated to the arc endpoint.
- Arc()¶
- ArcTo(X1: int, Y1: int, X2: int, Y2: int, X3: int, Y3: int, X4: int, Y4: int) None ¶
Draws an arc on the image along the perimeter of the ellipse bounded by the specified rectangle. Vcl.Graphics.TCanvas.ArcTo inherits from Vcl.Graphics.TCustomCanvas.ArcTo. All content below this line refers to Vcl.Graphics.TCustomCanvas.ArcTo. Draws an arc on the image along the perimeter of the ellipse bounded by the specified rectangle. Override the ArcTo method (or just use Arcto from descendant classes) to implement drawing of an elliptically curved line with the current Pen. The arc traverses the perimeter of an ellipse that is bounded by the points (X1,Y1) and (X2,Y2). The arc is drawn following the perimeter of the ellipse, counterclockwise, from the starting point to the ending point. The starting point is defined by the intersection of the ellipse and a line defined by the center of the ellipse and (X3,Y3). The ending point is defined by the intersection of the ellipse and a line defined by the center of the ellipse and (X4, Y4). This procedure draws lines by using the current pen and updates the value of PenPos to the value of the last endpoint.
- Brush¶
Determines the color and pattern for filling graphical shapes and backgrounds. Set the Brush property to specify the color and pattern to use when drawing the background or filling in graphical shapes. The value of Brush is a TBrush object. Set the properties of the TBrush object to specify the color and pattern or bitmap to use when filling in spaces on the canvas.
Note: Setting the Brush property assigns the specified TBrush object, rather than replacing the current TBrush object.
- Type:
Brush
- BrushCopy()¶
- CanvasOrientation¶
Determines the orientation of the canvas as left-to-right or right-to-left.
- Chord()¶
- ClipRect¶
Specifies the boundaries of the clipping rectangle.
- CopyMode¶
Specifies how a graphical image is copied onto the canvas. Set CopyMode to affect the way graphical images are drawn onto the canvas. The CopyMode is used when copying an image from another canvas using the CopyRect method. CopyMode is also used by TBitmap objects when they draw themselves to a canvas. Use CopyMode to achieve a variety of affects when rendering an image. Achieve special effects like merged images and making parts of a bitmap transparent by combining multiple images with different CopyModes.
- Type:
int
- CopyRect()¶
- Draw()¶
- DrawFocusRect()¶
- Ellipse()¶
- FillRect()¶
- FloodFill()¶
- Font¶
Specifies the font to use when writing text on the image. Set Font to specify the font to use for writing text on the image. The value of Font is a T Font object. Set the properties of the T Font object to specify the font face, color, size, style, and any other aspects of the font. The Canvas.Font property is only guaranteed to equal the Font property if you have an owner-drawn listbox (where you are expected to use the canvas). Even in that case, it is only guaranteed to equal the Font property once the first paint message is underway. If you use a canvas inside an ownerdraw event, everything should work as expected. Using the canvas for a reason outside the scope of its intended usage may give unpredictable results.
Note: Setting the Font property assigns the specified T Font object, rather than replacing the current T Font object.
- Type:
Font
- FrameRect()¶
- GetPixel(x, y) TColor ¶
This is the same as TCanvas.Pixels[x, y]. Returns the color of the pixels within the current ClipRect.
- Handle¶
Specifies the handle for this canvas.
- LineTo()¶
- Lock()¶
- LockCount¶
Indicates the number of times the canvas has been locked to prevent interference from other threads.
- MoveTo()¶
- OnChange¶
Occurs when the image has just changed.
- OnChanging¶
Occurs just before a change is made to the image.
- Pen¶
Specifies the kind of pen the canvas uses for drawing lines and outlining shapes. Set Pen to specify the pen to use for drawing lines and outlining shapes in the image. The value of Pen is a TPen object. Set the properties of the TPen object to specify the color, style, width, and mode of the pen.
Note: Setting the Pen property assigns the specified TPen object, rather than replacing the current TPen object.
- Type:
Pen
- PenPos¶
Specifies the current drawing position of the Pen.
- Pie()¶
- Pixels¶
int:
- PolyBezier()¶
- PolyBezierTo()¶
- Polygon()¶
- Polyline()¶
- Rectangle()¶
- Refresh()¶
- RoundRect()¶
- SetPixel(x, y, color)¶
This is the same as TCanvas.Pixels[x, y] := color Specifies the color of the pixels within the current ClipRect.
- StretchDraw()¶
- TextExtent()¶
- TextFlags¶
Specifies how text is written to the canvas.
- TextHeight()¶
- TextOut()¶
- TextRect()¶
- TextWidth()¶
- TryLock()¶
- Unlock()¶