Class Device

Class Device

Namespace: Aspose.Html.Rendering
Assembly: Aspose.HTML.dll (25.2.0)

Represents base class for implementation particular rendering devices.

[ComVisible(true)]
public abstract class Device<tgraphiccontext, trenderingoptions=""> : Device, IDevice, IDisposable where TGraphicContext : GraphicContext, new() where TRenderingOptions : RenderingOptions

Type Parameters

TGraphicContext

Graphic context that holds current graphics control parameters

TRenderingOptions

Rendering options

Inheritance

objectDeviceDevice<tgraphiccontext, trenderingoptions="">

Implements

IDevice, IDisposable

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

Device(TRenderingOptions, ICreateStreamProvider)

Initializes a new instance of the Aspose.Html.Rendering.Device`2 class by rendering options and stream provider.

protected Device(TRenderingOptions options, ICreateStreamProvider streamProvider)

Parameters

options TRenderingOptions

Rendering options.

streamProvider ICreateStreamProvider

Object that implements the Aspose.Html.IO.ICreateStreamProvider interface

Device(TRenderingOptions, string)

Initializes a new instance of the Aspose.Html.Rendering.Device`2 class by rendering options and output file name.

protected Device(TRenderingOptions options, string file)

Parameters

options TRenderingOptions

Rendering options.

file string

The output file name.

Device(TRenderingOptions, Stream)

Initializes a new instance of the Aspose.Html.Rendering.Device`2 class by rendering options and output stream.

protected Device(TRenderingOptions options, Stream stream)

Parameters

options TRenderingOptions

Rendering options.

stream Stream

The output stream.

Properties

Configuration

Gets device configuration.

protected virtual Device<tgraphiccontext, trenderingoptions="">.DeviceConfiguration Configuration { get; }

Property Value

Device<tgraphiccontext, trenderingoptions="">.DeviceConfiguration

GraphicContext

Gets the graphic context

public TGraphicContext GraphicContext { get; }

Property Value

TGraphicContext

Options

Gets rendering options.

public TRenderingOptions Options { get; }

Property Value

TRenderingOptions

OutputStream

Sets and gets the output stream.

protected Stream OutputStream { get; }

Property Value

Stream

PageIndex

Sets or gets the index of the current page

protected int PageIndex { get; set; }

Property Value

int

StreamProvider

Gets the stream provider object.

protected ICreateStreamProvider StreamProvider { get; }

Property Value

ICreateStreamProvider

Methods

AddRect(RectangleF)

Appends a rectangle to the current path as a complete subpath.

public virtual void AddRect(RectangleF rect)

Parameters

rect RectangleF

A rectangle to draw.

BeginDocument(Document)

Begins rendering of the document.

public virtual void BeginDocument(Document document)

Parameters

document Document

The document.

BeginElement(Element, RectangleF)

Begins rendering of the node.

public virtual bool BeginElement(Element element, RectangleF rect)

Parameters

element Element

The Aspose.Html.Dom.Element.

rect RectangleF

Bounding box of the node.

Returns

bool

Returns [true] if element should be processed.

BeginPage(SizeF)

Begins rendering of the new page.

public virtual void BeginPage(SizeF size)

Parameters

size SizeF

Size of the page.

Clip(FillRule)

Modifies the current clipping path by intersecting it with the current path, using the FillRule to determine the region to fill. This method terminates current path.

public virtual void Clip(FillRule rule)

Parameters

rule FillRule

Filling rule specifies how the interior of a closed path is clipped

ClosePath()

Closes the current subpath by appending a straight line segment from the current point to the starting point of the subpath. If the current subpath is already closed, “ClosePath” does nothing. This operator terminates the current subpath. Appending another segment to the current path begins a new subpath, even if the new segment begins at the endpoint reached by the “ClosePath” method.

public virtual void ClosePath()

CubicBezierTo(PointF, PointF, PointF)

Appends a cubic Bézier curve to the current path. The curve extends from the current point to the point pt2, using pt1 and pt2 as the Bézier control points. The new current point is pt3.

public virtual void CubicBezierTo(PointF pt1, PointF pt2, PointF pt3)

Parameters

pt1 PointF

Coordinates of first point

pt2 PointF

Coordinates of second point

pt3 PointF

Coordinates of third point

Dispose()

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

public void Dispose()

Dispose(bool)

Releases unmanaged and - optionally - managed resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

DrawImage(byte[], WebImageFormat, RectangleF)

Draws the specified image.

public virtual void DrawImage(byte[] data, WebImageFormat imageFormat, RectangleF rect)

Parameters

data byte[]

An array of bytes representing the image.

imageFormat WebImageFormat

Image format.

rect RectangleF

A rectangle which determines position and size to draw.

EndDocument()

Ends rendering of the document.

public virtual void EndDocument()

EndElement(Element)

Ends rendering of the node.

public virtual void EndElement(Element element)

Parameters

element Element

The Aspose.Html.Dom.Element.

EndPage()

Ends rendering of the current page.

public virtual void EndPage()

Fill(FillRule)

Fills the entire region enclosed by the current path. If the path consists of several disconnected subpaths, it fills the insides of all subpaths, considered together. This method terminates current path.

public virtual void Fill(FillRule rule)

Parameters

rule FillRule

Filling rule specifies how the interior of a closed path is filled

FillText(string, PointF)

Fills the specified text string at the specified location.

public virtual void FillText(string text, PointF pt)

Parameters

text string

String to fill.

pt PointF

Point that specifies the coordinates of the text.

Flush()

Flushes all data to output stream.

public virtual void Flush()

GetExtension()

Gets extension of the output file.

protected virtual string GetExtension()

Returns

string

The file extension.

Initialize()

Initializes context stack.

protected virtual void Initialize()

LineTo(PointF)

Appends a straight line segment from the current point to the point (pt). The new current point is pt.

public virtual void LineTo(PointF pt)

Parameters

pt PointF

Point of where to create the line to.

MoveTo(PointF)

Begins a new subpath by moving the current point to coordinates of the parameter pt, omitting any connecting line segment. If the previous path construction method in the current path was also “MoveTo”, the new “MoveTo” overrides it; no vestige of the previous “MoveTo” operation remains in the path.

public virtual void MoveTo(PointF pt)

Parameters

pt PointF

Point of where to move the path to.

RestoreGraphicContext()

Restores the entire graphics context to its former value by popping it from the stack.

public virtual void RestoreGraphicContext()

SaveGraphicContext()

Pushes a copy of the entire graphics context onto the stack.

public virtual void SaveGraphicContext()

Stroke()

Strokes a line along the current path. The stroked line follows each straight or curved segment in the path, centered on the segment with sides parallel to it. Each of the path’s subpaths is treated separately. This method terminates current path.

public virtual void Stroke()

StrokeAndFill(FillRule)

Strokes and fill current path. This method terminates current path.

public virtual void StrokeAndFill(FillRule rule)

Parameters

rule FillRule

Filling rule specifies how the interior of a closed path is filled.

StrokeText(string, PointF)

Strokes the specified text string at the specified location.

public virtual void StrokeText(string text, PointF pt)

Parameters

text string

String to stroke.

pt PointF

Point that specifies the coordinates where to start the text. </tgraphiccontext,></tgraphiccontext,></tgraphiccontext,></tgraphiccontext,>