Hide Comments
Hide Comments

Comments (0)

Encapsulates the GDI+ Graphics class as a Delphi TCustomCanvas descendant. The TRSGPCanvas class provides methods for drawing lines, curves, figures, images, and text. A TRSGPCanvas object stores attributes of the display device and attributes of the items to be drawn.

Like the VCL TCanvas class or the FMX TCanvas class, the TRSGPCanvas exposes Brush, Pen, and Font properties. The TRSGPCanvas class implements the TCustomCanvas class to provide easier sharing of code between the VCL TCanvas and the TRSGPCanvas. It also exposes methods that implement the GDI+ Graphics class like the FMX TCanvas class, providing easy sharing with the FMX library as well.

Namespace: RSGdiPlusGraphics

expandingInheritance Hierarchy
expandingSyntax
expandingConstructors
expandingProperties
expandingMethods

If the bounding rectangle is a square, a circle is drawn.

public method

FillArc(TPointF,TPointF,Single,Single,Single)

Overloaded.  Fills an arc on the canvas.

The arc is created as a path containing the part of an ellipse contour. FillArc fills this path on the current canvas with the current brush specified by the Fill property.
 

public method

FillArc(TPointF,TPointF,Single,Single,Single,TRSGPBrush)

Overloaded.  Fills an arc on the canvas.

The arc is created as a path containing the part of an ellipse contour. FillArc fills this path on the current canvas with the specified brush.
 

public method

FillEllipse(TRectF,Single)

Overloaded.  Fills an ellipse defined by a bounding rectangle structure and draws it on the current canvas.

FillEllipse is implemented by the TCanvas descendants to fill an ellipse defined by a bounding rectangle structure, with the current brush specified by the Fill property.
 

public method

FillEllipse(TRectF,Single,TRSGPBrush)

Overloaded.  Fills an ellipse defined by a bounding rectangle structure and draws it on the current canvas.

FillEllipse is implemented by the TCanvas descendants to fill an ellipse defined by a bounding rectangle structure, with the current brush specified by the Fill property.
 

protected method

FillOutsideGradient(TRectF,Single,TRSGPBrush)

Overloaded. Represents method FillOutsideGradient(TRectF,Single,TRSGPBrush).

protected method

FillOutsideGradient(TRectF,TRSGPPath,Single,TRSGPBrush)

Overloaded. Represents method FillOutsideGradient(TRectF,TRSGPPath,Single,TRSGPBrush).

public method

FillPath(TRSGPPath,Single)

Overloaded.  Fills a path and displays it on the current canvas.

FillPath fills a shape specified by a TRSGPPath, with the current brush specified by the Fill property.

If APath is empty, FillPath does nothing. In this case, it does not raise any errors.

noteNote

Before calling FillPath, make sure that APath is created.

public method

FillPath(TRSGPPath,Single,TRSGPBrush)

Overloaded.  Fills a path and displays it on the current canvas.

FillPath fills a shape specified by a TRSGPPath, with the current brush specified by the Fill property.

If APath is empty, FillPath does nothing. In this case, it does not raise any errors.

noteNote

Before calling FillPath, make sure that APath is created.

public method

FillPath(TRSPathData,Single)

Overloaded.  Fills a path and displays it on the current canvas.

FillPath fills a shape specified by a TRSPathData, with the current brush specified by the Fill property.

If APath is empty, FillPath does nothing. In this case, it does not raise any errors.

noteNote

Before calling FillPath, make sure that APath is created.

public method

FillPath(TRSPathData,Single,TRSGPBrush)

Overloaded.  Fills a path and displays it on the current canvas.

FillPath fills a shape specified by a TRSPathData, with the current brush specified by the Fill property.

If APath is empty, FillPath does nothing. In this case, it does not raise any errors.

noteNote

Before calling FillPath, make sure that APath is created.

public method

FillRect(TRect)

Overloaded.  Fills the specified rectangle on the canvas using the current brush.

Implements filling of a rectangular region using the current brush. The region is filled including the top and left edges of the rectangle, but excluding the bottom and right edges.
 
 

public method

FillRect(TRectF,Single)

Overloaded.  Fills the specified rectangle on the canvas using the current brush.

Implements filling of a rectangular region using the current brush. The region is filled including the top and left edges of the rectangle, but excluding the bottom and right edges.
 
 

public method

FillRect(TRectF,Single,Single,TRSGPCorners,Single,TRSGPBrush,TRSGPCornerType)

Overloaded.  Fills a rectangle with customized corners on the current canvas.

