Class helper for FMX TCanvas to provide Vcl-specific method signatures to the canvas. This class helper makes porting VCL code to FMX much easier.
In addition to all the VCL TCanvas methods added, the class adds Pen and Brush properties. However, by necessity, the VCL Pen is not exactly like the FMX Stroke and the VCL Brush is not exactly like the FMX FIll.
The following methods do not work and silently do nothing:
• LineTo and MoveTo do not work (use DrawLine)
• Arc
• ArcTo
• Chord
• CopyRect
• Pie
Namespace: FMX.RS.CanvasHelper
Delphi |
type |
|
If the bounding rectangle is a square, a circle is drawn.The ellipse is outlined using the value of Pen, and filled using the value of Brush.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Overloaded. Draws the ellipse defined by a bounding rectangle on the canvas. Call Ellipse to draw a circle or ellipse on the canvas. Specify the bounding rectangle either by giving: • The top left point at pixel coordinates (X1, Y1) and the bottom right point at (X2, Y2). • A TRect value. |
If the bounding rectangle is a square, a circle is drawn.The ellipse is outlined using the value of Pen, and filled using the value of Brush.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Overloaded. Draws the ellipse defined by a bounding rectangle on the canvas.
Call Ellipse to draw a circle or ellipse on the canvas. Specify the bounding rectangle either by giving:
• The top left point at pixel coordinates (X1, Y1) and the bottom right point at (X2, Y2).
• A TRect value.
If the bounding rectangle is a square, a circle is drawn.The ellipse is outlined using the value of Pen, and filled using the value of Brush.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Overloaded. Draws the ellipse defined by a bounding rectangle on the canvas.
Call Ellipse to draw a circle or ellipse on the canvas. Specify the bounding rectangle either by giving:
• The top left point at pixel coordinates (X1, Y1) and the bottom right point at (X2, Y2).
• A TRect value.
If the bounding rectangle is a square, a circle is drawn.The ellipse is outlined using the value of Pen, and filled using the value of Brush.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Overloaded. Fills the specified rectangle on the canvas using the current brush.
Use FillRect to fill a rectangular region using the current Brush. The region is filled including the top and left sides of the rectangle, but excluding the bottom and right edges.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Overloaded. Fills the specified rectangle on the canvas using the current brush.
Use FillRect to fill a rectangular region using the current Brush. The region is filled including the top and left sides of the rectangle, but excluding the bottom and right edges.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
FillText(TRectF,String,Boolean,Single,TFillTextFlags,Single,TTextAlign,TTextAlign)
Overloaded. Represents method FillText(TRectF,String,Boolean,Single,TFillTextFlags,Single,TTextAlign,TTextAlign).
Overloaded. Draws a rectangle.
Use FrameRect to draw a 1 pixel wide border around a rectangular region.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Overloaded. Draws a rectangle.
Use FrameRect to draw a 1 pixel wide border around a rectangular region.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Draws a line on the canvas from PenPos to the point specified by X and Y, and sets the pen position to (X, Y).
Use LineTo to draw a line from PenPos up to, but not including the point (X,Y). LineTo changes the value of PenPos to (X,Y).
The line is drawn using Pen.
Warning |
---|
This function is unimplemented and does nothing. |
Changes the current drawing position to the point (X,Y).
Use MoveTo to set the value of PenPos before calling LineTo. Calling MoveTo is equivalent to setting the PenPos property.
Warning |
---|
This function is unimplemented and does nothing. |
Pie(Integer,Integer,Integer,Integer,Integer,Integer,Integer,Integer,Single)
Overloaded. Draws a pie-shaped section of the ellipse bounded by the rectangle (X1, Y1) and (X2, Y2) on the canvas.
Use Pie to draw a pie-shaped wedge on the image. The wedge is defined by the ellipse bounded by the rectangle determined by the points (X1, Y1) and (X2, Y2). The section drawn is determined by two lines radiating from the center of the ellipse through the points (X3, Y3) and (X4, Y4).
The wedge is outlined using Pen, and filled using Brush.
Warning |
---|
This function is unimplemented and does nothing. |
Pie(Single,Single,Single,Single,Single,Single,Single,Single,Single)
Overloaded. Draws a pie-shaped section of the ellipse bounded by the rectangle (X1, Y1) and (X2, Y2) on the canvas.
Use Pie to draw a pie-shaped wedge on the image. The wedge is defined by the ellipse bounded by the rectangle determined by the points (X1, Y1) and (X2, Y2). The section drawn is determined by two lines radiating from the center of the ellipse through the points (X3, Y3) and (X4, Y4).
The wedge is outlined using Pen, and filled using Brush.
Warning |
---|
This function is unimplemented and does nothing. |
Overloaded. Draws a set of Bezier curves.
Use PolyBezier to draw cubic Bezier curves using the endpoints and control points specified by the Points parameter. The first curve is drawn from the first point to the fourth point, using the second and third points as control points. Each subsequent curve in the sequence needs exactly three more points: the ending point of the previous curve is used as the starting point, the next two points in the sequence are control points, and the third is the ending point.
The Points parameter gives the endpoints to use when generating the Bezier curves.
This procedure draws lines by using the current Pen.
Note |
||
---|---|---|
In Delphi, you can use the Slice function to pass a portion of an array of points to the PolyBezier method. For example, to form a Bezier curve using the first ten points from an array of 100 points, use the Slice function as follows:
|
Control points after a[Index+3] are ignored. Nothing happens if there aren't enough control points.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Overloaded. Draws a set of Bezier curves.
Use PolyBezier to draw cubic Bezier curves using the endpoints and control points specified by the Points parameter. The first curve is drawn from the first point to the fourth point, using the second and third points as control points. Each subsequent curve in the sequence needs exactly three more points: the ending point of the previous curve is used as the starting point, the next two points in the sequence are control points, and the third is the ending point.
The Points parameter gives the endpoints to use when generating the Bezier curves.
This procedure draws lines by using the current Pen.
Note |
||
---|---|---|
In Delphi, you can use the Slice function to pass a portion of an array of points to the PolyBezier method. For example, to form a Bezier curve using the first ten points from an array of 100 points, use the Slice function as follows:
|
Control points after a[Index+3] are ignored. Nothing happens if there aren't enough control points.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
PolyBezierTo(TPointF[],Single)
Overloaded. Draws a set of Bezier curves.
Use PolyBezierTo to draw cubic Bezier curves using the endpoints and control points specified by the Points parameter. The first curve is drawn from the first point to the fourth point, using the second and third points as control points. Each subsequent curve in the sequence needs exactly three more points: the ending point of the previous curve is used as the starting point, the next two points in the sequence are control points, and the third is the ending point.
The Points parameter gives the endpoints to use when generating the Bezier curves.
This procedure draws lines by using the current Pen.
Note |
||
---|---|---|
In Delphi, you can use the Slice function to pass a portion of an array of points to the PolyBezierTo method. For example, to form a Bezier curve using the first ten points from an array of 100 points, use the Slice function as follows:
|
Control points after a[Index+3] are ignored. Nothing happens if there aren't enough control points.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Overloaded. Draws a set of Bezier curves.
Use PolyBezierTo to draw cubic Bezier curves using the endpoints and control points specified by the Points parameter. The first curve is drawn from the first point to the fourth point, using the second and third points as control points. Each subsequent curve in the sequence needs exactly three more points: the ending point of the previous curve is used as the starting point, the next two points in the sequence are control points, and the third is the ending point.
The Points parameter gives the endpoints to use when generating the Bezier curves.
This procedure draws lines by using the current Pen.
Note |
||
---|---|---|
In Delphi, you can use the Slice function to pass a portion of an array of points to the PolyBezierTo method. For example, to form a Bezier curve using the first ten points from an array of 100 points, use the Slice function as follows:
|
Control points after a[Index+3] are ignored. Nothing happens if there aren't enough control points.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Overloaded. Draws a series of lines on the canvas connecting the points passed in and closing the shape by drawing a line from the last point to the first point.
Use Polygon to draw a closed, many-sided shape on the canvas, using the value of Pen. After drawing the complete shape, Polygon fills the shape using the value of Brush.
The Points parameter is an array of points that give the vertices of the polygon. The first point is always connected to the last point.
Note |
||
---|---|---|
In Delphi, you can use the Slice function to pass a portion of an array of points to the Polygon method. For example, to form a polygon using the first ten points from an array of 100 points, use the Slice function as follows:
|
To draw a polygon on the canvas, without filling it, use the Polyline method, specifying the first point a second time at the end.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Overloaded. Draws a series of lines on the canvas connecting the points passed in and closing the shape by drawing a line from the last point to the first point.
Use Polygon to draw a closed, many-sided shape on the canvas, using the value of Pen. After drawing the complete shape, Polygon fills the shape using the value of Brush.
The Points parameter is an array of points that give the vertices of the polygon. The first point is always connected to the last point.
Note |
||
---|---|---|
In Delphi, you can use the Slice function to pass a portion of an array of points to the Polygon method. For example, to form a polygon using the first ten points from an array of 100 points, use the Slice function as follows:
|
To draw a polygon on the canvas, without filling it, use the Polyline method, specifying the first point a second time at the end.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Overloaded. Draws a series of lines on the canvas with the current pen, connecting each of the points passed to it in Points.
Use Polyline to connect a set of points on the canvas. If you specify only two points, Polyline draws a single line.
The Points parameter is an array of points to be connected.
Note |
||
---|---|---|
In Delphi, you can use the Slice function to pass a portion of an array of points to the Polyline method. For example, to form a polygon using the first ten points from an array of 100 points, use the Slice function as follows:
|
To draw a polygon on the canvas, without filling it, use the Polyline method, specifying the first point a second time at the end.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Overloaded. Draws a series of lines on the canvas with the current pen, connecting each of the points passed to it in Points.
Use Polyline to connect a set of points on the canvas. If you specify only two points, Polyline draws a single line.
The Points parameter is an array of points to be connected.
Note |
||
---|---|---|
In Delphi, you can use the Slice function to pass a portion of an array of points to the Polyline method. For example, to form a polygon using the first ten points from an array of 100 points, use the Slice function as follows:
|
To draw a polygon on the canvas, without filling it, use the Polyline method, specifying the first point a second time at the end.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Rectangle(Integer,Integer,Integer,Integer,Single)
Overloaded. Draws a rectangle on the canvas.
Use Rectangle to draw a rectangle using Pen and fill it with Brush. Specify the rectangle's coordinates in one of two ways:
• Giving four coordinates that define the upper left corner at the point (X1, Y1) and the lower right corner at the point (X2, Y2).
• Using a TRect type.
To fill a rectangular region without drawing the boundary in the current pen, use FillRect. To outline a rectangular region without filling it, use FrameRect or Polygon. To draw a rectangle with rounded corners, use RoundRect.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Rectangle(Single,Single,Single,Single,Single)
Overloaded. Draws a rectangle on the canvas.
Use Rectangle to draw a rectangle using Pen and fill it with Brush. Specify the rectangle's coordinates in one of two ways:
• Giving four coordinates that define the upper left corner at the point (X1, Y1) and the lower right corner at the point (X2, Y2).
• Using a TRect type.
To fill a rectangular region without drawing the boundary in the current pen, use FillRect. To outline a rectangular region without filling it, use FrameRect or Polygon. To draw a rectangle with rounded corners, use RoundRect.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Overloaded. Draws a rectangle on the canvas.
Use Rectangle to draw a rectangle using Pen and fill it with Brush. Specify the rectangle's coordinates in one of two ways:
• Giving four coordinates that define the upper left corner at the point (X1, Y1) and the lower right corner at the point (X2, Y2).
• Using a TRect type.
To fill a rectangular region without drawing the boundary in the current pen, use FillRect. To outline a rectangular region without filling it, use FrameRect or Polygon. To draw a rectangle with rounded corners, use RoundRect.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Overloaded. Draws a rectangle on the canvas.
Use Rectangle to draw a rectangle using Pen and fill it with Brush. Specify the rectangle's coordinates in one of two ways:
• Giving four coordinates that define the upper left corner at the point (X1, Y1) and the lower right corner at the point (X2, Y2).
• Using a TRect type.
To fill a rectangular region without drawing the boundary in the current pen, use FillRect. To outline a rectangular region without filling it, use FrameRect or Polygon. To draw a rectangle with rounded corners, use RoundRect.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
RestoreState(TRSCanvasSaveState,Boolean)
Overloaded. Restores the state of the canvas that was saved earlier using SaveState.
Note |
---|
This routine replaces the SaveState for early versions of FMX, which were buggy as of XE2 Upd 4. |
RoundRect(Integer,Integer,Integer,Integer,Integer,Integer,Single)
Overloaded. Draws a rectangle with rounded corners on the canvas.
Use RoundRect to draw a rounded rectangle using Pen and fill it with Brush. The rectangle will have edges defined by the points (X1,Y1), (X2,Y1), (X2,Y2), (X1,Y2), but the corners will be shaved to create a rounded appearance. The curve of the rounded corners matches the curvature of an ellipse with width X3 and height Y3.
To draw an ellipse instead, use Ellipse. To draw a true rectangle, use Rectangle.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
RoundRect(Single,Single,Single,Single,Single,Single,Single)
Overloaded. Draws a rectangle with rounded corners on the canvas.
Use RoundRect to draw a rounded rectangle using Pen and fill it with Brush. The rectangle will have edges defined by the points (X1,Y1), (X2,Y1), (X2,Y2), (X1,Y2), but the corners will be shaved to create a rounded appearance. The curve of the rounded corners matches the curvature of an ellipse with width X3 and height Y3.
To draw an ellipse instead, use Ellipse. To draw a true rectangle, use Rectangle.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
RoundRect(TRect,Integer,Integer,Single)
Overloaded. Draws a rectangle with rounded corners on the canvas.
Use RoundRect to draw a rounded rectangle using Pen and fill it with Brush. The rectangle will have edges defined by the Rect parameter, but the corners will be shaved to create a rounded appearance. The curve of the rounded corners matches the curvature of an ellipse with width CX and height CY.
To draw an ellipse instead, use Ellipse. To draw a true rectangle, use Rectangle.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
RoundRect(TRectF,Single,Single,Single)
Overloaded. Draws a rectangle with rounded corners on the canvas.
Use RoundRect to draw a rounded rectangle using Pen and fill it with Brush. The rectangle will have edges defined by the Rect parameter, but the corners will be shaved to create a rounded appearance. The curve of the rounded corners matches the curvature of an ellipse with width CX and height CY.
To draw an ellipse instead, use Ellipse. To draw a true rectangle, use Rectangle.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Overloaded. Saves the state of the canvas so that it can be changed and then restored later by calling RestoreState.
Note |
---|
This routine replaces the SaveState for early versions of FMX, which were buggy as of XE2 Upd 4. |
StretchDraw(TRect,TBitmap,Single)
Overloaded. Draws the graphic specified by the Bitmap parameter in the rectangle specified by the Rect parameter.
Call StretchDraw to draw a graphic on the canvas so that the image fits in the specified rectangle. This may involve changing magnification and/or aspect ratio.
To render the graphic in its natural size, use the Draw method, instead.
Note |
---|
Unlike the VCL StretchDraw method which uses TGraphic, the FMX StretchDraw method can only draw TBitmap. |
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
StretchDraw(TRectF,TBitmap,Single)
Overloaded. Draws the graphic specified by the Bitmap parameter in the rectangle specified by the Rect parameter.
Call StretchDraw to draw a graphic on the canvas so that the image fits in the specified rectangle. This may involve changing magnification and/or aspect ratio.
To render the graphic in its natural size, use the Draw method, instead.
Note |
---|
Unlike the VCL StretchDraw method which uses TGraphic, the FMX StretchDraw method can only draw TBitmap. |
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
Returns the width and height, in pixels, of a string rendered in the current font.
Use TextExtent to determine the space a string will occupy in the image. Other elements in the image such as lines, boxes, or additional lines of text can be positioned to accommodate the size of the text. TextExtent returns the width and height of the rectangle that bounds the text on the canvas.
To check only the height, call TextHeight. To check only the width, call TextWidth.
TextOut(Integer,Integer,string,Single)
Overloaded. Writes a string on the canvas, starting at the point (X,Y).
Use TextOut to write a string onto the canvas. The string will be written using the current value of Font. Use the TextExtent method to determine the space occupied by the text in the image. To write only the text that fits within a clipping rectangle, use TextRect instead.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
TextOut(Single,Single,string,Single)
Overloaded. Writes a string on the canvas, starting at the point (X,Y).
Use TextOut to write a string onto the canvas. The string will be written using the current value of Font. Use the TextExtent method to determine the space occupied by the text in the image. To write only the text that fits within a clipping rectangle, use TextRect instead.
Tip |
---|
This FMX version of the method adds a default Opacity parameter at the end of the parameters. This allows you to take advantage of the FMX ability to draw transparently to the canvas. Alternatively, don't set this parameter and it works exactly like the VCL TCanvas method. |
TextRect(TRect,Integer,Integer,string)
Overloaded. Writes a string inside a clipping rectangle.
Use TextRect to write a string within a limited rectangular region. Any portions of the string that fall outside the rectangle passed in the Rect parameter are clipped and don't appear. The upper left corner of the text is placed at the point (X, Y).
TextRect(TRectF,Single,Single,string)
Overloaded. Writes a string inside a clipping rectangle.
Use TextRect to write a string within a limited rectangular region. Any portions of the string that fall outside the rectangle passed in the Rect parameter are clipped and don't appear. The upper left corner of the text is placed at the point (X, Y).
Reference |