RGraphics

TheArtOfDev.HtmlRenderer.Adapters

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.

Implements: IDisposable

Constructors

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

DrawImage(RImage, RRect, RRect)

Draws the specified portion of the specified RImage at the specified location and with the specified size.

image
Image to draw.
destRect
Rectangle structure that specifies the location and size of the drawn image. The image is scaled to fit the rectangle.
srcRect
Rectangle structure that specifies the portion of the object to draw.
DrawImage(RImage, RRect)

Draws the specified Image at the specified location and with the specified size.

image
Image to draw.
destRect
Rectangle structure that specifies the location and size of the drawn image.
DrawLine(RPen, double, double, double, double)

Draws a line connecting the two points specified by the coordinate pairs.

pen
Pen that determines the color, width, and style of the line.
x1
The x-coordinate of the first point.
y1
The y-coordinate of the first point.
x2
The x-coordinate of the second point.
y2
The y-coordinate of the second point.
DrawPath(RBrush, RGraphicsPath)

Fills the interior of a GraphicsPath.

brush
Brush that determines the characteristics of the fill.
path
GraphicsPath that represents the path to fill.
DrawPath(RPen, RGraphicsPath)

Draws a GraphicsPath.

pen
Pen that determines the color, width, and style of the path.
path
GraphicsPath to draw.
DrawPolygon(RBrush, RPoint[])

Fills the interior of a polygon defined by an array of points specified by Point structures.

brush
Brush that determines the characteristics of the fill.
points
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.

brush
Brush that determines the characteristics of the fill.
x
The x-coordinate of the upper-left corner of the rectangle to fill.
y
The y-coordinate of the upper-left corner of the rectangle to fill.
width
Width of the rectangle to fill.
height
Height of the rectangle to fill.
DrawRectangle(RPen, double, double, double, double)

Draws a rectangle specified by a coordinate pair, a width, and a height.

pen
A Pen that determines the color, width, and style of the rectangle.
x
The x-coordinate of the upper-left corner of the rectangle to draw.
y
The y-coordinate of the upper-left corner of the rectangle to draw.
width
The width of the rectangle to draw.
height
The 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.

str
the string to draw
font
the font to use to draw the string
color
the text color to set
point
the location to start string draw (top-left)
size
used to know the size of the rendered text for transparent text support
rtl
is to render the string right-to-left (true - RTL, false - LTR)
GetClip() : RRect

Gets a Rectangle structure that bounds the clipping region of this Graphics.

Returns: A rectangle structure that represents a bounding rectangle for the clipping region of this Graphics.

GetGraphicsPath() : RGraphicsPath

Get GraphicsPath object.

Returns: graphics path instance

GetLinearGradientBrush(RRect, RColor, RColor, double) : RBrush

Get linear gradient color brush from to .

rect
the rectangle to get the brush for
color1
the start color of the gradient
color2
the end color of the gradient
angle
the angle to move the gradient from start color to end color in the rectangle

Returns: linear gradient color brush instance

GetPen(RColor) : RPen

Get color pen.

color
the color to get the pen for

Returns: pen instance

GetSolidBrush(RColor) : RBrush

Get solid color brush.

color
the color to get the brush for

Returns: solid color brush instance

GetTextureBrush(RImage, RRect, RPoint) : RBrush

Get TextureBrush object that uses the specified image and bounding rectangle.

image
The Image object with which this TextureBrush object fills interiors.
dstRect
A Rectangle structure that represents the bounding rectangle for this TextureBrush object.
translateTransformLocation
The dimension by which to translate the transformation
MeasureString(string, RFont) : RSize

Measure the width and height of string when drawn on device context HDC using the given font .

str
the string to measure
font
the font to measure string with

Returns: the size of the string

MeasureString(string, RFont, double, int, 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.

str
the string to measure
font
the font to measure string with
maxWidth
the max width to calculate fit characters
charFit
the number of characters that will fit under restriction
charFitWidth
the width that only the characters that fit into max width take
PopClip()

Pop the latest clip push.

PushClip(RRect)

Push the clipping region of this Graphics to interception of current clipping rectangle and the given rectangle.

rect
Rectangle to clip to.
PushClipExclude(RRect)

Push the clipping region of this Graphics to exclude the given rectangle from the current clipping rectangle.

rect
Rectangle to exclude clipping in.
ResumeClipping()

Resumes the suspended clips.

ReturnPreviousSmoothingMode(object)

Return to previous smooth mode before anti-alias was set as returned from SetAntiAliasSmoothingMode.

prevMode
the previous mode to set
SetAntiAliasSmoothingMode() : object

Set the graphics smooth mode to use anti-alias. Use Object) to return back the mode used.

Returns: the previous smooth mode before the change

SuspendClipping()

Restore the clipping region to the initial clip.

Fields

Adapter : RAdapter

the global adapter

ClipStack : Stack<RRect>

The clipping bound stack as clips are pushed/poped to/from the graphics

_suspendedClips : Stack<RRect>

The suspended clips