DrawArc(pen, center, radius, startAngle, sweepAngle) DrawPie(pen, center, radius, startAngle, sweepAngle) DrawPie(pen, centerX, centerY, radius, startAngle, sweepAngle) DrawText(text, brush, font, centerX, centerY) SetViewport(leftWX, topWY, rightWX, bottomWY, maintainAspect) SetViewport(leftWX, topWY, rightWX, bottomWY, aspectXY) SetViewportHorz(worldLeft, worldRight, screenLeft, screenRight, maintainAspect) SetViewportVert(worldTop, worldBottom, screenTop, screenBottom, maintainAspect)
Legend Class Struct Enum Interface Delegate | Constructor Method Property Event Field |
| Sealed class: RT.Util.Drawing.CanvasSummary
Wraps a Graphics to provide a hopefully more convenient interface. The major bits
of functionality are: -
all coordinates in doubles or [Unrecognized cref attribute] structs;
-
support for the Y axis growing upwards;
-
functions targeted at drawing a 2d world onto a viewport of a specified size.
Common terms and abbreviations:
Screen |
Rectangular area that will be the final destination of the drawing. |
Viewport |
The region, defined in terms of the world coordinates, that is viewable on the screen. |
World coordinates |
Coordinates of the underlying "world" being represented. |
Screen coordinates |
Coordinates on the screen, can be used to directly draw on the underlying Graphics. |
WX, WY, WW, WH |
World X, Y, Width, Height, respectively |
SX, SY, SW, SH |
Screen X, Y, Width, Height, respectively |
Constructors | Creates an instance without initializing any of the required fields. | | Creates an instance using the specified Graphics as the underlying drawing surface. | Canvas(Graphics graphics, Size screenSize) |
Creates an instance using the specified graphics and screenSize. See Canvas.ScreenSize for more info. |
Instance methodsvoid | | Fills the entire "screen" with the specified color. | void | DrawArc(Pen pen, PointD center, double radius, double startAngle, double sweepAngle) | Draws an arc using the specified pen. | void | | Draws a circle using the specified pen. | void | DrawCircle(Pen pen, double centerX, double centerY, double radius) | void | | Draws a straight line using the specified pen. | void | | void | DrawLine(Pen pen, double x1, double y1, double x2, double y2) | void | | Draws a GraphicsPath using the specified pen. | void | DrawPie(Pen pen, PointD center, double radius, double startAngle, double sweepAngle) |
Draws a "pie" using the specified pen. A pie is a circular arc whose endpoints are connected to the centre
with straight lines. | void | DrawPie(Pen pen, double centerX, double centerY, double radius, double startAngle, double sweepAngle) | void | | Draws a rectangle using the specified pen. The bounding box defines the coordinates. | void | DrawRectangle(Pen pen, double xMin, double yMin, double width, double height) |
Draws a rectangle using the specified pen. "xMin" and "yMin" specify the corner that has the smallest
coordinates, so the resulting rectangle will be on coordinates xMin, yMin, xMin+width, yMin+height. | void | |
Draws text using the specified font and brush. The text's bounding box is centered on the specified point. | void | DrawText(string text, Brush brush, double centerX, double centerY) |
Draws text using the default font and the specified brush. The text's bounding box is centered on the
specified point. | void | DrawText(string text, Brush brush, Font font, double centerX, double centerY) |
Draws text using the specified font and brush. The text's bounding box is centered on the specified point. | void | | These members are not documented. | void | | void | DrawTextOutline(string text, Pen pen, Font font, double centerX, double centerY) | void | | void | | Draws a triangle using the specified pen. | void | | void | | Fills a circle using the specified pen. | void | FillCircle(Brush brush, double centerX, double centerY, double radius) | void | FillPath(Brush brush, GraphicsPath path) | Fills a GraphicsPath using the specified brush. | void | | Fills a rectangle using the specified brush. The bounding box defines the coordinates. | void | FillRectangle(Brush brush, double xMin, double yMin, double width, double height) |
Fills a rectangle using the specified brush. "xMin" and "yMin" specify the corner that has the smallest
coordinates, so the resulting rectangle will be on coordinates xMin, yMin, xMin+width, yMin+height. | void | | Fills a triangle using the specified brush. | void | | GraphicsPath | | This member is not documented. | void | |
Adjusts the offsets so that the world coordinate wx,wy is at the screen coordinate sx,sy. Does not modify the
scaling. | void | |
Resets the scaling and offset so that world coordinates correspond to screen pixels. Maintains the offsets so
that all visible pixels have positive coordinates and one of the corners is 0,0. | void | SetViewport(double centerWX, double centerWY, double scale) |
Sets the viewport so that the specified world coordinate is in the centre of the viewable screen, using the
specified scaling factor. | void | SetViewport(double leftWX, double topWY, double rightWX, double bottomWY, bool maintainAspect) |
Sets the scaling and offset so that the world coordinate "leftWX" corresponds to the leftmost coordinate on
the screen, world "topWY" to the topmost screen coordinate, etc. If "maintainAspect" is "true", ensures that X
and Y scaling is the same, by making one of the axes show more than implied by the arguments passed in. | void | SetViewport(double leftWX, double topWY, double rightWX, double bottomWY, double aspectXY) | These members are not documented. | void | SetViewportHeight(double worldHeight, float screenHeight, bool maintainAspect = false) | void | | void | | void | SetViewportHorz(double worldLeft, double worldRight, float screenLeft, float screenRight, bool maintainAspect = false) | void | | void | | void | SetViewportVert(double worldTop, double worldBottom, float screenTop, float screenBottom, bool maintainAspect = false) | void | SetViewportWidth(double worldWidth, float screenWidth, bool maintainAspect = false) | float | | Converts world height into screen height. Screen height is measured in pixels. | PointF | | Converts a world point to a screen point. | float | | Converts world width into screen width. Screen width is measured in pixels. | float | |
Converts world X coordinate into screen X. Screen X is zero at the leftmost pixel and Screen.Width at the
rightmost pixel. | float | |
Converts world Y coordinate into screen Y. Screen Y is zero at the topmost pixel and Screen.Height at the
bottommost pixel. | double | | Converts screen height into world height. Screen height is measured in pixels. | PointD | | Converts a screen point to a world point. | double | | Converts screen width into world width. Screen width is measured in pixels. | double | |
Converts screen X coordinate into world X. Screen X is zero at the leftmost pixel and Screen.Width at the
rightmost pixel. | double | |
Converts screen Y coordinate into world Y. Screen Y is zero at the topmost pixel and Screen.Height at the
bottommost pixel. |
Instance propertiesdouble | | These members are not documented. | float | | float | | double | | double | | double | | double | | double | |
Instance fieldsCoordinateAxesDirection | | Selects a coordinate axes mode. | Font | | The font to be used by text drawing functions if no font is specified. | Graphics | | The underlying Graphics. All the actual drawing is done onto this instance. | Size | |
Stores the screen size. "Screen" here refers to the final surface that this Canvas is destined for. The screen
size is used for "set viewport" methods which do not take a screen location: they assume the relevant screen
edge is meant instead. |
|