Skip to main content

Class MicroGraphics

Provide high level graphics functions

Assembly: MicroGraphics.dll​
View Source​
Declaration
public class MicroGraphics : ITextDisplay, IDisplay

Implements:
Meadow.Peripherals.Displays.ITextDisplay, Meadow.Peripherals.Displays.IDisplay

Properties​

PixelBuffer​

PixelBuffer draw target

View Source​
Declaration
protected IPixelBuffer PixelBuffer { get; }

EnabledColor​

The color used when a pixel is enabled (on)

View Source​
Declaration
public Color EnabledColor { get; }

DisabledColor​

The color used when a pixel is not enabled (off)

View Source​
Declaration
public Color DisabledColor { get; }

CurrentFont​

Font used for drawing text to the display

View Source​
Declaration
public IFont CurrentFont { get; set; }

ColorMode​

Current color mode

View Source​
Declaration
public ColorMode ColorMode { get; }

Rotation​

Current rotation used for drawing pixels to the display

View Source​
Declaration
public RotationType Rotation { get; set; }

Stroke​

Stroke / line thickness when drawing lines or shape outlines

View Source​
Declaration
public int Stroke { get; set; }

PenColor​

Current pen color

View Source​
Declaration
public Color PenColor { get; set; }

Height​

Return the height of the display after accounting for the rotation

View Source​
Declaration
public int Height { get; }

Width​

Return the width of the display after accounting for the rotation

View Source​
Declaration
public int Width { get; }

DisplayConfig​

Text display configuration for use with text display menu

View Source​
Declaration
public TextDisplayConfig DisplayConfig { get; }

DelayBetweenFrames​

Optional enforced delay between updates when calling ShowBuffered

View Source​
Declaration
public TimeSpan DelayBetweenFrames { get; set; }

CursorColumn​

The current cursor column relative to text/font

View Source​
Declaration
public byte CursorColumn { get; }

CursorLine​

The current cursor line relative to the text

View Source​
Declaration
public byte CursorLine { get; }

Fields​

canvasState​

The current canvas state

View Source​
Declaration
protected MicroGraphics.CanvasState? canvasState

display​

Display object responsible for managing the buffer and rendering

View Source​
Declaration
protected readonly IPixelDisplay? display

IgnoreOutOfBoundsPixels​

ignore pixels that are outside of the pixel buffer coordinate space

View Source​
Declaration
public bool IgnoreOutOfBoundsPixels

Methods​

DrawLineAntialiased(float, float, float, float, Color)​

Draws an anti-aliased line between two points using the Xiaolin Wu algorithm

View Source​
Declaration
public void DrawLineAntialiased(float x0, float y0, float x1, float y1, Color color)
Parameters​
TypeNameDescription
System.Singlex0The x-coordinate of the starting point of the line
System.Singley0The y-coordinate of the starting point of the line
System.Singlex1The x-coordinate of the ending point of the line
System.Singley1The y-coordinate of the ending point of the line
Meadow.ColorcolorThe color of the line

DrawTriangleAntialiased(int, int, int, int, int, int, Color, bool)​

Draw an anti-aliased triangle

View Source​
Declaration
public void DrawTriangleAntialiased(int x0, int y0, int x1, int y1, int x2, int y2, Color color, bool filled = false)
Parameters​
TypeNameDescription
System.Int32x0Vertex #0 x coordinate
System.Int32y0Vertex #0 y coordinate
System.Int32x1Vertex #1 x coordinate
System.Int32y1Vertex #1 y coordinate
System.Int32x2Vertex #2 x coordinate
System.Int32y2Vertex #2 y coordinate
Meadow.ColorcolorThe color of the triangle
System.BooleanfilledDraw a filled triangle?

SaveState()​

Save any state variables Includes: CurrentFont, Stroke, and Rotation

View Source​
Declaration
public void SaveState()

RestoreState()​

Restore saved state variables and apply them to the MicroGraphics instance Includes: CurrentFont, Stroke, and Rotation

View Source​
Declaration
public void RestoreState()

DrawPixel(int, int, Color)​

Draw a single pixel using the pen color

View Source​
Declaration
public virtual void DrawPixel(int x, int y, Color color)
Parameters​
TypeNameDescription
System.Int32xx location
System.Int32yy location
Meadow.ColorcolorColor of pixel

DrawPixel(int, int, bool)​

Draw a single pixel

View Source​
Declaration
public void DrawPixel(int x, int y, bool enabled)
Parameters​
TypeNameDescription
System.Int32xx location
System.Int32yy location
System.BooleanenabledTurn the pixel on (true) or off (false)

DrawPixel(int, int)​

Draw a single pixel

View Source​
Declaration
public virtual void DrawPixel(int x, int y)
Parameters​
TypeNameDescription
System.Int32xx location
System.Int32yy location

DrawPixel(int)​

Draw a single pixel using the pen color

View Source​
Declaration
public virtual void DrawPixel(int index)
Parameters​
TypeNameDescription
System.Int32indexpixel location in buffer

InvertPixel(int, int)​

Invert the color of the pixel at the given location

View Source​
Declaration
public void InvertPixel(int x, int y)
Parameters​
TypeNameDescription
System.Int32xx location
System.Int32yy location

InvertRectangle(int, int, int, int)​

Invert all pixels within a rectangle

View Source​
Declaration
public virtual void InvertRectangle(int x, int y, int width, int height)
Parameters​
TypeNameDescription
System.Int32xx start
System.Int32yy start
System.Int32widthwidth of area to invert
System.Int32heightheight of area to invert

DrawLine(int, int, int, int, bool)​

Draw a line using Bresenhams line drawing algorithm

View Source​
Declaration
public void DrawLine(int x0, int y0, int x1, int y1, bool enabled)
Parameters​
TypeNameDescription
System.Int32x0Abscissa of the starting point of the line
System.Int32y0Ordinate of the starting point of the line
System.Int32x1Abscissa of the end point of the line
System.Int32y1Ordinate of the end point of the line
System.BooleanenabledTurn the pixel on (true) or off (false)

DrawLine(int, int, int, float, bool)​

Draw a line using polar coordinates

View Source​
Declaration
public void DrawLine(int x, int y, int length, float angle, bool enabled)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the starting point of the line
System.Int32yOrdinate of the starting point of the line
System.Int32lengthLength of line
System.SingleangleAngle in radians
System.BooleanenabledTurn the pixel on (true) or off (false)

DrawLine(int, int, int, int)​

Draw a line using Bresenhams line drawing algorithm

View Source​
Declaration
public void DrawLine(int x0, int y0, int x1, int y1)
Parameters​
TypeNameDescription
System.Int32x0Abscissa of the starting point of the line
System.Int32y0Ordinate of the starting point of the line
System.Int32x1Abscissa of the end point of the line
System.Int32y1Ordinate of the end point of the line

DrawLine(int, int, int, float, Color)​

Draw a line from a point to a position defined by a radius and an angle

View Source​
Declaration
public void DrawLine(int x, int y, int length, float angle, Color color)
Parameters​
TypeNameDescription
System.Int32x
System.Int32yOrdinate of the starting point of the line
System.Int32lengthlength of line
System.Singleangleangle to draw line in radians
Meadow.ColorcolorThe color of the line

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

Draw a line using Bresenhams line drawing algorithm

View Source​
Declaration
public void DrawLine(int x0, int y0, int x1, int y1, Color color)
Parameters​
TypeNameDescription
System.Int32x0Abscissa of the starting point of the line
System.Int32y0Ordinate of the starting point of the line
System.Int32x1Abscissa of the end point of the line
System.Int32y1Ordinate of the end point of the line
Meadow.ColorcolorColor of the line to be drawn

DrawHorizontalLine(int, int, int, bool)​

Draw a horizontal line.

View Source​
Declaration
public void DrawHorizontalLine(int x, int y, int length, bool enabled)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the starting point of the line
System.Int32yOrdinate of the starting point of the line
System.Int32lengthLength of the line to draw
System.BooleanenabledTurn the pixel on (true) or off (false)

DrawHorizontalLine(int, int, int)​

Draw a horizontal line

View Source​
Declaration
public void DrawHorizontalLine(int x, int y, int length)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the starting point of the line
System.Int32yOrdinate of the starting point of the line
System.Int32lengthLength of the line to draw

DrawHorizontalLine(int, int, int, Color)​

Draw a horizontal line

View Source​
Declaration
public void DrawHorizontalLine(int x, int y, int length, Color color)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the starting point of the line
System.Int32yOrdinate of the starting point of the line
System.Int32lengthLength of the line to draw
Meadow.ColorcolorThe color of the line

DrawVerticalLine(int, int, int, bool)​

Draw a vertical line.

View Source​
Declaration
public void DrawVerticalLine(int x, int y, int length, bool enabled)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the starting point of the line
System.Int32yOrdinate of the starting point of the line
System.Int32lengthLength of the line to draw
System.BooleanenabledShow the line when (true) or off (false)

