Pixels
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PixelsBase Class Reference

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
 

Detailed Description

Definition at line 112 of file Pixels.h.

Constructor & Destructor Documentation

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.

Parameters
widthtarget device width (in pixels)
heighttarget device height (in pixels)

Member Function Documentation

boolean PixelsBase::canScroll ( )
inline
Returns
true if the target device can scroll and the scroll feature is enabled.
See Also
scroll(int16_t,int8_t)
enableScroll(boolean)

Definition at line 230 of file Pixels.h.

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 (xy) in the current coordinate space.

Parameters
dataicon image bytes. This method does nothing if data is null.
xthe x coordinate.
ythe 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 (xy) in the current coordinate system.

Parameters
textthe string to be erased.
xxthe x coordinate.
yythe y coordinate.
kerningaptional 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.
See Also
setFont(prog_uchar font[])
setOriginRelative()
setOriginAbsolute()
print(int16_t,int16_t,String,int8_t[])
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 (xy) in the current coordinate space.

Parameters
datathe specified bitmap image to be drawn. This method does nothing if img is null.
xthe x coordinate.
ythe y coordinate.
widththe width of the image.
heightthe height of the image.
See Also
loadBitmap(int16_t,int16_t,int16_t,int16_t,String)
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.

Parameters
xthe x coordinate of the circle center.
ythe y coordinate of the circle center.
radiuscircle radius.
See Also
fillCircle(int16_t,int16_t,int16_t)
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 (xy) in the current coordinate space.

Parameters
datacompressed (with Pixelmeister) bitmap image bytes. This method does nothing if img is null.
xthe x coordinate.
ythe y coordinate.
See Also
drawBitmap(int16_t,int16_t,int16_t,int16_t,int[])
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 (xy) in the current coordinate space.

Parameters
dataicon image bytes. This method does nothing if data is null.
xthe x coordinate.
ythe 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.

Parameters
x1the first point's x coordinate.
y1the first point's y coordinate.
x2the second point's x coordinate.
y2the second point's y coordinate.
See Also
setOriginRelative()
setOriginAbsolute()
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.

Parameters
xthe x coordinate of the upper left corner of the oval to be drawn.
ythe y coordinate of the upper left corner of the oval to be drawn.
widththe width of the oval to be drawn.
heightthe height of the oval to be drawn.
See Also
fillOval(int16_t,int16_t,int16_t,int16_t)
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.

Parameters
xx coordinate.
yy 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.

Parameters
xthe x coordinate of the rectangle to be drawn.
ythe y coordinate of the rectangle to be drawn.
widththe width of the rectangle to be drawn.
heightthe height of the rectangle to be drawn.
See Also
fillRectangle(int16_t,int16_t,int16_t,int16_t)
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.

Parameters
xthe x coordinate of the rectangle to be drawn.
ythe y coordinate of the rectangle to be drawn.
widththe width of the rectangle to be drawn.
heightthe height of the rectangle to be drawn.
rhorizontal and vertical diameters of the arc at the four corners.
See Also
fillRoundRectangle(int16_t,int16_t,int16_t,int16_t,int16_t)
virtual void PixelsBase::enableAntialiasing ( boolean  enable)
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

Parameters
enablea boolean value that determines whether the antialiasing should be enabled or not

Definition at line 206 of file Pixels.h.

void PixelsBase::enableScroll ( boolean  enable)
inline

Enables or disables scroll feature.

Parameters
enablea boolean value that determines whether the scroll feature should be enabled or not
See Also
scroll(int16_t,int8_t)

Definition at line 222 of file Pixels.h.

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.

Parameters
xthe x coordinate of the circle center.
ythe y coordinate of the circle center.
radiuscircle radius.
See Also
drawCircle(int16_t,int16_t,int16_t)
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.

Parameters
xthe x coordinate of the upper left corner of the oval to be filled.
ythe y coordinate of the upper left corner of the oval to be filled.
widththe width of the oval to be filled.
heightthe height of the oval to be filled.
See Also
drawOval(int16_t,int16_t,int16_t,int16_t)
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.

Parameters
xthe x coordinate of the rectangle to be filled.
ythe y coordinate of the rectangle to be filled.
widththe width of the rectangle to be filled.
heightthe height of the rectangle to be filled.
See Also
drawRectangle(int16_t,int16_t,int16_t,int16_t)
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.

Parameters
xthe x coordinate of the rectangle to be filled.
ythe y coordinate of the rectangle to be filled.
widththe width of the rectangle to be filled.
heightthe height of the rectangle to be filled.
rhorizontal and vertical diameters of the arc at the four corners.
See Also
drawRoundRectangle(int16_t,int16_t,int16_t,int16_t,int16_t)
RGB PixelsBase::getBackground ( )
inline

