RAdapter

TheArtOfDev.HtmlRenderer.Adapters

Platform adapter to bridge platform specific objects to HTML Renderer core library. Core uses abstract renderer objects (RAdapter/RControl/REtc...) to access platform specific functionality, the concrete platforms implements those objects to provide concrete platform implementation. Those allowing the core library to be platform agnostic. Platforms: WinForms, WPF, Metro, PDF renders, etc. Objects: UI elements(Controls), Graphics(Render context), Colors, Brushes, Pens, Fonts, Images, Clipboard, etc.

Constructors

RAdapter()

Init.

Properties

DefaultCssData : CssData

Get the default CSS stylesheet data.

Methods

AddFontFamily(RFontFamily)

Adds a font family to be used.

fontFamily
The font family to add.
AddFontFamilyMapping(string, string)

Adds a font mapping from to iff the is not found. When the font is used in rendered html and is not found in existing fonts (installed or added) it will be replaced by .

fromFamily
the font family to replace
toFamily
the font family to replace with
ConvertImage(ImageSource) : RImage

Convert image object returned from HtmlImageLoadEventArgs to RImage.

image
the image returned from load event

Returns: converted image or null

ConvertImageInt(ImageSource) : RImage

Convert image object returned from HtmlImageLoadEventArgs to RImage.

image
the image returned from load event

Returns: converted image or null

CreateContextMenuInt() : RContextMenu

Create a context menu that can be used on the control

Returns: new context menu

CreateFont(string, double, RFontStyle) : RFont

Get font instance by given font family name, size and style.

family
the font family name
size
font size
style
font style

Returns: font instance

CreateFont(RFontFamily, double, RFontStyle) : RFont

Get font instance by given font family instance, size and style. Used to support custom fonts that require explicit font family instance to be created.

family
the font family instance
size
font size
style
font style

Returns: font instance

CreateFontInt(RFontFamily, double, RFontStyle) : RFont

Get font instance by given font family instance, size and style. Used to support custom fonts that require explicit font family instance to be created.

family
the font family instance
size
font size
style
font style

Returns: font instance

CreateFontInt(string, double, RFontStyle) : RFont

Get font instance by given font family name, size and style.

family
the font family name
size
font size
style
font style

Returns: font instance

CreateLinearGradientBrush(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

CreatePen(RColor) : RPen

Get cached pen instance for the given color.

color
the color to get pen for

Returns: pen instance

CreateSolidBrush(RColor) : RBrush

Get cached solid brush instance for the given color.

color
the color to get brush for

Returns: brush instance

GetClipboardDataObject(string, string) : object

Get data object for the given html and plain text data. The data object can be used for clipboard or drag-drop operation. Not relevant for platforms that don't render HTML on UI element.

html
the html data
plainText
the plain text data

Returns: drag-drop data object

GetClipboardDataObjectInt(string, string) : object

Get data object for the given html and plain text data. The data object can be used for clipboard or drag-drop operation.

html
the html data
plainText
the plain text data

Returns: drag-drop data object

GetColor(string) : RColor

Resolve color value from given color name.

colorName
the color name

Returns: color value

GetColorInt(string) : RColor

Resolve color value from given color name.

colorName
the color name

Returns: color value

GetContextMenu() : RContextMenu

Create a context menu that can be used on the control Not relevant for platforms that don't render HTML on UI element.

Returns: new context menu

GetFont(string, double, RFontStyle) : RFont

Get font instance by given font family name, size and style.

family
the font family name
size
font size
style
font style

Returns: font 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

GetLoadingFailedImage() : RImage

Get image to be used if HTML image load failed.

GetLoadingImage() : RImage

Get image to be used while HTML image is loading.

GetPen(RColor) : RPen

Get cached pen instance for the given color.

color
the color to get pen for

Returns: pen instance

GetSolidBrush(RColor) : RBrush

Get cached solid brush instance for the given color.

color
the color to get brush for

Returns: brush instance

ImageFromStream(string, byte[]) : RImage

Creates an RImage object from the given byte array with the specified image extension.

extension
The image file extension indicating the format of the image data.
body
The byte array containing image data to create the image from.

Returns: A new RImage instance.

ImageFromStreamInt(string, byte[]) : RImage

Create an RImage object from the given stream.

extension
The image file extension indicating the format of the image data.
body
The byte array containing image data to create the image from.

Returns: new image instance

IsFontExists(string) : bool

Check if the given font exists in the system by font family name.

font
the font name to check

Returns: true - font exists by given family name, false - otherwise

SaveToFile(RImage, string, string, RControl)

Save the given image to file by showing save dialog to the client. Not relevant for platforms that don't render HTML on UI element.

image
the image to save
name
the name of the image for save dialog
extension
the extension of the image for save dialog
control
optional: the control to show the dialog on
SaveToFileInt(RImage, string, string, RControl)

Save the given image to file by showing save dialog to the client.

image
the image to save
name
the name of the image for save dialog
extension
the extension of the image for save dialog
control
optional: the control to show the dialog on
SetToClipboard(string, string)

Set the given html and plain text data to clipboard. Not relevant for platforms that don't render HTML on UI element.

html
the html data
plainText
the plain text data
SetToClipboard(string)

Set the given text to the clipboard Not relevant for platforms that don't render HTML on UI element.

text
the text to set
SetToClipboard(RImage)

Set the given image to clipboard. Not relevant for platforms that don't render HTML on UI element.

image
the image object to set to clipboard
SetToClipboardInt(string)

Set the given text to the clipboard

text
the text to set
SetToClipboardInt(string, string)

Set the given html and plain text data to clipboard.

html
the html data
plainText
the plain text data
SetToClipboardInt(RImage)

Set the given image to clipboard.

image

Fields

_brushesCache : Dictionary<RColor, RBrush>

cache of brush color to brush instance

_defaultCssData : CssData

default CSS parsed data singleton

_errorImage : RImage

image used to draw error image icon

_fontsHandler : FontsHandler

cache of all the font used not to create same font again and again

_loadImage : RImage

image used to draw loading image icon

_penCache : Dictionary<RColor, RPen>

cache of pen color to pen instance