DrawVerticalLine(int, int, int)​

Draw a vertical line

View Source​
Declaration
public void DrawVerticalLine(int x, int y, int length)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the starting point of the line
System.Int32yOrdinate of the starting point of the line
System.Int32lengthLength of the line to draw

DrawVerticalLine(int, int, int, Color)​

Draw a vertical line

View Source​
Declaration
public void DrawVerticalLine(int x, int y, int length, Color color)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the starting point of the line
System.Int32yOrdinate of the starting point of the line
System.Int32lengthLength of the line to draw
Meadow.ColorcolorThe color of the line

DrawArc(int, int, int, Angle, Angle, Color, bool)​

Draw a circular arc between two angles

View Source​
Declaration
public void DrawArc(int centerX, int centerY, int radius, Angle startAngle, Angle endAngle, Color color, bool centerBetweenPixels = true)
Parameters​
TypeNameDescription
System.Int32centerXAbscissa of the center point of the circle
System.Int32centerYOrdinate of the center point of the circle
System.Int32radiusRadius of the circle
Meadow.Units.AnglestartAngleThe arc starting angle
Meadow.Units.AngleendAngleThe arc ending angle
Meadow.ColorcolorThe color of the circle
System.BooleancenterBetweenPixelsIf true, the center of the arc is between the assigned pixel and the next pixel, false it's directly on the center pixel

DrawArc(int, int, int, Angle, Angle, bool, bool)​

Draw a circular arc between two angles

View Source​
Declaration
public void DrawArc(int centerX, int centerY, int radius, Angle startAngle, Angle endAngle, bool enabled = true, bool centerBetweenPixels = true)
Parameters​
TypeNameDescription
System.Int32centerXAbscissa of the center point of the circle
System.Int32centerYOrdinate of the center point of the circle
System.Int32radiusRadius of the circle
Meadow.Units.AnglestartAngleThe arc starting angle
Meadow.Units.AngleendAngleThe arc ending angle
System.BooleanenabledShould draw the arc (true) or remove (false)
System.BooleancenterBetweenPixelsIf true, the center of the arc is between the assigned pixel and the next pixel, false it's directly on the center pixel

DrawArc(int, int, int, Angle, Angle, bool)​

Draw a circular arc between two angles using PenColor

View Source​
Declaration
public void DrawArc(int centerX, int centerY, int radius, Angle startAngle, Angle endAngle, bool centerBetweenPixels = true)
Parameters​
TypeNameDescription
System.Int32centerXAbscissa of the center point of the circle
System.Int32centerYOrdinate of the center point of the circle
System.Int32radiusRadius of the circle
Meadow.Units.AnglestartAngleThe arc starting angle
Meadow.Units.AngleendAngleThe arc ending angle
System.BooleancenterBetweenPixelsIf true, the center of the arc is between the assigned pixel and the next pixel, false it's directly on the center pixel

DrawTriangle(int, int, int, int, int, int, Color, bool)​

Draw a triangle

View Source​
Declaration
public void DrawTriangle(int x0, int y0, int x1, int y1, int x2, int y2, Color color, bool filled = false)
Parameters​
TypeNameDescription
System.Int32x0Vertex #0 x coordinate
System.Int32y0Vertex #0 y coordinate
System.Int32x1Vertex #1 x coordinate
System.Int32y1Vertex #1 y coordinate
System.Int32x2Vertex #2 x coordinate
System.Int32y2Vertex #2 y coordinate
Meadow.ColorcolorColor of triangle
System.BooleanfilledDraw a filled triangle?

DrawTriangle(int, int, int, int, int, int, bool, bool)​

Draw a triangle

View Source​
Declaration
public void DrawTriangle(int x0, int y0, int x1, int y1, int x2, int y2, bool enabled = true, bool filled = false)
Parameters​
TypeNameDescription
System.Int32x0Vertex #0 x coordinate
System.Int32y0Vertex #0 y coordinate
System.Int32x1Vertex #1 x coordinate
System.Int32y1Vertex #1 y coordinate
System.Int32x2Vertex #2 x coordinate
System.Int32y2Vertex #2 y coordinate
System.BooleanenabledShould the triangle add (true) or remove (false)
System.BooleanfilledDraw a filled triangle?

DrawTriangle(int, int, int, int, int, int, bool)​

Draw a triangle