Gets the graphics context's current background color.

Returns
the graphics context's current background color.

Definition at line 332 of file Pixels.h.

RGB PixelsBase::getColor ( )
inline

Gets the graphics context's current color.

Returns
the graphics context's current color.

Definition at line 339 of file Pixels.h.

int16_t PixelsBase::getHeight ( )
inline

Returns device height.

Returns
device height.

Definition at line 259 of file Pixels.h.

double PixelsBase::getLineWidth ( )
inline

Returns the current line width.

Returns
the current line width.

Definition at line 245 of file Pixels.h.

uint8_t PixelsBase::getOrientation ( )
inline

Returns the current coordinate space orientation.

Returns
the current orientation
See Also
setOrientation(uint8_t)

Definition at line 197 of file Pixels.h.

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

Parameters
xx coordinate.
yy coordinate.
Returns
pixel color or the graphics context's current background color.
int16_t PixelsBase::getTextBaseline ( )

Gets the current font baseline offsett

Returns
text baseline offset
int16_t PixelsBase::getTextLineHeight ( )

Gets the current font text line height

Returns
text line height in pixels
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)

Parameters
textthe text string.
kerningoptional 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.
See Also
print(int16_t,int16_t,String,int8_t[])
Returns
text baseline offset
int16_t PixelsBase::getWidth ( )
inline

Returns device width.

Returns
device width.

Definition at line 252 of file Pixels.h.

virtual void PixelsBase::init ( )
inlinevirtual

Initializes hardware with defaults.

Reimplemented in Pixels.

Definition at line 185 of file Pixels.h.

boolean PixelsBase::isAntialiased ( )
inline

Gets the current antialiasing mode.

Returns
a boolean value that shows whether the antialiasing is be enabled or not

Definition at line 214 of file Pixels.h.

boolean PixelsBase::isOriginRelative ( )
inline
Returns
true if the current positioning is relative.
See Also
setOriginRelative()
setOriginAbsolute()

Definition at line 280 of file Pixels.h.

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 (xy) in the current coordinate space.

Parameters
pathto the image.
xthe x coordinate.
ythe y coordinate.
widththe width of the image.
heightthe height of the image.
See Also
drawBitmap(int16_t,int16_t,int16_t,int16_t,int[])
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 (xy) in the current coordinate system.

Parameters
textthe string to be drawn.
xxthe x coordinate.
yythe y coordinate.
kerningoptional 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.
See Also
setFont(prog_uchar font[])
setOriginRelative()
setOriginAbsolute()
cleanText(int16_t,int16_t,String,int8_t[])
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).

Parameters
dynegative or positive scroll distance
flagscan be 0, SCROLL_SMOOTH or/and SCROLL_CLEAN
void PixelsBase::setBackground ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)
inline

Sets the current background color to the specified color. All subsequent relevant graphics operations use this specified color.

Parameters
rthe red component
gthe green component
bthe blue component

Definition at line 299 of file Pixels.h.

void PixelsBase::setBackground ( RGB  color)
inline

Sets the current background color to the specified color. All subsequent relevant graphics operations use this specified color.

Parameters
colorcolor object

Definition at line 317 of file Pixels.h.

void PixelsBase::setColor ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)
inline

Sets the current color to the specified color. All subsequent graphics operations use this specified color.

Parameters
rthe red component
gthe green component
bthe blue component

Definition at line 309 of file Pixels.h.

void PixelsBase::setColor ( RGB  color)
inline

Sets the current color to the specified color. All subsequent graphics operations use this specified color.

Parameters
colorcolor object

Definition at line 325 of file Pixels.h.

virtual void PixelsBase::setFillDirection ( uint8_t  direction)
inlinevirtual

Outout fine tuning method for slow devices

Parameters
directionaccepts FILL_TOPDOWN, FILL_LEFTRIGHT, FILL_DOWNTOP or FILL_RIGHTLEFT

Reimplemented in Pixels.

Definition at line 287 of file Pixels.h.

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.

Parameters
fonta font, converted from TTF with Pixelmeister.
void PixelsBase::setLineWidth ( double  width)
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".

Parameters
widthnew line width.

Definition at line 238 of file Pixels.h.

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).

Parameters
orientationaccepts PORTRAIT, LANDSCAPE, PORTRAIT_FLIP or LANDSCAPE_FLIP
void PixelsBase::setOriginAbsolute ( )
inline

Bounds the coordinate space to physical device pixels, ignoring actual scroll position.

See Also
scroll(int16_t,int8_t)

Definition at line 272 of file Pixels.h.

void PixelsBase::setOriginRelative ( )
inline

Bounds the coordinate space to the device controller video RAM. The physical output depends on the actual scroll position.

Definition at line 265 of file Pixels.h.


The documentation for this class was generated from the following file: