Class RGraphics
- Namespace
- TheArtOfDev.HtmlRenderer.Adapters
- Assembly
- StockSharp.Xaml.dll
Adapter for platform specific graphics rendering object - used to render graphics and text in platform specific context.
The core HTML Renderer components use this class for rendering logic, extending this
class in different platform: WinForms, WPF, Metro, PDF, etc.
public abstract class RGraphics : IDisposable
- Inheritance
-
RGraphics
- Implements
- Inherited Members
- Extension Methods
Constructors
RGraphics(RAdapter, RRect)
Init.
protected RGraphics(RAdapter adapter, RRect initialClip)
Parameters
Fields
Adapter
the global adapter
protected readonly RAdapter Adapter
Field Value
ClipStack
The clipping bound stack as clips are pushed/poped to/from the graphics
protected readonly Stack<RRect> ClipStack
Field Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public abstract void Dispose()
DrawImage(RImage, RRect)
Draws the specified Image at the specified location and with the specified size.
public abstract void DrawImage(RImage image, RRect destRect)
Parameters
imageRImageImage to draw.
destRectRRectRectangle structure that specifies the location and size of the drawn image.
DrawImage(RImage, RRect, RRect)
Draws the specified portion of the specified RImage at the specified location and with the specified size.
public abstract void DrawImage(RImage image, RRect destRect, RRect srcRect)
Parameters
imageRImageImage to draw.
destRectRRectRectangle structure that specifies the location and size of the drawn image. The image is scaled to fit the rectangle.
srcRectRRectRectangle structure that specifies the portion of the
imageobject to draw.
DrawLine(RPen, double, double, double, double)
Draws a line connecting the two points specified by the coordinate pairs.
public abstract void DrawLine(RPen pen, double x1, double y1, double x2, double y2)
Parameters
penRPenPen that determines the color, width, and style of the line.
x1doubleThe x-coordinate of the first point.
y1doubleThe y-coordinate of the first point.
x2doubleThe x-coordinate of the second point.
y2doubleThe y-coordinate of the second point.
DrawPath(RBrush, RGraphicsPath)
Fills the interior of a GraphicsPath.
public abstract void DrawPath(RBrush brush, RGraphicsPath path)
Parameters
brushRBrushBrush that determines the characteristics of the fill.
pathRGraphicsPathGraphicsPath that represents the path to fill.
DrawPath(RPen, RGraphicsPath)
Draws a GraphicsPath.
public abstract void DrawPath(RPen pen, RGraphicsPath path)
Parameters
penRPenPen that determines the color, width, and style of the path.
pathRGraphicsPathGraphicsPath to draw.
DrawPolygon(RBrush, RPoint[])
Fills the interior of a polygon defined by an array of points specified by Point structures.
public abstract void DrawPolygon(RBrush brush, RPoint[] points)
Parameters
brushRBrushBrush that determines the characteristics of the fill.
pointsRPoint[]Array of Point structures that represent the vertices of the polygon to fill.
DrawRectangle(RBrush, double, double, double, double)
Fills the interior of a rectangle specified by a pair of coordinates, a width, and a height.
public abstract void DrawRectangle(RBrush brush, double x, double y, double width, double height)
Parameters
brushRBrushBrush that determines the characteristics of the fill.
xdoubleThe x-coordinate of the upper-left corner of the rectangle to fill.
ydoubleThe y-coordinate of the upper-left corner of the rectangle to fill.
widthdoubleWidth of the rectangle to fill.
heightdoubleHeight of the rectangle to fill.
DrawRectangle(RPen, double, double, double, double)
Draws a rectangle specified by a coordinate pair, a width, and a height.
public abstract void DrawRectangle(RPen pen, double x, double y, double width, double height)
Parameters
penRPenA Pen that determines the color, width, and style of the rectangle.
xdoubleThe x-coordinate of the upper-left corner of the rectangle to draw.
ydoubleThe y-coordinate of the upper-left corner of the rectangle to draw.
widthdoubleThe width of the rectangle to draw.
heightdoubleThe height of the rectangle to draw.
DrawString(string, RFont, RColor, RPoint, RSize, bool)
Draw the given string using the given font and foreground color at given location.
public abstract void DrawString(string str, RFont font, RColor color, RPoint point, RSize size, bool rtl)
Parameters
strstringthe string to draw
fontRFontthe font to use to draw the string
colorRColorthe text color to set
pointRPointthe location to start string draw (top-left)
sizeRSizeused to know the size of the rendered text for transparent text support
rtlboolis to render the string right-to-left (true - RTL, false - LTR)
GetClip()
Gets a Rectangle structure that bounds the clipping region of this Graphics.
public RRect GetClip()
Returns
- RRect
A rectangle structure that represents a bounding rectangle for the clipping region of this Graphics.
GetGraphicsPath()
Get GraphicsPath object.
public abstract RGraphicsPath GetGraphicsPath()
Returns
- RGraphicsPath
graphics path instance
GetLinearGradientBrush(RRect, RColor, RColor, double)
Get linear gradient color brush from color1 to color2.
public RBrush GetLinearGradientBrush(RRect rect, RColor color1, RColor color2, double angle)
Parameters
rectRRectthe rectangle to get the brush for
color1RColorthe start color of the gradient
color2RColorthe end color of the gradient
angledoublethe angle to move the gradient from start color to end color in the rectangle
Returns
- RBrush
linear gradient color brush instance
GetPen(RColor)
Get color pen.
public RPen GetPen(RColor color)
Parameters
colorRColorthe color to get the pen for
Returns
- RPen
pen instance
GetSolidBrush(RColor)
Get solid color brush.
public RBrush GetSolidBrush(RColor color)
Parameters
colorRColorthe color to get the brush for
Returns
- RBrush
solid color brush instance
GetTextureBrush(RImage, RRect, RPoint)
Get TextureBrush object that uses the specified image and bounding rectangle.
public abstract RBrush GetTextureBrush(RImage image, RRect dstRect, RPoint translateTransformLocation)
Parameters
imageRImageThe Image object with which this TextureBrush object fills interiors.
dstRectRRectA Rectangle structure that represents the bounding rectangle for this TextureBrush object.
translateTransformLocationRPointThe dimension by which to translate the transformation
Returns
MeasureString(string, RFont)
Measure the width and height of string str when drawn on device context HDC
using the given font font.
public abstract RSize MeasureString(string str, RFont font)
Parameters
Returns
- RSize
the size of the string
MeasureString(string, RFont, double, out int, out double)
Measure the width of string under max width restriction calculating the number of characters that can fit and the width those characters take.
Not relevant for platforms that don't render HTML on UI element.
public abstract void MeasureString(string str, RFont font, double maxWidth, out int charFit, out double charFitWidth)
Parameters
strstringthe string to measure
fontRFontthe font to measure string with
maxWidthdoublethe max width to calculate fit characters
charFitintthe number of characters that will fit under
restriction charFitWidthdoublethe width that only the characters that fit into max width take
PopClip()
Pop the latest clip push.
public abstract void PopClip()
PushClip(RRect)
Push the clipping region of this Graphics to interception of current clipping rectangle and the given rectangle.
public abstract void PushClip(RRect rect)
Parameters
rectRRectRectangle to clip to.
PushClipExclude(RRect)
Push the clipping region of this Graphics to exclude the given rectangle from the current clipping rectangle.
public abstract void PushClipExclude(RRect rect)
Parameters
rectRRectRectangle to exclude clipping in.
ResumeClipping()
Resumes the suspended clips.
public void ResumeClipping()
ReturnPreviousSmoothingMode(object)
Return to previous smooth mode before anti-alias was set as returned from SetAntiAliasSmoothingMode().
public abstract void ReturnPreviousSmoothingMode(object prevMode)
Parameters
prevModeobjectthe previous mode to set
SetAntiAliasSmoothingMode()
Set the graphics smooth mode to use anti-alias.
Use ReturnPreviousSmoothingMode(object) to return back the mode used.
public abstract object SetAntiAliasSmoothingMode()
Returns
- object
the previous smooth mode before the change
SuspendClipping()
Restore the clipping region to the initial clip.
public void SuspendClipping()