View Source​
Declaration
public void DrawTriangle(int x0, int y0, int x1, int y1, int x2, int y2, bool filled = false)
Parameters​
TypeNameDescription
System.Int32x0Vertex #0 x coordinate
System.Int32y0Vertex #0 y coordinate
System.Int32x1Vertex #1 x coordinate
System.Int32y1Vertex #1 y coordinate
System.Int32x2Vertex #2 x coordinate
System.Int32y2Vertex #2 y coordinate
System.BooleanfilledDraw a filled triangle?

DrawCircle(int, int, int, bool, bool, bool)​

Draw a circle

View Source​
Declaration
public void DrawCircle(int centerX, int centerY, int radius, bool enabled, bool filled = false, bool centerBetweenPixels = false)
Parameters​
TypeNameDescription
System.Int32centerXAbscissa of the center point of the circle
System.Int32centerYOrdinate of the center point of the circle
System.Int32radiusRadius of the circle
System.BooleanenabledShow the circle when true
System.BooleanfilledDraw a filled circle?
System.BooleancenterBetweenPixelsSet center between pixels

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

Draw a circle

View Source​
Declaration
public void DrawCircle(int centerX, int centerY, int radius, Color color, bool filled = false, bool centerBetweenPixels = false)
Parameters​
TypeNameDescription
System.Int32centerXAbscissa of the center point of the circle
System.Int32centerYOrdinate of the center point of the circle
System.Int32radiusRadius of the circle
Meadow.ColorcolorThe color of the circle
System.BooleanfilledDraw a filled circle
System.BooleancenterBetweenPixelsIf true, the center of the circle is between the assigned pixel and the next pixel, false it's directly on the center pixel

DrawCircle(int, int, int, bool, bool)​

Draw a circle

View Source​
Declaration
public void DrawCircle(int centerX, int centerY, int radius, bool filled = false, bool centerBetweenPixels = false)
Parameters​
TypeNameDescription
System.Int32centerXAbscissa of the center point of the circle
System.Int32centerYOrdinate of the center point of the circle
System.Int32radiusRadius of the circle
System.BooleanfilledDraw a filled circle?
System.BooleancenterBetweenPixelsIf true, the center of the circle is between the assigned pixel and the next pixel, false it's directly on the center pixel

DrawCircleQuadrant(int, int, int, int, bool, bool, bool)​

Draws a circle quadrant (quarter circle)

View Source​
Declaration
public void DrawCircleQuadrant(int centerX, int centerY, int radius, int quadrant, bool enabled = true, bool filled = false, bool centerBetweenPixels = false)
Parameters​
TypeName
System.Int32centerX
System.Int32centerY
System.Int32radius
System.Int32quadrant
System.Booleanenabled
System.Booleanfilled
System.BooleancenterBetweenPixels

DrawCircleQuadrant(int, int, int, int, bool, bool)​

Draws a circle quadrant (quarter circle)

View Source​
Declaration
public void DrawCircleQuadrant(int centerX, int centerY, int radius, int quadrant, bool filled = false, bool centerBetweenPixels = false)
Parameters​
TypeName
System.Int32centerX
System.Int32centerY
System.Int32radius
System.Int32quadrant
System.Booleanfilled
System.BooleancenterBetweenPixels

DrawCircleQuadrant(int, int, int, int, Color, bool, bool)​

Draws a circle quadrant (quarter circle)

View Source​
Declaration
public void DrawCircleQuadrant(int centerX, int centerY, int radius, int quadrant, Color color, bool filled = false, bool centerBetweenPixels = false)
Parameters​
TypeName
System.Int32centerX
System.Int32centerY
System.Int32radius
System.Int32quadrant
Meadow.Colorcolor
System.Booleanfilled
System.BooleancenterBetweenPixels

DrawRectangle(int, int, int, int, bool, bool)​

Draw a rectangle

View Source​
Declaration
public void DrawRectangle(int x, int y, int width, int height, bool enabled, bool filled = false)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the top left corner
System.Int32yOrdinate of the top left corner
System.Int32widthWidth of the rectangle
System.Int32heightHeight of the rectangle
System.BooleanenabledTurn pixels on (true) or turn pixels off (false)
System.BooleanfilledFill the rectangle (true) or draw the outline (false, default)

DrawRectangle(int, int, int, int, bool)​

Draw a rectangle

View Source​
Declaration
public void DrawRectangle(int x, int y, int width, int height, bool filled = false)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the top left corner
System.Int32yOrdinate of the top left corner
System.Int32widthWidth of the rectangle
System.Int32heightHeight of the rectangle
System.BooleanfilledFill the rectangle (true) or draw the outline (false, default)

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

Draw a rectangle