FillRect is implemented by TCanvas descendants to fill--with the current brush specified by the Fill property or with the brush specified by the ABrush parameter--the ARect rectangle with customized shapes of corners.
 

public method

FillRect(TRectF,Single,Single,TRSGPCorners,Single,TRSGPCornerType)

Overloaded.  Fills a rectangle with customized corners on the current canvas.

FillRect is implemented by TCanvas descendants to fill--with the current brush specified by the Fill property or with the brush specified by the ABrush parameter--the ARect rectangle with customized shapes of corners.
 

public method

FillText(TRectF,string,Boolean,Single,TRSGPFillTextFlags,TRSGPFont,TRSGPStringAlignment,TRSGPStringAlignment)

Overloaded.  Displays a text string on a specified rectangle area of the current canvas.

FillText is implemented by the TCanvas descendants to display a text string with the specified alignment and the specified font. The text is displayed in a specified rectangle area of the current canvas.
 

public method

FillText(TRectF,string,Boolean,Single,TRSGPFillTextFlags,TRSGPStringAlignment,TRSGPStringAlignment)

Overloaded.  Displays a text string on a specified rectangle area of the current canvas.

FillText is implemented by the TCanvas descendants to display a text string with the specified alignment and the current font specified by the     Font property. The text is displayed in a specified rectangle area of the current canvas.
 

public method

FillText(TRectF,string,Single)

Overloaded.  Displays a text string on a specified rectangle area of the current canvas.

FillText draws a text string using the current string format and the specified font. The text is displayed in a specified rectangle area of the current canvas.
 

public method

FillText(TRectF,string,TRSGPStringFormat,Single)

Overloaded.  Displays a text string on a specified rectangle area of the current canvas.

FillText draws a text string using the specified String format and the current font specified by the     Font property. The text is displayed in a specified rectangle area of the current canvas.

The StringFormat object specifies text layout information (such as alignment, orientation, tab stops, and clipping) and display manipulations (such as trimming, font substitution for characters that are not supported by the requested font, and digit substitution for languages that do not use Western European digits).
 

public method

FillText(TRectF,string,TRSGPStringFormat,TRSGPFont,Single)

Overloaded.  Displays a text string on a specified rectangle area of the current canvas.

FillText draws a text string using the specified String format and the specified font. The text is displayed in a specified rectangle area of the current canvas.

The StringFormat object specifies text layout information (such as alignment, orientation, tab stops, and clipping) and display manipulations (such as trimming, font substitution for characters that are not supported by the requested font, and digit substitution for languages that do not use Western European digits).
 

public method

FloodFill(Integer,Integer,TColor,TFillStyle)

Not implemented

public method

FrameRect(TRect)

Draws a rectangle using the current brush of the canvas to draw the border.

Implements the drawing a 1-pixel-wide border around a rectangular region. FrameRect does not fill the interior of the rectangle with the current brush pattern.

protected method

GetCanvasOrientation

Represents method GetCanvasOrientation.

protected method

GetClipRect

Represents method GetClipRect.

protected method

GetHandle

Represents method GetHandle.

protected method

GetPenPos

Represents method GetPenPos.

protected method

GetPixel(Integer,Integer)

Represents method GetPixel(Integer,Integer).

protected method

InitProperties

Initializes canvas properties based on the GDI+ values

protected method

InitResources

Creates and initializes the canvas resources

public method

LineTo(Integer,Integer)

Draws a line on the canvas from PenPos to the point specified by X and Y, and sets the pen position to (X, Y).

Implements drawing a line from PenPos up to, but not including the point (X,Y). LineTo changes the value of PenPos to (X,Y).
 
 

public method

MakeScreenshot(Integer,Integer)

Makes a screenshot of the contents of the canvas

public method

MeasureText(TRectF,string,Boolean,TRSGPFillTextFlags,TRSGPFont,TRSGPStringAlignment,TRSGPStringAlignment)

Overloaded.  Measures the area occupied by a text string with the specified alignments, flag, and the specified font, on the canvas.

MeasureText is implemented by the TCanvas descendants to determine the rectangle area occupied by a text string with the specified wrapping, alignments, flag, and specified font. The string text is framed in a rectangle.

The ARect parameter specifies the bounding rectangle of the text. ARect is the return variable. If ARect is not initialized, the returned rectangle is centered in (0,0).
 

public method

MeasureText(TRectF,string,Boolean,TRSGPFillTextFlags,TRSGPStringAlignment,TRSGPStringAlignment)

