TTMSFNCGraphicsContext Class
Abstract base class for all platform-specific rendering contexts. Each platform (Win, Mac, iOS, Android, Web, Unix) provides a concrete subclass that implements the drawing primitives for its native canvas.
API unit family: TMSFNCGraphics
Syntax
TTMSFNCGraphicsContext = class
Properties
| Name | Description |
|---|---|
| Canvas | The framework canvas associated with this rendering context. |
| Graphics | The TTMSFNCGraphics instance that owns this rendering context. |
| NativeCanvas | A pointer to the underlying native canvas object (e.g., a CGContextRef on macOS/iOS, a Graphics on .NET, etc.). |
Methods
| Name | Description |
|---|---|
| BeginPrinting | Switches the context into printer output mode. Match with EndPrinting. |
| BeginScene | Starts a drawing scene on the canvas. Returns True when the scene was successfully started; must be matched with EndScene. |
| CalculateText | Measures the bounding rectangle of AText rendered inside ARect with optional word-wrapping. |
| ClipPath | Restricts all subsequent drawing operations to the region enclosed by APath. |
| ClipRect | Restricts all subsequent drawing operations to the rectangle ARect. |
| ConvertToPath | Converts a TTMSFNCGraphicsPath to a native path representation, applying the given flatness tolerance for curve approximation. |
| CreatePath | Allocates a new native path object. The caller is responsible for freeing the returned pointer via the path API. |
| DrawArc | Strokes an arc using AStroke settings. |
| DrawBitmap | Draws a source region of a bitmap into a destination rectangle at the given opacity. |
| DrawEllipse | Strokes an ellipse inscribed within ARect using AStroke settings. |
| DrawFocusPath | Draws a focus indicator along the outline of a path using the given stroke settings. |
| DrawFocusRectangle | Draws a focus indicator around a rectangle using the given stroke settings. |
| DrawLine | Draws a stroked line from AFromPoint to AToPoint using AStroke settings. |
| DrawPath | Strokes a graphics path using AStroke settings. |
| DrawPolygon | Strokes a closed polygon using AStroke settings. |
| DrawPolyline | Strokes an open polyline using AStroke settings. |
| DrawRect | Strokes the specified sides of a rectangle using AStroke settings. |
| DrawRoundRect | Strokes a rounded rectangle using AStroke settings. |
| DrawText | Renders text inside a rectangle with the specified layout, alignment, trimming, and rotation. |
| EndPrinting | Ends a printer output session started by BeginPrinting. |
| EndScene | Ends a drawing scene started by BeginScene and commits any buffered output. |
| FillArc | Fills an arc sector using AFill settings. |
| FillEllipse | Fills an ellipse inscribed within ARect using AFill settings. |
| FillPath | Fills a graphics path using AFill settings. |
| FillPolygon | Fills a closed polygon using AFill settings. |
| FillPolyline | Fills an open polyline region using AFill settings. |
| FillRect | Fills a rectangle using AFill settings. |
| FillRoundRect | Fills a rounded rectangle using AFill settings. |
| GetFillColor | Returns the current active fill color applied to the canvas. |
| GetMatrix | Returns the current transformation matrix applied to the canvas. |
| PathClose | Closes the current sub-path in native path APath by adding a line to the starting point. |
| PathLineTo | Adds a straight line segment from the current position to APoint in native path APath. |
| PathMoveTo | Moves the current drawing position within native path APath to APoint without drawing. |
| PathOpen | Opens the native path APath for subsequent PathMoveTo/PathLineTo/PathClose operations. |
| Render | Flushes all pending drawing commands to the underlying canvas or display surface. |
| ResetClip | Removes any active clipping region, restoring the full canvas drawing area. |
| ResetTextAngle | Reverses the text rotation applied by a previous SetTextAngle call, restoring the pre-rotation transform state. |
| ResetTransform | Resets the canvas transform to the identity matrix, removing all scales, rotations, and translations. |
| RestoreState | Restores a previously saved canvas state. |
| RotateTransform | Appends a rotation to the current canvas transform. |
| SaveState | Saves the current canvas state (transform, clip, pen/brush settings) into AState for later restoration via RestoreState. |
| ScaleTransform | Appends a scale transform to the current canvas transform. |
| SetAntiAliasing | Enables or disables anti-aliased rendering for shapes and paths on the canvas. |
| SetFill | Applies fill settings to the canvas. |
| SetFillColor | Changes the fill color on the canvas. |
| SetFillKind | Changes the fill kind on the canvas. |
| SetFont | Applies all settings from a font object to the canvas. |
| SetFontColor | Sets the font color on the canvas. |
| SetFontName | Sets the font family name on the canvas. |
| SetFontSize | Sets the font size in points on the canvas. |
| SetFontStyles | Sets the font style set on the canvas. |
| SetMatrix | Applies a transformation matrix to the canvas, replacing the current transform. |
| SetScale | Applies a uniform scale factor to the canvas transform. |
| SetShowAcceleratorChar | Controls whether keyboard accelerator underlines are drawn in text. |
| SetSize | Resizes the backing surface of the context. |
| SetStroke | Applies stroke settings to the canvas. |
| SetStrokeColor | Changes the stroke color on the canvas. |
| SetStrokeKind | Changes the stroke kind on the canvas. |
| SetStrokeWidth | Changes the stroke width in pixels on the canvas. |
| SetTextAngle | Adjusts the text drawing rectangle to account for the given rotation angle and returns the transformed rectangle. |
| SetTextQuality | Sets the text rendering quality on the canvas. |
| StartSpecialPen | Activates special-pen rendering mode on the canvas for platform-specific stroke effects. |
| StopSpecialPen | Deactivates special-pen rendering mode started by StartSpecialPen. |
| TranslateTransform | Appends a translation to the current canvas transform. |