View Source​
Declaration
public void DrawRectangle(int x, int y, int width, int height, Color color, bool filled = false)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the top left corner
System.Int32yOrdinate of the top left corner
System.Int32widthWidth of the rectangle
System.Int32heightHeight of the rectangle
Meadow.ColorcolorThe color of the rectangle
System.BooleanfilledFill the rectangle (true) or draw the outline (false, default)

DrawHorizontalGradient(int, int, int, int, Color, Color)​

Draw a horizontal gradient filled rectangle

View Source​
Declaration
public void DrawHorizontalGradient(int x, int y, int width, int height, Color colorLeft, Color colorRight)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the top left corner
System.Int32yOrdinate of the top left corner
System.Int32widthWidth of the rectangle
System.Int32heightHeight of the rectangle
Meadow.ColorcolorLeftThe start (left) color of the gradient
Meadow.ColorcolorRightThe end (right) color of the gradient

DrawVerticalGradient(int, int, int, int, Color, Color)​

Draw a vertical gradient filled rectangle

View Source​
Declaration
public void DrawVerticalGradient(int x, int y, int width, int height, Color colorTop, Color colorBottom)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the top left corner
System.Int32yOrdinate of the top left corner
System.Int32widthWidth of the rectangle
System.Int32heightHeight of the rectangle
Meadow.ColorcolorTopThe start (top) color of the gradient
Meadow.ColorcolorBottomThe end (bottom) color of the gradient

DrawRoundedRectangle(int, int, int, int, int, bool, bool)​

Draw a rounded rectangle

View Source​
Declaration
public void DrawRoundedRectangle(int x, int y, int width, int height, int cornerRadius, bool enabled, bool filled = false)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the top left corner
System.Int32yOrdinate of the top left corner
System.Int32widthWidth of the rectangle
System.Int32heightHeight of the rectangle
System.Int32cornerRadiusRadius of the corners of the rectangle
System.BooleanenabledTurn pixels on (true) or turn pixels off (false)
System.BooleanfilledFill the rectangle (true) or draw the outline (false, default)

DrawRoundedRectangle(int, int, int, int, int, bool)​

Draw a rounded rectangle

View Source​
Declaration
public void DrawRoundedRectangle(int x, int y, int width, int height, int cornerRadius, bool filled = false)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the top left corner
System.Int32yOrdinate of the top left corner
System.Int32widthWidth of the rectangle
System.Int32heightHeight of the rectangle
System.Int32cornerRadiusRadius of the corners of the rectangle
System.BooleanfilledFill the rectangle (true) or draw the outline (false, default)

DrawRoundedRectangle(int, int, int, int, int, Color, bool)​

Draw a rounded rectangle

View Source​
Declaration
public void DrawRoundedRectangle(int x, int y, int width, int height, int cornerRadius, Color color, bool filled = false)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the top left corner
System.Int32yOrdinate of the top left corner
System.Int32widthWidth of the rectangle
System.Int32heightHeight of the rectangle
System.Int32cornerRadiusRadius of the corners of the rectangle
Meadow.ColorcolorThe color of the rectangle
System.BooleanfilledFill the rectangle (true) or draw the outline (false, default)

MeasureText(string, ScaleFactor)​

Get the size in pixels of a string using the current font

View Source​
Declaration
public Size MeasureText(string text, ScaleFactor scaleFactor = ScaleFactor.X1)
Returns​

Meadow.Foundation.Graphics.Size

Parameters​
TypeNameDescription
System.StringtextThe string to measure
Meadow.Foundation.Graphics.ScaleFactorscaleFactorScale factor used to calculate the size

MeasureText(string, IFont, ScaleFactor)​

Get the size in pixels of a string for a given font and scale factor

View Source​
Declaration
public Size MeasureText(string text, IFont font, ScaleFactor scaleFactor = ScaleFactor.X1)
Returns​

Meadow.Foundation.Graphics.Size

Parameters​
TypeNameDescription
System.StringtextThe string to measure
Meadow.Foundation.Graphics.IFontfontThe font used to calculate the text size
Meadow.Foundation.Graphics.ScaleFactorscaleFactorScale factor used to calculate the size

DrawText(int, int, string, Color, ScaleFactor, HorizontalAlignment, VerticalAlignment, IFont?)​

Draw a text message on the display using the current font.