Overloaded.  Measures the area occupied by a text string with the specified alignments, flag, and current font, on the canvas.

MeasureText is implemented by the TCanvas descendants to determine the rectangle area occupied by a text string with the specified wrapping, alignments, flag, and current font. The string text is framed in a rectangle.

The ARect parameter specifies the bounding rectangle of the text. ARect is the return variable. If ARect is not initialized, the returned rectangle is centered in (0,0).
 
 
 

public method

MeasureText(TRectF,string,TRSGPStringFormat)

Overloaded.  Measures the area occupied by a text string with the specified alignments, flag, and current font, on the canvas.

MeasureText determines the rectangle area occupied by a text string with the specified text layout information and current font. The string text is framed in a rectangle.

The ARect parameter specifies the bounding rectangle of the text. ARect is the return variable. If ARect is not initialized, the returned rectangle is centered in (0,0).

The StringFormat object specifies text layout information (such as alignment, orientation, tab stops, and clipping) and display manipulations (such as trimming, font substitution for characters that are not supported by the requested font, and digit substitution for languages that do not use Western European digits).
 

public method

MeasureText(TRectF,string,TRSGPStringFormat,TRSGPFont)

Overloaded.  Measures the area occupied by a text string with the specified alignments, flag, and the specified font, on the canvas.

MeasureText determines the rectangle area occupied by a text string with the specified text layout information and specified font. The string text is framed in a rectangle.

The ARect parameter specifies the bounding rectangle of the text. ARect is the return variable. If ARect is not initialized, the returned rectangle is centered in (0,0).

The StringFormat object specifies text layout information (such as alignment, orientation, tab stops, and clipping) and display manipulations (such as trimming, font substitution for characters that are not supported by the requested font, and digit substitution for languages that do not use Western European digits).
 

public method

MoveTo(Integer,Integer)

Changes the current drawing position to the point (X,Y).

Implements the setting the value of PenPos before calling LineTo. Calling MoveTo is equivalent to setting the PenPos property.
 
 

protected method

Notification(TRSGPGraphicsObject,TOperation)

Represents method Notification(TRSGPGraphicsObject,TOperation).

public method

Pie(Integer,Integer,Integer,Integer,Integer,Integer,Integer,Integer)

Not implemented

public method

PolyBezier(TPoint[])

Draws a set of Bezier curves.

Implements drawing 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. PolyBezier draws lines by using the current pen.

The Points parameter gives the endpoints to use when generating the Bezier curves. Control points after a[Index+3] are ignored. Nothing happens if there are not enough control points.
 

noteNote

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: Canvas.PolyBezier(Slice(PointArray, 10));

public method

PolyBezierTo(TPoint[])

Draws a set of Bezier curves and updates the value of PenPos.

Implements drawing 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. PolyBezierTo draws lines by using the current pen and updates the value of PenPos to the value of the last endpoint.

The Points parameter gives the endpoints to use when generating the Bezier curves. Control points after a[Index+3] are ignored. Nothing happens if there are not enough control points.
 

noteNote

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: Canvas.PolyBezierTo(Slice(PointArray, 10));

public method

Polygon(TPoint[])

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.

Implements drawing a closed, many-sided shape on the canvas, using the value of Pen. After drawing the complete shape, Polygon fills the shape using the current 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.

To draw a polygon on the canvas, without filling it, use the Polyline method, specifying the first point a second time, at the end.

noteNote

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: Canvas.Polygon(Slice(PointArray, 10));

public method

Polyline(TPoint[])

Draws a series of lines on the canvas with the current pen, connecting each of the points passed to it in Points.

Implements connecting 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.

Calling the     MoveTo function with the value of the first point, and then repeatedly calling     LineTo with all subsequent points will draw the same image on the canvas. However, unlike LineTo, Polyline does not change the value of PenPos.

noteNote

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: Canvas.Polyline(Slice(PointArray, 10));

public method

Rectangle(Integer,Integer,Integer,Integer)

Draws a rectangle on the canvas.

Implements drawing a rectangle using the pen and filling it with the current brush.

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.
 

public method

Refresh

Not implemented

protected method

RequiredState(TCanvasState)

Represents method RequiredState(TCanvasState).

public method

RestoreCurrentState(TRSGPSaveState)

Restores the current transformations, clipping region, and quality settings of the canvas to a saved state.

RestoreCurrentState restores a previous saved state of the canvas.

Call RestoreCurrentState to restore the drawing and filling properties (excluding the Stroke, Fill, and Font properties) to values saved in previous moments of the drawing process.

