Pixels
|
Inherited by Pixels.
Public Member Functions | |
PixelsBase (uint16_t width, uint16_t height) | |
virtual void | init () |
void | setOrientation (uint8_t orientation) |
uint8_t | getOrientation () |
virtual void | enableAntialiasing (boolean enable) |
boolean | isAntialiased () |
void | enableScroll (boolean enable) |
boolean | canScroll () |
void | setLineWidth (double width) |
double | getLineWidth () |
int16_t | getWidth () |
int16_t | getHeight () |
void | setOriginRelative () |
void | setOriginAbsolute () |
boolean | isOriginRelative () |
virtual void | setFillDirection (uint8_t direction) |
void | clear () |
void | setBackground (uint8_t r, uint8_t g, uint8_t b) |
void | setColor (uint8_t r, uint8_t g, uint8_t b) |
void | setBackground (RGB color) |
void | setColor (RGB color) |
RGB | getBackground () |
RGB | getColor () |
RGB | getPixel (int16_t x, int16_t y) |
void | drawPixel (int16_t x, int16_t y) |
void | drawLine (int16_t x1, int16_t y1, int16_t x2, int16_t y2) |
void | drawCircle (int16_t x, int16_t y, int16_t radius) |
void | drawOval (int16_t x, int16_t y, int16_t width, int16_t height) |
void | drawRectangle (int16_t x, int16_t y, int16_t width, int16_t height) |
void | drawRoundRectangle (int16_t x, int16_t y, int16_t width, int16_t height, int16_t r) |
void | fillCircle (int16_t x, int16_t y, int16_t radius) |
void | fillOval (int16_t x, int16_t y, int16_t width, int16_t height) |
void | fillRectangle (int16_t x, int16_t y, int16_t width, int16_t height) |
void | fillRoundRectangle (int16_t x, int16_t y, int16_t width, int16_t height, int16_t r) |
int8_t | drawBitmap (int16_t x, int16_t y, int16_t width, int16_t height, prog_uint16_t *data) |
int8_t | drawCompressedBitmap (int16_t x, int16_t y, uint8_t *data) |
void | drawIcon (int16_t xx, int16_t yy, prog_uchar data[]) |
void | cleanIcon (int16_t xx, int16_t yy, prog_uchar data[]) |
int8_t | loadBitmap (int16_t x, int16_t y, int16_t width, int16_t height, String path) |
void | scroll (int16_t dy, int16_t x1, int16_t x2, int8_t flags) |
void | scroll (int16_t dy, int8_t flags) |
int | setFont (prog_uchar font[]) |
void | print (int16_t xx, int16_t yy, String text, int8_t kerning[]=NULL) |
void | cleanText (int16_t xx, int16_t yy, String text, int8_t kerning[]=NULL) |
int16_t | getTextLineHeight () |
int16_t | getTextBaseline () |
int16_t | getTextWidth (String text, int8_t kerning[]=NULL) |
Protected Member Functions | |
void | printString (int16_t xx, int16_t yy, String text, boolean clean, int8_t kerning[]=NULL) |
void | drawGlyph (int16_t fontType, boolean clean, int16_t xx, int16_t yy, int16_t height, prog_uchar *data, int16_t ptr, int16_t length) |
virtual void | setRegion (int16_t x1, int16_t y1, int16_t x2, int16_t y2) |
void | setCurrentPixel (RGB color) |
void | setCurrentPixel (int16_t color) |
void | fill (int b, int16_t x1, int16_t y1, int16_t x2, int16_t y2) |
virtual void | quickFill (int b, int16_t x1, int16_t y1, int16_t x2, int16_t y2) |
void | putColor (int16_t x, int16_t y, boolean steep, double weight) |
RGB | computeColor (RGB, double weight) |
RGB | computeColor (RGB fg, uint8_t opacity) |
void | resetRegion () |
void | hLine (int16_t x1, int16_t y1, int16_t x2) |
void | vLine (int16_t x1, int16_t y1, int16_t y2) |
virtual void | deviceWriteData (uint8_t hi, uint8_t lo) |
virtual void | scrollCmd () |
virtual void | drawCircleAntialiaced (int16_t x, int16_t y, int16_t radius, boolean bordermode) |
virtual void | drawFatLineAntialiased (int16_t x1, int16_t y1, int16_t x2, int16_t y2) |
virtual void | drawLineAntialiased (int16_t x1, int16_t y1, int16_t x2, int16_t y2) |
virtual void | drawRoundRectangleAntialiased (int16_t x, int16_t y, int16_t width, int16_t height, int16_t rx, int16_t ry, boolean bordermode) |
int16_t * | loadFileBytes (String) |
Protected Attributes | |
int16_t | deviceWidth |
int16_t | deviceHeight |
int16_t | width |
int16_t | height |
boolean | landscape |
uint8_t | orientation |
boolean | relativeOrigin |
prog_uchar * | currentFont |
RGB | foreground |
RGB | background |
double | lineWidth |
uint8_t | fillDirection |
boolean | antialiasing |
boolean | scrollSupported |
boolean | scrollEnabled |
int16_t | currentScroll |
int16_t | flipScroll |
boolean | scrollCleanMode |
PixelsBase::PixelsBase | ( | uint16_t | width, |
uint16_t | height | ||
) |
Constructs a new Pixels
object for the reference platform TFT_PQ 2.4 (ILI9325 controller) + ITDB02 MEGA Shield v1.1.
width | target device width (in pixels) |
height | target device height (in pixels) |
|
inline |
void PixelsBase::cleanIcon | ( | int16_t | xx, |
int16_t | yy, | ||
prog_uchar | data[] | ||
) |
Paint icon pixels with background color. The icon should be in Pixelmeister format. The icon is drawn with its top-left corner at (x, y) in the current coordinate space.
data | icon image bytes. This method does nothing if data is null. |
x | the x coordinate. |
y | the y coordinate. |
void PixelsBase::cleanText | ( | int16_t | xx, |
int16_t | yy, | ||
String | text, | ||
int8_t | kerning[] = NULL |
||
) |
The method oposes print(int16_t,int16_t,String,int8_t[]) Erases the text given by the specified string by filling glyph shapes with the current background color. The baseline of the leftmost character is at position (x, y) in the current coordinate system.
text | the string to be erased. |
xx | the x coordinate. |
yy | the y coordinate. |
kerning | aptional array of integer kerning values in a range from -99 to 99 to be applied to the string glyphs correspondingly. "-100" value ends the kerning data. If the string has more characters than the array length, a value precedes "-100" is usedas a kerning hint for the rest of the string glyphs. |
void PixelsBase::clear | ( | ) |
Fills the screen with the current background color
int8_t PixelsBase::drawBitmap | ( | int16_t | x, |
int16_t | y, | ||
int16_t | width, | ||
int16_t | height, | ||
prog_uint16_t * | data | ||
) |
Draws specified bitmap image. The image is drawn with its top-left corner at (x, y) in the current coordinate space.
data | the specified bitmap image to be drawn. This method does nothing if img is null. |
x | the x coordinate. |
y | the y coordinate. |
width | the width of the image. |
height | the height of the image. |
void PixelsBase::drawCircle | ( | int16_t | x, |
int16_t | y, | ||
int16_t | radius | ||
) |
Draws the outline of a circle, defined by center coordinates and a radius, with the current color.
x | the x coordinate of the circle center. |
y | the y coordinate of the circle center. |
radius | circle radius. |
int8_t PixelsBase::drawCompressedBitmap | ( | int16_t | x, |
int16_t | y, | ||
uint8_t * | data | ||
) |
Draws specified bitmap image. The image is drawn with its top-left corner at (x, y) in the current coordinate space.
data | compressed (with Pixelmeister) bitmap image bytes. This method does nothing if img is null. |
x | the x coordinate. |
y | the y coordinate. |
void PixelsBase::drawIcon | ( | int16_t | xx, |
int16_t | yy, | ||
prog_uchar | data[] | ||
) |
Draws an icon, prepared with Pixelmeister. The icon is drawn with its top-left corner at (x, y) in the current coordinate space.
data | icon image bytes. This method does nothing if data is null. |
x | the x coordinate. |
y | the y coordinate. |
void PixelsBase::drawLine | ( | int16_t | x1, |
int16_t | y1, | ||
int16_t | x2, | ||
int16_t | y2 | ||
) |
Draws a line, using the current color, between the points (x1, y1)
and (x2, y2)
in current coordinate system.
x1 | the first point's x coordinate. |
y1 | the first point's y coordinate. |
x2 | the second point's x coordinate. |
y2 | the second point's y coordinate. |
void PixelsBase::drawOval | ( | int16_t | x, |
int16_t | y, | ||
int16_t | width, | ||
int16_t | height | ||
) |
Draws the outline of an oval. The result is a circle or ellipse that fits within the rectangle specified by the x
, y
, width
, and height
arguments.
The oval covers an area that is width + 1
pixels wide and height + 1
pixels tall.
x | the x coordinate of the upper left corner of the oval to be drawn. |
y | the y coordinate of the upper left corner of the oval to be drawn. |
width | the width of the oval to be drawn. |
height | the height of the oval to be drawn. |
void PixelsBase::drawPixel | ( | int16_t | x, |
int16_t | y | ||
) |
Draws a pixel, using the current color, at the point (x, y)
in the current coordinate system.
x | x coordinate. |
y | y coordinate. |
void PixelsBase::drawRectangle | ( | int16_t | x, |
int16_t | y, | ||
int16_t | width, | ||
int16_t | height | ||
) |
Draws the outline of the specified rectangle. The left and right edges of the rectangle are at x
and x + width
. The top and bottom edges are at y
and y + height
. The rectangle is drawn using the current color.
x | the x coordinate of the rectangle to be drawn. |
y | the y coordinate of the rectangle to be drawn. |
width | the width of the rectangle to be drawn. |
height | the height of the rectangle to be drawn. |
void PixelsBase::drawRoundRectangle | ( | int16_t | x, |
int16_t | y, | ||
int16_t | width, | ||
int16_t | height, | ||
int16_t | r | ||
) |
Draws an outlined round-cornered rectangle using the current color. The left and right edges of the rectangle are at x
and x + width
, respectively. The top and bottom edges of the rectangle are at y
and y + height
.
x | the x coordinate of the rectangle to be drawn. |
y | the y coordinate of the rectangle to be drawn. |
width | the width of the rectangle to be drawn. |
height | the height of the rectangle to be drawn. |
r | horizontal and vertical diameters of the arc at the four corners. |
|
inlinevirtual |
Enables or disables antialiasing by a drawing of graphical primitives. The metod does not impact antialiased fonts. Antialiased output in general requires more resources/time to output comparing to "grainy" output mode. Takes no effect if Pixels_Antialiasing.h is not included
enable | a boolean value that determines whether the antialiasing should be enabled or not |
|
inline |
Enables or disables scroll feature.
enable | a boolean value that determines whether the scroll feature should be enabled or not |
void PixelsBase::fillCircle | ( | int16_t | x, |
int16_t | y, | ||
int16_t | radius | ||
) |
Fills a circle, defined by center coordinates and a radius, with the current color.
x | the x coordinate of the circle center. |
y | the y coordinate of the circle center. |
radius | circle radius. |
void PixelsBase::fillOval | ( | int16_t | x, |
int16_t | y, | ||
int16_t | width, | ||
int16_t | height | ||
) |
Fills an oval bounded by the specified rectangle with the current color.
x | the x coordinate of the upper left corner of the oval to be filled. |
y | the y coordinate of the upper left corner of the oval to be filled. |
width | the width of the oval to be filled. |
height | the height of the oval to be filled. |
void PixelsBase::fillRectangle | ( | int16_t | x, |
int16_t | y, | ||
int16_t | width, | ||
int16_t | height | ||
) |
Fills the specified rectangle. The left and right edges of the rectangle are at x
and x + width - 1
. The top and bottom edges are at y
and y + height - 1
. The resulting rectangle covers an area width
pixels wide by height
pixels tall. The rectangle is filled using the current color.
x | the x coordinate of the rectangle to be filled. |
y | the y coordinate of the rectangle to be filled. |
width | the width of the rectangle to be filled. |
height | the height of the rectangle to be filled. |
void PixelsBase::fillRoundRectangle | ( | int16_t | x, |
int16_t | y, | ||
int16_t | width, | ||
int16_t | height, | ||
int16_t | r | ||
) |
Fills the specified rounded corner rectangle with the current color. The left and right edges of the rectangle are at x
and x + width - 1
, respectively. The top and bottom edges of the rectangle are at y
and y + height - 1
.
x | the x coordinate of the rectangle to be filled. |
y | the y coordinate of the rectangle to be filled. |
width | the width of the rectangle to be filled. |
height | the height of the rectangle to be filled. |
r | horizontal and vertical diameters of the arc at the four corners. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Returns the current coordinate space orientation.
RGB PixelsBase::getPixel | ( | int16_t | x, |
int16_t | y | ||
) |
Gets a pixel color at the point (x, y)
in the current coordinate system. If video RAM read is not supported by the hardware, returns the graphics context's current background color
x | x coordinate. |
y | y coordinate. |
int16_t PixelsBase::getTextBaseline | ( | ) |
Gets the current font baseline offsett
int16_t PixelsBase::getTextLineHeight | ( | ) |
Gets the current font text line height
int16_t PixelsBase::getTextWidth | ( | String | text, |
int8_t | kerning[] = NULL |
||
) |
Computes needed horizontal space to print the given text with print(int16_t,int16_t,String,int8_t)
text | the text string. |
kerning | optional array of integer kerning values in a range from -99 to 99 to be applied to the string glyphs correspondingly. "-100" value ends the kerning data. If the string has more characters than the array length, a value precedes "-100" is used as a kerning hint for the rest of the string glyphs. |
|
inline |
|
inlinevirtual |
|
inline |
|
inline |
int8_t PixelsBase::loadBitmap | ( | int16_t | x, |
int16_t | y, | ||
int16_t | width, | ||
int16_t | height, | ||
String | path | ||
) |
Loads from an external FAT-drive and draws specified bitmap image. The image is drawn with its top-left corner at (x, y) in the current coordinate space.
path | to the image. |
x | the x coordinate. |
y | the y coordinate. |
width | the width of the image. |
height | the height of the image. |
void PixelsBase::print | ( | int16_t | xx, |
int16_t | yy, | ||
String | text, | ||
int8_t | kerning[] = NULL |
||
) |
Draws the text given by the specified string, using current font and color. The baseline of the leftmost character is at position (x, y) in the current coordinate system.
text | the string to be drawn. |
xx | the x coordinate. |
yy | the y coordinate. |
kerning | optional array of integer kerning values in a range from -99 to 99 to be applied to the string glyphs correspondingly. "-100" value ends the kerning data. If the string has more characters than the array length, a value precedes "-100" is used for the rest of the string glyphs. |
void PixelsBase::scroll | ( | int16_t | dy, |
int16_t | x1, | ||
int16_t | x2, | ||
int8_t | flags | ||
) |
Under construction
void PixelsBase::scroll | ( | int16_t | dy, |
int8_t | flags | ||
) |
Scrolls the display content to a given number of pixels (if the device controller supports scrolling). Scroll axis is vertical by portrait orientation and horizontal by landscape orientation (hardware scpecifics). SCROLL_CLEAN flag forces to paint wrapped regions with background color. SCROLL_SMOOTH eases begin and end of a scroll movement (by big dy values).
dy | negative or positive scroll distance |
flags | can be 0, SCROLL_SMOOTH or/and SCROLL_CLEAN |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
int PixelsBase::setFont | ( | prog_uchar | font[] | ) |
Sets this graphics context's font to the specified font. All subsequent text operations using the context use this font.
font | a font, converted from TTF with Pixelmeister. |
|
inline |
Sets the current line width. For time being the line width is respected by drawLine(int16_t,int16_t,int16_t,int16_t) and a line width control is still "under construction".
width | new line width. |
void PixelsBase::setOrientation | ( | uint8_t | orientation | ) |
Sets the current coordinate space orientation. Default value depends on initially given device width and height (PORTRAIT if height > width, otherwise LANDSCAPE).
orientation | accepts PORTRAIT, LANDSCAPE, PORTRAIT_FLIP or LANDSCAPE_FLIP |
|
inline |
Bounds the coordinate space to physical device pixels, ignoring actual scroll position.
|
inline |