View Source​
Declaration
public void DrawText(int x, int y, string text, Color color, ScaleFactor scaleFactor = ScaleFactor.X1, HorizontalAlignment alignmentH = HorizontalAlignment.Left, VerticalAlignment alignmentV = VerticalAlignment.Top, IFont? font = null)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the location of the text
System.Int32yOrdinate of the location of the text
System.StringtextText to display
Meadow.ColorcolorColor of the text
Meadow.Foundation.Graphics.ScaleFactorscaleFactorScale factor used to calculate the size
Meadow.Foundation.Graphics.HorizontalAlignmentalignmentHHorizontal alignment: Left, Center or right aligned text
Meadow.Foundation.Graphics.VerticalAlignmentalignmentVVertical alignment: Top, Center or bottom aligned text
Meadow.Foundation.Graphics.IFontfontOptional font used to draw the text

DrawBuffer(int, int, IPixelBuffer, HorizontalAlignment, VerticalAlignment)​

Draw a buffer onto the display buffer at the given location For best performance, source buffer should be the same color depth as the target display

View Source​
Declaration
public void DrawBuffer(int x, int y, IPixelBuffer buffer, HorizontalAlignment alignmentH = HorizontalAlignment.Left, VerticalAlignment alignmentV = VerticalAlignment.Top)
Parameters​
TypeNameDescription
System.Int32xx location of target to draw buffer
System.Int32yy location of target to draw buffer
Meadow.Peripherals.Displays.IPixelBufferbufferthe source buffer to write to the display buffer
Meadow.Foundation.Graphics.HorizontalAlignmentalignmentHHorizontal alignment: Left, Center or right align the buffer to the x location
Meadow.Foundation.Graphics.VerticalAlignmentalignmentVVertical alignment: Top, Center or bottom align the buffer to the y location

DrawBuffer(int, int, IPixelBuffer)​

Draw a buffer onto the display buffer at the given location For best performance, source buffer should be the same color depth as the target display

View Source​
Declaration
public void DrawBuffer(int x, int y, IPixelBuffer buffer)
Parameters​
TypeNameDescription
System.Int32xx location of target to draw buffer
System.Int32yy location of target to draw buffer
Meadow.Peripherals.Displays.IPixelBufferbufferthe source buffer to write to the display buffer

DrawBufferWithTransparencyColor(int, int, IPixelBuffer, Color)​

Draw a buffer onto the display buffer at the given location with a transparency color that will not be drawn

View Source​
Declaration
public void DrawBufferWithTransparencyColor(int x, int y, IPixelBuffer buffer, Color transparencyColor)
Parameters​
TypeNameDescription
System.Int32xx location of target to draw buffer
System.Int32yy location of target to draw buffer
Meadow.Peripherals.Displays.IPixelBufferbufferthe source buffer to write to the display buffer
Meadow.ColortransparencyColorthe color to ignore when drawing the buffer

GetPixel(int, int)​

Get the color for a pixel at a given location

View Source​
Declaration
public virtual Color GetPixel(int x, int y)
Returns​

Meadow.Color

Parameters​
TypeNameDescription
System.Int32xx location
System.Int32yy location

DrawPixelWithAlpha(float, float, Color)​

Draws a pixel with alpha blending at the specified coordinates using the given color and it's alpha value

View Source​
Declaration
public void DrawPixelWithAlpha(float x, float y, Color color)
Parameters​
TypeNameDescription
System.SinglexThe x-coordinate of the pixel
System.SingleyThe y-coordinate of the pixel
Meadow.ColorcolorThe color to draw

DrawPixelWithAlpha(float, float, Color, float)​

Draws a pixel with alpha blending at the specified coordinates using the given color an external alpha value

View Source​
Declaration
public void DrawPixelWithAlpha(float x, float y, Color color, float alpha)
Parameters​
TypeNameDescription
System.SinglexThe x-coordinate of the pixel
System.SingleyThe y-coordinate of the pixel
Meadow.ColorcolorThe color to draw
System.SinglealphaThe alpha value

DrawImage(int, int, Image, HorizontalAlignment, VerticalAlignment)​

Draw an Image onto the display buffer at the specified location

View Source​
Declaration
public void DrawImage(int x, int y, Image image, HorizontalAlignment alignmentH = HorizontalAlignment.Left, VerticalAlignment alignmentV = VerticalAlignment.Top)
Parameters​
TypeNameDescription
System.Int32xx location of target to draw buffer
System.Int32yx location of target to draw buffer
Meadow.Foundation.Graphics.Imageimagethe source image to write to the display buffer
Meadow.Foundation.Graphics.HorizontalAlignmentalignmentHHorizontal alignment: Left, Center or right align the image to the x location
Meadow.Foundation.Graphics.VerticalAlignmentalignmentVVertical alignment: Top, Center or bottom align the image to the y location

DrawImage(int, int, Image)​