The State parameter specifies the pointer to the saved data. After the state is restored, the saved data are freed. If State is empty, RestoreCurrentState raises an exception.

To save the canvas state, call     SaveCurrentState.
 

public method

RestoreState(TRSGPCanvasSaveState)

Restores the current transformations, clipping region, and quality settings, as well as drawing and filling properties of the canvas to a saved state.

RestoreState restores a previous saved state of the canvas.

Call RestoreState to restore the drawing and filling properties to values saved in previous moments of the drawing process.

The State parameter specifies the pointer to the saved data. After the state is restored, the saved data are freed. If State is empty, RestoreState raises an exception.

To save the canvas state, call     SaveState.
 

public method

RoundRect(Integer,Integer,Integer,Integer,Integer,Integer)

Draws a rectangle with rounded corners on the canvas.

Implements drawing a rounded rectangle using the current pen and fill it with the current 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.
 
 

public method

RSGPPath(TRSPathData)

Creates a GDI+ path that is a copy of the TRSPathData path.

noteNote

The calling method should free the created path

public method

SaveCurrentState

Saves the current GDI+ state (transformations, clipping region, and quality settings) of the canvas. Note that this does not include Fill, Stroke, or Font properties. To also save these properties, call       SaveState instead.

Call SaveCurrentState to save the drawing and filling properties in different moments of the drawing process.

SaveCurrentState returns a TRSGPSaveState object.

To restore the saved states, call RestoreCurrentState.
 

public method

SaveState

Saves the current transformations, clipping region, and quality settings, as well as drawing and filling properties of the canvas.
 

SaveState saves the current state of the canvas. The properties are saved to be restored later.

Call SaveState to save the drawing and filling properties in different moments of the drawing process.

SaveState returns a TRSGPCanvasSaveState object.

To restore the saved states, call RestoreState.
 

public method

SetMatrix(TRSGPMatrix)

Sets the world transformation of the canvas

protected method

SetPenPos(TPoint)

Represents method SetPenPos(TPoint).

protected method

SetPixel(Integer,Integer,TColor)

Represents method SetPixel(Integer,Integer,TColor).

public method

StretchDraw(TRect,TGraphic)

Draws the graphic specified by the Graphic parameter in the rectangle specified by the Rect parameter.

Implements drawing a graphic on the canvas so that the image fits in the specified rectangle.

To render the graphic in its natural size, use the Draw method instead.
 

public method

TextExtent(string)

Returns the width and height, in pixels, of a string rendered in the current font.

Provides information about 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.

Both the TextHeight and TextWidth methods call TextExtent to obtain the height and width information.
 

public method

TextExtentF(string)

Returns the width and height, in pixels, of a string rendered in the current font.

Provides information about 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.

Both the TextHeight and TextWidth methods call TextExtent to obtain the height and width information.
 

public method

TextHeight(string)

Represents method TextHeight(string).

public method

TextOut(Integer,Integer,string)

Overloaded.  Writes a string on the canvas, starting at the point (X,Y), and then updates the PenPos to the end of the string.

Implements writing a string onto the canvas. The string will be written using the current font. Use the TextExtent method to determine the space occupied by text in the image. To write only the text that fits within a clipping rectangle, use TextRect instead.

After a call to TextOut, the PenPos property indicates the point at the top right of the text on the canvas.
 
 

public method

TextOut(Single,Single,string)

Overloaded.  Writes a string on the canvas, starting at the point (X,Y), and then updates the PenPos to the end of the string.

Implements writing a string onto the canvas. The string will be written using the current font. Use the TextExtent method to determine the space occupied by text in the image. To write only the text that fits within a clipping rectangle, use TextRect instead.

After a call to TextOut, the PenPos property indicates the point at the top right of the text on the canvas.
 
 

public method

TextRect(TRect,Integer,Integer,string)

Overloaded.  Writes a string inside a clipping rectangle.

Implements writing 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 do not appear. The upper-left corner of the text is placed at the point (X, Y).
 
 

public method

TextRect(TRect,string,TTextFormat)

Overloaded. Not implemented

public method

TextWidth(string)

 

public method

TextWidthTight(string)

Represents method TextWidthTight(string).

public method

TrySmoothingMode(TRSGPSmoothingMode)

Attempts to set the   SmoothingMode of the canvas to the mode and returns true if it can be done. If the attempt fails, the smoothing mode will be reset to the current mode.

Top

expandingExamples
expandingSee Also

Comments (0)

RiverSoftAVG SVG Component Library (RSCL) © 2013-2016, Thomas G. Grubb