Class DisplayControl
- Namespace
- nanoFramework.UI
- Assembly
- nanoFramework.Graphics.dll
Display Control.
public static class DisplayControl
- Inheritance
-
DisplayControl
- Inherited Members
Properties
BitsPerPixel
Gets the number of bits per pixel used to display the screen. Currently 16 bits in RGB565 format.
public static int BitsPerPixel { get; }
Property Value
FullScreen
Gets a Bitmap object that is the size of the current display.
public static Bitmap FullScreen { get; }
Property Value
Remarks
Please make sure you check if you have enough memory with IsFullScreenBufferAvailable. If you don't have enough, the BitMap won't get initialized and will be null.
IsFullScreenBufferAvailable
Determines if a full size buffer is available based on the current screen configuration.
public static bool IsFullScreenBufferAvailable { get; }
Property Value
LongerSide
Gets the number of pixels for the longer side of the screen.
public static int LongerSide { get; }
Property Value
MaximumBufferSize
Gets the maximum buffer size for Bitmap in bytes.
public static uint MaximumBufferSize { get; }
Property Value
Orientation
Gets the current display orientation, either landscape or portrait.
public static DisplayOrientation Orientation { get; }
Property Value
ScreenHeight
Gets the number of pixels for the height of the screen based on the orientation.
public static int ScreenHeight { get; }
Property Value
ScreenWidth
Gets the number of pixels for the width of the screen based on the orientation.
public static int ScreenWidth { get; }
Property Value
ShorterSide
Gets the number of pixels for the shorter side of the screen.
public static int ShorterSide { get; }
Property Value
Methods
ChangeOrientation(DisplayOrientation)
Changes the orientation of the display and recreates the display canvas with new dimensions.
public static bool ChangeOrientation(DisplayOrientation orientation)
Parameters
orientation
DisplayOrientationThe new orientation to set.
Returns
- bool
True if the orientation was supported and changed.
Remarks
When the orientation is changed, the display canvas is disposed and recreated with the new dimensions when FullScreen property is next called.
Clear()
Clears the screen.
public static void Clear()
Initialize(I2cConfiguration, ScreenConfiguration, uint)
Initializes the screen to use with I2C configuration.
public static uint Initialize(I2cConfiguration i2c, ScreenConfiguration screen, uint bufferSize = 20480)
Parameters
i2c
I2cConfigurationscreen
ScreenConfigurationA screen configuration.
bufferSize
uintThe desired buffer size allocation, 0 for default.
Returns
- uint
The maximum buffer size possible allocation in bytes.
Remarks
You may have to configure the pins properly for the I2C configuration to be valid before initializing your screen.
Initialize(SpiConfiguration, ScreenConfiguration, uint)
Initializes the screen for use with Spi configuration.
public static uint Initialize(SpiConfiguration spi, ScreenConfiguration screen, uint bufferSize = 20480)
Parameters
spi
SpiConfigurationSpi configuration.
screen
ScreenConfigurationA screen configuration.
bufferSize
uintThe desired buffer size allocation, 0 for default.
Returns
- uint
The maximum buffer size possible allocation in bytes.
Remarks
You may have to configure the pins properly for the Spi configuration to be valid before initializing your screen.
Write(string, ushort, ushort, ushort, ushort, Font, Color, Color)
Directly write on the screen a text at coordinate x,y a width,height with a background and foreground color.
public static void Write(string text, ushort x, ushort y, ushort width, ushort height, Font font, Color foreground, Color background)
Parameters
text
stringThe text to write.
x
ushortThe x coordinate.
y
ushortThe y coordinate.
width
ushortThe width of the area to display.
height
ushortThe height of the area to display.
font
FontThe font to use.
foreground
ColorForeground color.
background
ColorBackground color.
Write(ushort, ushort, ushort, ushort, Color[])
Directly write in the screen at coordinate x,y a width,height buffer of 16 bits colors.
public static void Write(ushort x, ushort y, ushort width, ushort height, Color[] colors)
Parameters
x
ushortThe x coordinate.
y
ushortThe y coordinate.
width
ushortThe width of the area to display.
height
ushortThe height of the area to display.
colors
Color[]A color array.
Remarks
The color array will be transformed in managed side to a ushort BGR565 array.
Write(ushort, ushort, ushort, ushort, ushort[])
Directly write in the screen at coordinate x,y a width,height buffer of 16 bits colors.
public static void Write(ushort x, ushort y, ushort width, ushort height, ushort[] colors)
Parameters
x
ushortThe x coordinate.
y
ushortThe y coordinate.
width
ushortThe width of the area to display.
height
ushortThe height of the area to display.
colors
ushort[]A BGR565, 16 bits color array.
WritePoint(ushort, ushort, Color)
Writes a single point on the screen with the specified color.
public static void WritePoint(ushort x, ushort y, Color color)
Parameters
x
ushortThe x coordinate of the point to be written.
y
ushortThe y coordinate of the point to be written.
color
ColorThe 16-bit color value of the point to be written BGR656 format.
WritePoint(ushort, ushort, ushort)
Writes a single point on the screen with the specified color.
public static void WritePoint(ushort x, ushort y, ushort color)