Draw an Image onto the display buffer at the specified location

View Source​
Declaration
public void DrawImage(int x, int y, Image image)
Parameters​
TypeNameDescription
System.Int32xx location of target to draw buffer
System.Int32yx location of target to draw buffer
Meadow.Foundation.Graphics.Imageimagethe source image to write to the display buffer

DrawImage(Image)​

Draw an Image onto the display buffer at (0, 0)

View Source​
Declaration
public void DrawImage(Image image)
Parameters​
TypeNameDescription
Meadow.Foundation.Graphics.Imageimagethe source image to write to the display buffer

DrawText(int, int, string, ScaleFactor, HorizontalAlignment, VerticalAlignment)​

Draw a text message on the display using the current font

View Source​
Declaration
public void DrawText(int x, int y, string text, ScaleFactor scaleFactor = ScaleFactor.X1, HorizontalAlignment alignmentH = HorizontalAlignment.Left, VerticalAlignment alignmentV = VerticalAlignment.Top)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the location of the text
System.Int32yOrdinate of the location of the text
System.StringtextText to display
Meadow.Foundation.Graphics.ScaleFactorscaleFactorScale factor used to calculate the size
Meadow.Foundation.Graphics.HorizontalAlignmentalignmentHHorizontal alignment: Left, Center or right aligned text
Meadow.Foundation.Graphics.VerticalAlignmentalignmentVVertical alignment: Top, Center or bottom aligned text

Show()​

Update the display target from the buffer (thread safe)

View Source​
Declaration
public virtual void Show()

ShowBuffered()​

Update the display target from the buffer (thread safe) while respecting MinimumTimeBetweenUpdates

View Source​
Declaration
public virtual Task ShowBuffered()
Returns​

System.Threading.Tasks.Task

ShowUnsafe()​

Update the display target from the buffer (not thread safe)

View Source​
Declaration
public virtual void ShowUnsafe()

ShowUnsafe(int, int, int, int)​

Update a region of the display Note: not all displays support partial updates

View Source​
Declaration
public virtual void ShowUnsafe(int left, int top, int right, int bottom)
Parameters​
TypeName
System.Int32left
System.Int32top
System.Int32right
System.Int32bottom

Show(int, int, int, int)​

Update a region of the the display target from the buffer (thread safe) Note: not all displays support partial updates

View Source​
Declaration
public virtual void Show(int left, int top, int right, int bottom)
Parameters​
TypeNameDescription
System.Int32leftThe left coordinate of the display area to update
System.Int32topThe top coordinate of the display area to update
System.Int32rightThe right coordinate of the display area to update
System.Int32bottomThe bottom coordinate of the display area to update

Show(Rect)​

Update a region of the display Note: not all displays support partial updates

View Source​
Declaration
public virtual void Show(Rect rect)
Parameters​
TypeName
Meadow.Foundation.Graphics.Rectrect

Clear(bool)​

Clear the pixel buffer

View Source​
Declaration
public virtual void Clear(bool updateDisplay = false)
Parameters​
TypeNameDescription
System.BooleanupdateDisplayUpdate the display immediately when true

Clear(int, int, int, int, bool)​

Clear a region of the display pixel buffer

View Source​
Declaration
public virtual void Clear(int originX, int originY, int width, int height, bool updateDisplay = false)
Parameters​
TypeNameDescription
System.Int32originXThe X coord to start
System.Int32originYThe Y coord to start
System.Int32widthThe width of the region to clear
System.Int32heightThe height of the region to clear
System.BooleanupdateDisplayUpdate the display immediately when true

Clear(Color, bool)​

Clear the pixel buffer to a color

View Source​
Declaration
public virtual void Clear(Color color, bool updateDisplay = false)
Parameters​
TypeNameDescription
Meadow.ColorcolorColor to set display
System.BooleanupdateDisplayUpdate the display immediately when true

DrawBitmap(int, int, int, int, byte[], Color, ScaleFactor)​

Writes a 1-bit bitmap stored in a byte array

View Source​
Declaration
protected void DrawBitmap(int x, int y, int width, int height, byte[] bitmap, Color color, ScaleFactor scaleFactor = ScaleFactor.X1)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the top left corner of the bitmap
System.Int32yOrdinate of the top left corner of the bitmap
System.Int32widthWidth of the bitmap in pixels
System.Int32heightHeight of the bitmap in pixels
System.Byte[]bitmapBitmap to display
Meadow.ColorcolorThe color of the bitmap
Meadow.Foundation.Graphics.ScaleFactorscaleFactorThe integer scale factor (default is 1)

