Table of Contents

Class Graphics

Namespace
Iot.Device.EPaper
Assembly
Iot.Device.ePaper.dll

A graphics class for ePaper displays with basic graphic APIs support.

public sealed class Graphics
Inheritance
Graphics

Constructors

Graphics(IEPaperDisplay)

Initializes a new instance of the Graphics class.

public Graphics(IEPaperDisplay ePaperDisplay)

Parameters

ePaperDisplay IEPaperDisplay

The E-Paper display device to draw to.

Properties

DisplayRotation

Gets or sets the current display orientation.

public Rotation DisplayRotation { get; set; }

Property Value

Rotation

EPaperDisplay

Gets the E-Paper display being controlled by this Graphics class instance.

public IEPaperDisplay EPaperDisplay { get; }

Property Value

IEPaperDisplay

Methods

Dispose()

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

public void Dispose()

DrawBitmap(IFrameBuffer, Point, bool)

Draws the specified bitmap buffer to the display using the specified starting point.

public void DrawBitmap(IFrameBuffer bitmap, Point start, bool rotate = false)

Parameters

bitmap IFrameBuffer

The bitmap buffer to draw.

start Point

The start point on the display to start drawing from.

rotate bool

true to rotate the bitmap with the current Rotation specified. It might be slow.

DrawCircle(int, int, int, Color, bool)

Draws a circle defined by the specified center point and radius.

public void DrawCircle(int centerX, int centerY, int radius, Color color, bool fill)

Parameters

centerX int

X position of the center point.

centerY int

Y position of the center point.

radius int

The circle's radius.

color Color

The color to use when drawing the circle.

fill bool

True to fill the circle, otherwise; draws only the outline.

DrawLine(int, int, int, int, Color)

Draws a line from the a starting point to an end point.

public void DrawLine(int startX, int startY, int endX, int endY, Color color)

Parameters

startX int

X position of the start point.

startY int

Y position of the start point.

endX int

X position of the end point.

endY int

Y position of the end point.

color Color

The color of the line.

DrawPixel(int, int, Color)

Draws a pixel on the display with respect to the current DisplayRotation.

public void DrawPixel(int x, int y, Color color)

Parameters

x int

The X position.

y int

The Y position.

color Color

The color to use when drawing the pixel.

DrawRectangle(int, int, int, int, Color, bool)

Draws a rectangle defined by a starting point, width, and height.

public void DrawRectangle(int startX, int startY, int width, int height, Color color, bool fill)

Parameters

startX int

Top left point X position.

startY int

Top left point Y position.

width int

The width of the rectangle in pixels.

height int

The height of the rectangle in pixels.

color Color

The color to use when drawing the rectangle.

fill bool

True to fill the rectangle, otherwise; draws only the outline.

DrawText(string, IFont, int, int, Color)

Writes text to the display.

public void DrawText(string text, IFont font, int x, int y, Color color)

Parameters

text string

The text to write.

font IFont

The font to use.

x int

Starting X point.

y int

Starting Y point.

color Color

The font color.

GetRealPosition(int, int)

Gets the real Position of a given point after considering the current Rotation of the display.

public Point GetRealPosition(int x, int y)

Parameters

x int

The X Position in the current rotation.

y int

The Y Position in the current rotation.

Returns

Point

The real position on the display.