Class Graphics
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
ePaperDisplayIEPaperDisplayThe E-Paper display device to draw to.
Properties
DisplayRotation
Gets or sets the current display orientation.
public Rotation DisplayRotation { get; set; }
Property Value
EPaperDisplay
Gets the E-Paper display being controlled by this Graphics class instance.
public IEPaperDisplay EPaperDisplay { get; }
Property Value
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
bitmapIFrameBufferThe bitmap buffer to draw.
startPointThe start point on the display to start drawing from.
rotatebooltrue 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
centerXintX position of the center point.
centerYintY position of the center point.
radiusintThe circle's radius.
colorColorThe color to use when drawing the circle.
fillboolTrue 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
startXintX position of the start point.
startYintY position of the start point.
endXintX position of the end point.
endYintY position of the end point.
colorColorThe 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
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
startXintTop left point X position.
startYintTop left point Y position.
widthintThe width of the rectangle in pixels.
heightintThe height of the rectangle in pixels.
colorColorThe color to use when drawing the rectangle.
fillboolTrue 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
textstringThe text to write.
fontIFontThe font to use.
xintStarting X point.
yintStarting Y point.
colorColorThe 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
Returns
- Point
The real position on the display.