DrawBitmap(int, int, int, int, byte[], ScaleFactor)​

Writes a 1-bit bitmap to the buffer - used for font rendering

View Source​
Declaration
protected void DrawBitmap(int x, int y, int width, int height, byte[] bitmap, ScaleFactor scaleFactor = ScaleFactor.X1)
Parameters​
TypeNameDescription
System.Int32xAbscissa of the top left corner of the bitmap
System.Int32yOrdinate of the top left corner of the bitmap
System.Int32widthWidth of the bitmap in pixels
System.Int32heightHeight of the bitmap in pixels
System.Byte[]bitmapBitmap to display
Meadow.Foundation.Graphics.ScaleFactorscaleFactorThe integer scale factor (default is 1)

GetXForRotation(int, int)​

Get x pixel position for the current graphics rotation

View Source​
Declaration
public int GetXForRotation(int x, int y)
Returns​

System.Int32

Parameters​
TypeNameDescription
System.Int32xThe non-rotated x position
System.Int32yThe non-rotated y position

GetYForRotation(int, int)​

Get y pixel position for the current graphics rotation

View Source​
Declaration
public int GetYForRotation(int x, int y)
Returns​

System.Int32

Parameters​
TypeNameDescription
System.Int32xThe non-rotated x position
System.Int32yThe non-rotated y position

DrawPath(GraphicsPath, bool, bool)​

Draw a graphics path

View Source​
Declaration
public void DrawPath(GraphicsPath path, bool enabled, bool filled = false)
Parameters​
TypeNameDescription
Meadow.Foundation.Graphics.GraphicsPathpathThe path
System.BooleanenabledShould pixels be enabled (on) or disabled (off)
System.BooleanfilledFill the path (true) or draw the outline (false, default)

DrawPath(GraphicsPath, bool)​

Draw a graphics path

View Source​
Declaration
public void DrawPath(GraphicsPath path, bool filled = false)
Parameters​
TypeNameDescription
Meadow.Foundation.Graphics.GraphicsPathpathThe path
System.BooleanfilledFill the path (true) or draw the outline (false, default)

DrawPath(GraphicsPath, Color, bool)​

Draw a graphics path

View Source​
Declaration
public void DrawPath(GraphicsPath path, Color color, bool filled = false)
Parameters​
TypeNameDescription
Meadow.Foundation.Graphics.GraphicsPathpathThe path
Meadow.ColorcolorThe color to draw the path
System.BooleanfilledFill the path (true) or draw the outline (false, default)

FillPath(GraphicsPath, Color)​

Draw a filled graphics path

View Source​
Declaration
protected void FillPath(GraphicsPath path, Color fillColor)
Parameters​
TypeNameDescription
Meadow.Foundation.Graphics.GraphicsPathpathThe path
Meadow.ColorfillColorThe color to fill the path

Write(string)​

Write text to the display

View Source​
Declaration
public void Write(string text)
Parameters​
TypeNameDescription
System.StringtextThe text
Exceptions​

System.Exception
Throws if no font is set

WriteLine(string, byte, bool)​

Write a line of text in White

View Source​
Declaration
public void WriteLine(string text, byte lineNumber, bool showCursor = false)
Parameters​
TypeNameDescription
System.StringtextThe text
System.BytelineNumberThe line to write
System.BooleanshowCursorTrue to show the cursor
Exceptions​

System.Exception
Throws if no font is set

WriteLine(string, byte, Color, bool)​

Write a line of text

View Source​
Declaration
public void WriteLine(string text, byte lineNumber, Color textColor, bool showCursor = false)
Parameters​
TypeNameDescription
System.StringtextThe text
System.BytelineNumberThe line to write
Meadow.ColortextColorOptional color to use for drawing the text
System.BooleanshowCursorTrue to show the cursor
Exceptions​

System.Exception
Throws if no font is set

ClearLines()​

Clear all lines of text

View Source​
Declaration
public void ClearLines()

ClearLine(byte)​

Clear a single line of text

View Source​
Declaration
public void ClearLine(byte lineNumber)
Parameters​
TypeNameDescription
System.BytelineNumberThe line to clear

SetCursorPosition(byte, byte)​

Set the cursor position relative to the text

View Source​
Declaration
public void SetCursorPosition(byte column, byte line)
Parameters​
TypeNameDescription
System.BytecolumnThe text column
System.BytelineThe line column

Implements​

  • Meadow.Peripherals.Displays.ITextDisplay
  • Meadow.Peripherals.Displays.IDisplay