LCD
touchgfx/lcd/LCD.hpp
This class contains the various low-level drawing routines for drawing bitmaps, texts and rectangles/boxes. Normally, these draw operations are called from widgets, which also keep track of logical states such as visibility etc.
The LCD class cannot be instantiated, instead use one of the subclasses which implements the LCD drawing operations for a specific display configuration.
Note: All coordinates sent to functions in the LCD class are expected to be in absolute coordinates, i.e. (0, 0) is upper left corner of the display.
Inherited by: LCD16bpp, LCD16bppSerialFlash, LCD1bpp, LCD24bpp, LCD2bpp, LCD32bpp, LCD32bpp_XRGB8888, LCD4bpp, LCD8bpp_ABGR2222, LCD8bpp_ARGB2222, LCD8bpp_BGRA2222, LCD8bpp_RGBA2222
Public Classes
struct | StringVisuals |
The visual elements when writing a string. | |
Protected Classes
class | DrawTextureMapScanLineBase |
Base class for drawing scanline by the texture mapper. | |
Public Functions
virtual uint8_t | bitDepth() const =0 |
Number of bits per pixel used by the display. | |
virtual void | blitCopy(const uint16_t * sourceData, const Rect & source, const Rect & blitRect, uint8_t alpha, bool hasTransparentPixels) =0 |
Blits (directly copies) a block of data to the framebuffer, performing alpha blending (and tranparency keying) as specified. | |
virtual void | blitCopy(const uint8_t * sourceData, Bitmap::BitmapFormat sourceFormat, const Rect & source, const Rect & blitRect, uint8_t alpha, bool hasTransparentPixels) =0 |
Blits (directly copies) a block of data to the framebuffer, performing alpha blending (and tranparency keying) as specified. | |
virtual void | copyAreaFromTFTToClientBuffer(const Rect & region) =0 |
Copies part of the displayed framebuffer to current framebuffer. | |
uint16_t * | copyFrameBufferRegionToMemory(const Rect & region, const BitmapId bitmapId =BITMAP_ANIMATION_STORAGE) |
Copies part of the framebuffer to the data section of a bitmap. | |
virtual uint16_t * | copyFrameBufferRegionToMemory(const Rect & visRegion, const Rect & absRegion, const BitmapId bitmapId) =0 |
Copies part of the framebuffer to the data section of a bitmap. | |
virtual Rect | copyFrameBufferRegionToMemory(const Rect & visRegion, const Rect & absRegion, uint8_t * dst, int16_t dstWidth, int16_t dstHeight) =0 |
Copies part of the framebuffer to memory. | |
virtual void | drawPartialBitmap(const Bitmap & bitmap, int16_t x, int16_t y, const Rect & rect, uint8_t alpha =255, bool useOptimized =true) =0 |
Draws all (or a part) of a bitmap. | |
void | drawString(Rect widgetArea, const Rect & invalidatedArea, const StringVisuals & stringVisuals, const Unicode::UnicodeChar * format, ... ) |
Draws the specified Unicode string. | |
virtual void | drawTextureMapQuad(const DrawingSurface & dest, const Point3D * vertices, const TextureSurface & texture, const Rect & absoluteRect, const Rect & dirtyAreaAbsolute, RenderingVariant renderVariant, uint8_t alpha =255, uint16_t subDivisionSize =12) |
Texture map quad. | |
virtual void | drawTextureMapTriangle(const DrawingSurface & dest, const Point3D * vertices, const TextureSurface & texture, const Rect & absoluteRect, const Rect & dirtyAreaAbsolute, RenderingVariant renderVariant, uint8_t alpha =255, uint16_t subDivisionSize =12) |
Texture map triangle. | |
virtual void | fillBuffer(uint8_t *const destination, uint16_t pixelStride, const Rect & rect, const colortype color, const uint8_t alpha) =0 |
Draws a filled rectangle in destination memory using the specified color and opacity. | |
virtual void | fillRect(const Rect & rect, colortype color, uint8_t alpha =255) =0 |
Draws a filled rectangle in the framebuffer in the specified color and opacity. | |
virtual Bitmap::BitmapFormat | framebufferFormat() const =0 |
Framebuffer format used by the display. | |
virtual uint16_t | framebufferStride() const =0 |
Framebuffer stride in bytes. | |
colortype | getDefaultColor() const |
Gets default color previously set using setDefaultColor. | |
LCD() | |
Initializes a new instance of the LCD class. | |
virtual void | setDefaultColor(colortype color) |
Sets default color as used by alpha level only bitmap formats, e.g. | |
virtual bool | supportDynamicBitmapDrawing(const Bitmap::BitmapFormat format) |
Check if LCD support dynamic bitmap drawing. | |
virtual | ~LCD() |
Finalizes an instance of the LCD class. | |
FORCE_INLINE_FUNCTION uint8_t | div255(uint16_t num) |
Approximates an integer division of a 16bit value by 255. | |
FORCE_INLINE_FUNCTION uint32_t | div255g(uint32_t pixelxAlpha) |
Divides the green component of pixelxAlpha by 255. | |
FORCE_INLINE_FUNCTION uint32_t | div255rb(uint32_t pixelxAlpha) |
Divides the red and blue components of pixelxAlpha by 255. | |
Protected Functions
virtual void | drawGlyph(uint16_t wbuf16, Rect widgetArea, int16_t x, int16_t y, uint16_t offsetX, uint16_t offsetY, const Rect & invalidatedArea, const GlyphNode glyph, const uint8_t * glyphData, uint8_t byteAlignRow, colortype color, uint8_t bitsPerPixel, uint8_t alpha, TextRotation rotation) =0 |
Private version of draw-glyph with explicit destination buffer pointer argument. | |
void | drawStringLTR(const Rect & widgetArea, const Rect & invalidatedArea, const StringVisuals & visuals, const Unicode::UnicodeChar * format, va_list pArg) |
Draws the specified Unicode string. | |
void | drawStringRTL(const Rect & widgetArea, const Rect & invalidatedArea, const StringVisuals & visuals, const Unicode::UnicodeChar * format, va_list pArg) |
Draws the specified Unicode string. | |
virtual void | drawTextureMapScanLine(const DrawingSurface & dest, const Gradients & gradients, const Edge leftEdge, const Edge rightEdge, const TextureSurface & texture, const Rect & absoluteRect, const Rect & dirtyAreaAbsolute, RenderingVariant renderVariant, uint8_t alpha, uint16_t subDivisionSize) |
Draw scan line. | |
virtual DrawTextureMapScanLineBase * | getTextureMapperDrawScanLine(const TextureSurface & texture, RenderingVariant renderVariant, uint8_t alpha) |
Gets pointer to object that can draw a scan line which allows for highly specialized and optimized implementation. | |
FORCE_INLINE_FUNCTION uint8_t | getAlphaFromA4(const uint16_t * data, uint32_t offset) |
Gets alpha from A4 image at given offset. | |
uint16_t | getNumLines(TextProvider & textProvider, WideTextAction wideTextAction, TextDirection textDirection, const Font * font, int16_t width) |
Gets number of lines for a given text taking word wrap into consideration. | |
int | realX(const Rect & widgetArea, int16_t x, int16_t y, TextRotation rotation) |
Find the real, absolute x coordinate of a point inside a widget with regards to rotation. | |
int | realY(const Rect & widgetArea, int16_t x, int16_t y, TextRotation rotation) |
Find the real, absolute y coordinate of a point inside a widget with regards to rotation. | |
void | rotateRect(Rect & rect, const Rect & canvas, const TextRotation rotation) |
Rotate a rectangle inside another rectangle. | |
uint16_t | stringWidth(TextProvider & textProvider, const Font & font, const int numChars, TextDirection textDirection) |
Find string width of the given number of ligatures read from the given TextProvider. | |
Protected Attributes
colortype | defaultColor |
Default Color to use when displaying transparency-only elements, e.g. A4 bitmaps. | |
const uint16_t | newLine |
NewLine value. | |
Public Functions Documentation
bitDepth
virtual uint8_t bitDepth | ( | ) | const =0 |
Number of bits per pixel used by the display.
The number of bits per pixel.
Reimplemented by: touchgfx::LCD16bpp::bitDepth, touchgfx::LCD16bppSerialFlash::bitDepth, touchgfx::LCD1bpp::bitDepth, touchgfx::LCD24bpp::bitDepth, touchgfx::LCD2bpp::bitDepth, touchgfx::LCD32bpp::bitDepth, touchgfx::LCD32bpp_XRGB8888::bitDepth, touchgfx::LCD4bpp::bitDepth, touchgfx::LCD8bpp_ABGR2222::bitDepth, touchgfx::LCD8bpp_ARGB2222::bitDepth, touchgfx::LCD8bpp_BGRA2222::bitDepth, touchgfx::LCD8bpp_RGBA2222::bitDepth
blitCopy
virtual void blitCopy | ( | const uint16_t * | sourceData , | =0 | |
const Rect & | source , | =0 | |||
const Rect & | blitRect , | =0 | |||
uint8_t | alpha , | =0 | |||
bool | hasTransparentPixels | =0 | |||
) | =0 |
Blits (directly copies) a block of data to the framebuffer, performing alpha blending (and tranparency keying) as specified.
Performs a software blend if HAL does not support BLIT_COPY_WITH_ALPHA and alpha != 255 (solid).
sourceData | The source array pointer (points to the beginning of the data). The sourceData must be stored in a format suitable for the selected display. |
source | The position and dimensions of the source. The x and y of this rect should both be 0. |
blitRect | A rectangle describing what region of the sourceData is to be copied to the framebuffer. |
alpha | The alpha value to use for blending ranging from 0=invisible to 255=solid=no blending. |
hasTransparentPixels | If true, this data copy contains transparent pixels and require hardware support for that to be enabled. |
Reimplemented by: touchgfx::LCD16bpp::blitCopy, touchgfx::LCD16bppSerialFlash::blitCopy, touchgfx::LCD1bpp::blitCopy, touchgfx::LCD24bpp::blitCopy, touchgfx::LCD2bpp::blitCopy, touchgfx::LCD32bpp::blitCopy, touchgfx::LCD32bpp_XRGB8888::blitCopy, touchgfx::LCD4bpp::blitCopy, touchgfx::LCD8bpp_ABGR2222::blitCopy, touchgfx::LCD8bpp_ARGB2222::blitCopy, touchgfx::LCD8bpp_BGRA2222::blitCopy, touchgfx::LCD8bpp_RGBA2222::blitCopy
blitCopy
virtual void blitCopy | ( | const uint8_t * | sourceData , | =0 | |
Bitmap::BitmapFormat | sourceFormat , | =0 | |||
const Rect & | source , | =0 | |||
const Rect & | blitRect , | =0 | |||
uint8_t | alpha , | =0 | |||
bool | hasTransparentPixels | =0 | |||
) | =0 |
Blits (directly copies) a block of data to the framebuffer, performing alpha blending (and tranparency keying) as specified.
Performs a software blend if HAL does not support BLIT_COPY_WITH_ALPHA and alpha < 255 (solid).
If the display does not support the specified sourceFormat, an assert will be raised.
sourceData | The source array pointer (points to the beginning of the data). The sourceData must be stored in a format suitable for the selected display. |
sourceFormat | The bitmap format used in the source data. |
source | The position and dimensions of the source. The x and y of this rect should both be 0. |
blitRect | A rectangle describing what region of the sourceData is to be copied to the framebuffer. |
alpha | The alpha value to use for blending ranging from 0=invisible to 255=solid=no blending. |
hasTransparentPixels | If true, this data copy contains transparent pixels and require hardware support for that to be enabled. |
Reimplemented by: touchgfx::LCD16bpp::blitCopy, touchgfx::LCD16bppSerialFlash::blitCopy, touchgfx::LCD1bpp::blitCopy, touchgfx::LCD24bpp::blitCopy, touchgfx::LCD2bpp::blitCopy, touchgfx::LCD32bpp::blitCopy, touchgfx::LCD32bpp_XRGB8888::blitCopy, touchgfx::LCD4bpp::blitCopy, touchgfx::LCD8bpp_ABGR2222::blitCopy, touchgfx::LCD8bpp_ARGB2222::blitCopy, touchgfx::LCD8bpp_BGRA2222::blitCopy, touchgfx::LCD8bpp_RGBA2222::blitCopy
copyAreaFromTFTToClientBuffer
virtual void copyAreaFromTFTToClientBuffer | ( | const Rect & | region | ) | |
Copies part of the displayed framebuffer to current framebuffer.
The region given is the absolute region on screen.
region | A rectangle describing what region of the displayed framebuffer is to be copied to the framebuffer. |
Note
The copy is performed only when double buffering is enabled. Otherwise the given region in current framebuffer is left untouched.
Reimplemented by: touchgfx::LCD16bpp::copyAreaFromTFTToClientBuffer, touchgfx::LCD16bppSerialFlash::copyAreaFromTFTToClientBuffer, touchgfx::LCD1bpp::copyAreaFromTFTToClientBuffer, touchgfx::LCD24bpp::copyAreaFromTFTToClientBuffer, touchgfx::LCD2bpp::copyAreaFromTFTToClientBuffer, touchgfx::LCD32bpp::copyAreaFromTFTToClientBuffer, touchgfx::LCD32bpp_XRGB8888::copyAreaFromTFTToClientBuffer, touchgfx::LCD4bpp::copyAreaFromTFTToClientBuffer, touchgfx::LCD8bpp_ABGR2222::copyAreaFromTFTToClientBuffer, touchgfx::LCD8bpp_ARGB2222::copyAreaFromTFTToClientBuffer, touchgfx::LCD8bpp_BGRA2222::copyAreaFromTFTToClientBuffer, touchgfx::LCD8bpp_RGBA2222::copyAreaFromTFTToClientBuffer
copyFrameBufferRegionToMemory
uint16_t * copyFrameBufferRegionToMemory | ( | const Rect & | region , | ||
const BitmapId | bitmapId =BITMAP_ANIMATION_STORAGE | ||||
) |
Copies part of the framebuffer to the data section of a bitmap.
The bitmap must be a dynamic bitmap or animation storage (BITMAPANIMATION_STORAGE). Only the part specified with by parameter _region is copied.
If region has negative x/y coordinates of if width/height exceeds those of the given bitmap, only the visible and legal part of the framebuffer is copied. The rest of the bitmap image is left untouched.
region | The part of the framebuffer to copy. |
bitmapId | (Optional) The bitmap to store the data in. Default is to use Animation Storage. |
A pointer to the copy.
Note
There is only one instance of animation storage. The content of the bitmap data (or animation storage) outside the given region is left untouched.
copyFrameBufferRegionToMemory
virtual uint16_t * copyFrameBufferRegionToMemory | ( | const Rect & | visRegion , | =0 | |
const Rect & | absRegion , | =0 | |||
const BitmapId | bitmapId | =0 | |||
) | =0 |
Copies part of the framebuffer to the data section of a bitmap.
The bitmap must be a dynamic bitmap or animation storage (BITMAP_ANIMATION_STORAGE). The two regions given are the visible region and the absolute region on screen. This is used to copy only a part of the framebuffer. This might be the case if a SnapshotWidget is placed inside a Container where parts of the SnapshowWidget is outside the area defined by the Container. The visible region must be completely inside the absolute region.
visRegion | The visible region. |
absRegion | The absolute region. |
bitmapId | Identifier for the bitmap. |
Null if it fails, else a pointer to the data in the given bitmap.
Note
There is only one instance of animation storage. The content of the bitmap data /animation storage outside the given region is left untouched.
Reimplemented by: touchgfx::LCD16bpp::copyFrameBufferRegionToMemory, touchgfx::LCD16bppSerialFlash::copyFrameBufferRegionToMemory, touchgfx::LCD1bpp::copyFrameBufferRegionToMemory, touchgfx::LCD24bpp::copyFrameBufferRegionToMemory, touchgfx::LCD2bpp::copyFrameBufferRegionToMemory, touchgfx::LCD32bpp::copyFrameBufferRegionToMemory, touchgfx::LCD32bpp_XRGB8888::copyFrameBufferRegionToMemory, touchgfx::LCD4bpp::copyFrameBufferRegionToMemory, touchgfx::LCD8bpp_ABGR2222::copyFrameBufferRegionToMemory, touchgfx::LCD8bpp_ARGB2222::copyFrameBufferRegionToMemory, touchgfx::LCD8bpp_BGRA2222::copyFrameBufferRegionToMemory, touchgfx::LCD8bpp_RGBA2222::copyFrameBufferRegionToMemory
copyFrameBufferRegionToMemory
virtual Rect copyFrameBufferRegionToMemory | ( | const Rect & | visRegion , | =0 | |
const Rect & | absRegion , | =0 | |||
uint8_t * | dst , | =0 | |||
int16_t | dstWidth , | =0 | |||
int16_t | dstHeight | =0 | |||
) | =0 |
Copies part of the framebuffer to memory.
The memory is assumed to have the same format as the framebuffer. The two regions given are the visible region and the absolute region on screen. This is used to copy only a part of the framebuffer. This might be the case if a SnapshotWidget is placed inside a Container where parts of the SnapshowWidget is outside the area defined by the Container. The visible region must be completely inside the absolute region.
visRegion | The visible region. |
absRegion | The absolute region. |
dst | Destination memory in same format as the framebuffer. |
dstWidth | Width of the destination. |
dstHeight | Height of the destination. |
The rect that was actually copied to the destination buffer.
Note
There is only one instance of animation storage. The content of the bitmap data /animation storage outside the given region is left untouched.
Reimplemented by: touchgfx::LCD16bpp::copyFrameBufferRegionToMemory, touchgfx::LCD16bppSerialFlash::copyFrameBufferRegionToMemory, touchgfx::LCD1bpp::copyFrameBufferRegionToMemory, touchgfx::LCD24bpp::copyFrameBufferRegionToMemory, touchgfx::LCD2bpp::copyFrameBufferRegionToMemory, touchgfx::LCD32bpp::copyFrameBufferRegionToMemory, touchgfx::LCD32bpp_XRGB8888::copyFrameBufferRegionToMemory, touchgfx::LCD4bpp::copyFrameBufferRegionToMemory, touchgfx::LCD8bpp_ABGR2222::copyFrameBufferRegionToMemory, touchgfx::LCD8bpp_ARGB2222::copyFrameBufferRegionToMemory, touchgfx::LCD8bpp_BGRA2222::copyFrameBufferRegionToMemory, touchgfx::LCD8bpp_RGBA2222::copyFrameBufferRegionToMemory
drawPartialBitmap
virtual void drawPartialBitmap | ( | const Bitmap & | bitmap , | =0 | |
int16_t | x , | =0 | |||
int16_t | y , | =0 | |||
const Rect & | rect , | =0 | |||
uint8_t | alpha =255, | =0 | |||
bool | useOptimized =true | =0 | |||
) | =0 |
Draws all (or a part) of a bitmap.
The coordinates of the corner of the bitmap is given in (x, y) and rect describes which part of the bitmap should be drawn. The bitmap can be drawn as it is or more or less transparent depending on the value of alpha. The value of alpha is independent of the transparency of the individual pixels of the given bitmap.
bitmap | The bitmap to draw. |
x | The absolute x coordinate to place (0, 0) of the bitmap on the screen. |
y | The absolute y coordinate to place (0, 0) of the bitmap on the screen. |
rect | A rectangle describing what region of the bitmap is to be drawn. |
alpha | (Optional) Optional alpha value ranging from 0=invisible to 255=solid. Default is 255 (solid). |
useOptimized | (Optional) if false, do not attempt to substitute (parts of) this bitmap with faster fillrects. |
Reimplemented by: touchgfx::LCD16bpp::drawPartialBitmap, touchgfx::LCD16bppSerialFlash::drawPartialBitmap, touchgfx::LCD1bpp::drawPartialBitmap, touchgfx::LCD24bpp::drawPartialBitmap, touchgfx::LCD2bpp::drawPartialBitmap, touchgfx::LCD32bpp::drawPartialBitmap, touchgfx::LCD32bpp_XRGB8888::drawPartialBitmap, touchgfx::LCD4bpp::drawPartialBitmap, touchgfx::LCD8bpp_ABGR2222::drawPartialBitmap, touchgfx::LCD8bpp_ARGB2222::drawPartialBitmap, touchgfx::LCD8bpp_BGRA2222::drawPartialBitmap, touchgfx::LCD8bpp_RGBA2222::drawPartialBitmap
drawString
void drawString | ( | Rect | widgetArea , | ||
const Rect & | invalidatedArea , | ||||
const StringVisuals & | stringVisuals , | ||||
const Unicode::UnicodeChar * | format , | ||||
... | |||||
) |
Draws the specified Unicode string.
Breaks line on newline.
widgetArea | The area covered by the drawing widget in absolute coordinates. |
invalidatedArea | The (sub)region of the widget area to draw, expressed relative to the widget area. If the widgetArea is x=10, y=10, width=20, height=20 and invalidatedArea is x=5, y=5, width=6, height=6 the widgetArea drawn on the LCD is x=15, y=15, width=6, height=6. |
stringVisuals | The string visuals (font, alignment, line space, color) with which to draw this string. |
format | A pointer to a null-terminated text string with optional additional wildcard arguments. |
... | Variable arguments providing additional information. |
drawTextureMapQuad
virtual void drawTextureMapQuad | ( | const DrawingSurface & | dest , | ||
const Point3D * | vertices , | ||||
const TextureSurface & | texture , | ||||
const Rect & | absoluteRect , | ||||
const Rect & | dirtyAreaAbsolute , | ||||
RenderingVariant | renderVariant , | ||||
uint8_t | alpha =255, | ||||
uint16_t | subDivisionSize =12 | ||||
) |
Texture map quad.
Draw a perspective correct texture mapped quad. The vertices describes the surface, the x,y,z coordinates and the u,v coordinates of the texture. The texture contains the image data to be drawn The quad line will be placed and clipped using the absolute and dirty rectangles The alpha will determine how the quad should be alpha blended. The subDivisionSize will determine the size of the piecewise affine texture mapped portions of the quad.
dest | The description of where the texture is drawn - can be used to issue a draw off screen. |
vertices | The vertices of the quad. |
texture | The texture. |
absoluteRect | The containing rectangle in absolute coordinates. |
dirtyAreaAbsolute | The dirty area in absolute coordinates. |
renderVariant | The render variant - includes the algorithm and the pixel format. |
alpha | (Optional) the alpha. Default is 255 (solid). |
subDivisionSize | (Optional) the size of the subdivisions of the scan line. Default is 12. |
drawTextureMapTriangle
virtual void drawTextureMapTriangle | ( | const DrawingSurface & | dest , | ||
const Point3D * | vertices , | ||||
const TextureSurface & | texture , | ||||
const Rect & | absoluteRect , | ||||
const Rect & | dirtyAreaAbsolute , | ||||
RenderingVariant | renderVariant , | ||||
uint8_t | alpha =255, | ||||
uint16_t | subDivisionSize =12 | ||||
) |
Texture map triangle.
Draw a perspective correct texture mapped triangle. The vertices describes the surface, the x,y,z coordinates and the u,v coordinates of the texture. The texture contains the image data to be drawn The triangle line will be placed and clipped using the absolute and dirty rectangles The alpha will determine how the triangle should be alpha blended. The subDivisionSize will determine the size of the piecewise affine texture mapped portions of the triangle.
dest | The description of where the texture is drawn - can be used to issue a draw off screen. |
vertices | The vertices of the triangle. |
texture | The texture. |
absoluteRect | The containing rectangle in absolute coordinates. |
dirtyAreaAbsolute | The dirty area in absolute coordinates. |
renderVariant | The render variant - includes the algorithm and the pixel format. |
alpha | (Optional) the alpha. Default is 255 (solid). |
subDivisionSize | (Optional) the size of the subdivisions of the scan line. Default is 12. |
fillBuffer
virtual void fillBuffer | ( | uint8_t *const | destination , | =0 | |
uint16_t | pixelStride , | =0 | |||
const Rect & | rect , | =0 | |||
const colortype | color , | =0 | |||
const uint8_t | alpha | =0 | |||
) | =0 |
Draws a filled rectangle in destination memory using the specified color and opacity.
The destination memory must have the same format as the display framebuffer. By default the rectangle will be drawn as a solid box. The rectangle can be drawn with transparency by specifying alpha from 0=invisible to 255=solid.
destination | The start of the memory area to fill. |
pixelStride | The pixel stride, i.e. number of pixels in a row. |
rect | The rectangle to fill absolute coordinates. |
color | The rectangle color. |
alpha | The rectangle opacity, from 0=invisible to 255=solid. |
Note
The pixelStride is rounded up to nearest whole bytes for displays with more than one pixel per byte (LCD1bpp, LCD2bpp and LCD4bpp)
Reimplemented by: touchgfx::LCD16bpp::fillBuffer, touchgfx::LCD16bppSerialFlash::fillBuffer, touchgfx::LCD1bpp::fillBuffer, touchgfx::LCD24bpp::fillBuffer, touchgfx::LCD2bpp::fillBuffer, touchgfx::LCD32bpp::fillBuffer, touchgfx::LCD32bpp_XRGB8888::fillBuffer, touchgfx::LCD4bpp::fillBuffer, touchgfx::LCD8bpp_ABGR2222::fillBuffer, touchgfx::LCD8bpp_ARGB2222::fillBuffer, touchgfx::LCD8bpp_BGRA2222::fillBuffer, touchgfx::LCD8bpp_RGBA2222::fillBuffer
fillRect
Draws a filled rectangle in the framebuffer in the specified color and opacity.
By default the rectangle will be drawn as a solid box. The rectangle can be drawn with transparency by specifying alpha from 0=invisible to 255=solid.
rect | The rectangle to draw in absolute display coordinates. |
color | The rectangle color. |
alpha | (Optional) The rectangle opacity, from 0=invisible to 255=solid. |
Reimplemented by: touchgfx::LCD16bpp::fillRect, touchgfx::LCD16bppSerialFlash::fillRect, touchgfx::LCD1bpp::fillRect, touchgfx::LCD24bpp::fillRect, touchgfx::LCD2bpp::fillRect, touchgfx::LCD32bpp::fillRect, touchgfx::LCD32bpp_XRGB8888::fillRect, touchgfx::LCD4bpp::fillRect, touchgfx::LCD8bpp_ABGR2222::fillRect, touchgfx::LCD8bpp_ARGB2222::fillRect, touchgfx::LCD8bpp_BGRA2222::fillRect, touchgfx::LCD8bpp_RGBA2222::fillRect
framebufferFormat
virtual Bitmap::BitmapFormat framebufferFormat | ( | ) | const =0 |
Framebuffer format used by the display.
Reimplemented by: touchgfx::LCD16bpp::framebufferFormat, touchgfx::LCD16bppSerialFlash::framebufferFormat, touchgfx::LCD1bpp::framebufferFormat, touchgfx::LCD24bpp::framebufferFormat, touchgfx::LCD2bpp::framebufferFormat, touchgfx::LCD32bpp::framebufferFormat, touchgfx::LCD32bpp_XRGB8888::framebufferFormat, touchgfx::LCD4bpp::framebufferFormat, touchgfx::LCD8bpp_ABGR2222::framebufferFormat, touchgfx::LCD8bpp_ARGB2222::framebufferFormat, touchgfx::LCD8bpp_BGRA2222::framebufferFormat, touchgfx::LCD8bpp_RGBA2222::framebufferFormat
framebufferStride
virtual uint16_t framebufferStride | ( | ) | const =0 |
Framebuffer stride in bytes.
The distance (in bytes) from the start of one framebuffer row, to the next.
The number of bytes in one framebuffer row.
Reimplemented by: touchgfx::LCD16bpp::framebufferStride, touchgfx::LCD16bppSerialFlash::framebufferStride, touchgfx::LCD1bpp::framebufferStride, touchgfx::LCD24bpp::framebufferStride, touchgfx::LCD2bpp::framebufferStride, touchgfx::LCD32bpp::framebufferStride, touchgfx::LCD32bpp_XRGB8888::framebufferStride, touchgfx::LCD4bpp::framebufferStride, touchgfx::LCD8bpp_ABGR2222::framebufferStride, touchgfx::LCD8bpp_ARGB2222::framebufferStride, touchgfx::LCD8bpp_BGRA2222::framebufferStride, touchgfx::LCD8bpp_RGBA2222::framebufferStride
getDefaultColor
colortype getDefaultColor | ( | ) | const |
Gets default color previously set using setDefaultColor.
The default color.
LCD
setDefaultColor
virtual void setDefaultColor | ( | colortype | color | ) | |
Sets default color as used by alpha level only bitmap formats, e.g.
A4. The default color, if no color is set, is black.
color | The color. |
Reimplemented by: touchgfx::LCD4bpp::setDefaultColor
supportDynamicBitmapDrawing
virtual bool supportDynamicBitmapDrawing | ( | const Bitmap::BitmapFormat | format | ) | |
Check if LCD support dynamic bitmap drawing.
format | The dynamic bitmap format. |
true if dynamic bitmap drawing is supported, false otherwise.
Reimplemented by: touchgfx::LCD32bpp_XRGB8888::supportDynamicBitmapDrawing
~LCD
div255
static FORCE_INLINE_FUNCTION uint8_t div255 | ( | uint16_t | num | ) | |
Approximates an integer division of a 16bit value by 255.
Divides numerator num (e.g. the sum resulting from an alpha-blending operation) by 255.
num | The numerator to divide by 255. |
The result of a division by 255.
div255g
static FORCE_INLINE_FUNCTION uint32_t div255g | ( | uint32_t | pixelxAlpha | ) | |
Divides the green component of pixelxAlpha by 255.
pixelxAlpha | The green component of a 32bit ARGB pixel multiplied by an alpha factor. |
pixelxAlpha with its green component divided by 255.
div255rb
static FORCE_INLINE_FUNCTION uint32_t div255rb | ( | uint32_t | pixelxAlpha | ) | |
Divides the red and blue components of pixelxAlpha by 255.
pixelxAlpha | The red and blue components of a 32bit ARGB pixel multiplied by an alpha factor. |
pixelxAlpha with its red and blue components divided by 255.
Protected Functions Documentation
drawGlyph
virtual void drawGlyph | ( | uint16_t * | wbuf16 , | =0 | |
Rect | widgetArea , | =0 | |||
int16_t | x , | =0 | |||
int16_t | y , | =0 | |||
uint16_t | offsetX , | =0 | |||
uint16_t | offsetY , | =0 | |||
const Rect & | invalidatedArea , | =0 | |||
const GlyphNode * | glyph , | =0 | |||
const uint8_t * | glyphData , | =0 | |||
uint8_t | byteAlignRow , | =0 | |||
colortype | color , | =0 | |||
uint8_t | bitsPerPixel , | =0 | |||
uint8_t | alpha , | =0 | |||
TextRotation | rotation | =0 | |||
) | =0 |
Private version of draw-glyph with explicit destination buffer pointer argument.
For all parameters (except the buffer pointer) see the public function drawString().
wbuf16 | The destination (frame) buffer to draw to. |
widgetArea | The canvas to draw the glyph inside. |
x | Horizontal offset to start drawing the glyph. |
y | Vertical offset to start drawing the glyph. |
offsetX | Horizontal offset in the glyph to start drawing from. |
offsetY | Vertical offset in the glyph to start drawing from. |
invalidatedArea | The area to draw inside. |
glyph | Specifications of the glyph to draw. |
glyphData | Data containing the actual glyph (dense format) |
byteAlignRow | Each row of glyph data starts in a new byte. |
color | The color of the glyph. |
bitsPerPixel | Bit depth of the glyph. |
alpha | The transparency of the glyph. |
rotation | Rotation to do before drawing the glyph. |
Reimplemented by: touchgfx::LCD16bpp::drawGlyph, touchgfx::LCD16bppSerialFlash::drawGlyph, touchgfx::LCD1bpp::drawGlyph, touchgfx::LCD24bpp::drawGlyph, touchgfx::LCD2bpp::drawGlyph, touchgfx::LCD32bpp::drawGlyph, touchgfx::LCD32bpp_XRGB8888::drawGlyph, touchgfx::LCD4bpp::drawGlyph, touchgfx::LCD8bpp_ABGR2222::drawGlyph, touchgfx::LCD8bpp_ARGB2222::drawGlyph, touchgfx::LCD8bpp_BGRA2222::drawGlyph, touchgfx::LCD8bpp_RGBA2222::drawGlyph
drawStringLTR
void drawStringLTR | ( | const Rect & | widgetArea , | ||
const Rect & | invalidatedArea , | ||||
const StringVisuals & | visuals , | ||||
const Unicode::UnicodeChar * | format , | ||||
va_list | pArg | ||||
) |
Draws the specified Unicode string.
Breaks line on newline. The string is assumed to contain only Latin characters written left-to-right.
widgetArea | The area covered by the drawing widget in absolute coordinates. |
invalidatedArea | The (sub)region of the widget area to draw, expressed relative to the widget area. If the widgetArea is x=10, y=10, width=20, height=20 and invalidatedArea is x=5, y=5, width=6, height=6 the widgetArea drawn on the LCD is x=15, y=15, width=6, height=6. |
visuals | The string visuals (font, alignment, line space, color) with which to draw this string. |
format | A pointer to a null-terminated text string with optional additional wildcard arguments. |
pArg | Variable arguments providing additional information. |
drawStringRTL
void drawStringRTL | ( | const Rect & | widgetArea , | ||
const Rect & | invalidatedArea , | ||||
const StringVisuals & | visuals , | ||||
const Unicode::UnicodeChar * | format , | ||||
va_list | pArg | ||||
) |
Draws the specified Unicode string.
Breaks line on newline. The string can be either right-to-left or left-to-right and may contain sequences of Arabic / Hebrew and Latin characters.
widgetArea | The area covered by the drawing widget in absolute coordinates. |
invalidatedArea | The (sub)region of the widget area to draw, expressed relative to the widget area. If the widgetArea is x=10, y=10, width=20, height=20 and invalidatedArea is x=5, y=5, width=6, height=6 the widgetArea drawn on the LCD is x=15, y=15, width=6, height=6. |
visuals | The string visuals (font, alignment, line space, color) with which to draw this string. |
format | A pointer to a null-terminated text string with optional additional wildcard arguments. |
pArg | Variable arguments providing additional information. |
drawTextureMapScanLine
virtual void drawTextureMapScanLine | ( | const DrawingSurface & | dest , | ||
const Gradients & | gradients , | ||||
const Edge * | leftEdge , | ||||
const Edge * | rightEdge , | ||||
const TextureSurface & | texture , | ||||
const Rect & | absoluteRect , | ||||
const Rect & | dirtyAreaAbsolute , | ||||
RenderingVariant | renderVariant , | ||||
uint8_t | alpha , | ||||
uint16_t | subDivisionSize | ||||
) |
Draw scan line.
Draw one horizontal line of the texture map on screen. The scan line will be drawn using perspective correct texture mapping. The appearance of the line is determined by the left and right edge and the gradients structure. The edges contain the information about the x,y,z coordinates of the left and right side respectively and also information about the u,v coordinates of the texture map used. The gradients structure contains information about how to interpolate all the values across the scan line. The data drawn should be present in the texture argument.
The scan line will be drawn using the additional arguments. The scan line will be placed and clipped using the absolute and dirty rectangles The alpha will determine how the scan line should be alpha blended. The subDivisionSize will determine the size of the piecewise affine texture mapped lines.
dest | The description of where the texture is drawn - can be used to issue a draw off screen. |
gradients | The gradients using in interpolation across the scan line. |
leftEdge | The left edge of the scan line. |
rightEdge | The right edge of the scan line. |
texture | The texture. |
absoluteRect | The containing rectangle in absolute coordinates. |
dirtyAreaAbsolute | The dirty area in absolute coordinates. |
renderVariant | The render variant - includes the algorithm and the pixel format. |
alpha | The alpha. |
subDivisionSize | The size of the subdivisions of the scan line. A value of 1 will give a completely perspective correct texture mapped scan line. A large value will give an affine texture mapped scan line. |
Reimplemented by: touchgfx::LCD1bpp::drawTextureMapScanLine
getTextureMapperDrawScanLine
virtual DrawTextureMapScanLineBase * getTextureMapperDrawScanLine | ( | const TextureSurface & | texture , | ||
RenderingVariant | renderVariant , | ||||
uint8_t | alpha | ||||
) |
Gets pointer to object that can draw a scan line which allows for highly specialized and optimized implementation.
texture | The texture Surface. |
renderVariant | The render variant. |
alpha | The global alpha. |
Null if it fails, else the pointer to the texture mapper draw scan line object.
Reimplemented by: touchgfx::LCD16bpp::getTextureMapperDrawScanLine, touchgfx::LCD16bppSerialFlash::getTextureMapperDrawScanLine, touchgfx::LCD24bpp::getTextureMapperDrawScanLine, touchgfx::LCD2bpp::getTextureMapperDrawScanLine, touchgfx::LCD32bpp::getTextureMapperDrawScanLine, touchgfx::LCD32bpp_XRGB8888::getTextureMapperDrawScanLine, touchgfx::LCD4bpp::getTextureMapperDrawScanLine, touchgfx::LCD8bpp_ABGR2222::getTextureMapperDrawScanLine, touchgfx::LCD8bpp_ARGB2222::getTextureMapperDrawScanLine, touchgfx::LCD8bpp_BGRA2222::getTextureMapperDrawScanLine, touchgfx::LCD8bpp_RGBA2222::getTextureMapperDrawScanLine
getAlphaFromA4
static FORCE_INLINE_FUNCTION uint8_t getAlphaFromA4 | ( | const uint16_t * | data , | ||
uint32_t | offset | ||||
) |
Gets alpha from A4 image at given offset.
The value is scaled up from range 0-15 to 0- 255.
data | A pointer to the start of the A4 data. |
offset | The offset into the A4 image. |
The alpha from A4 (0-255).
getNumLines
static uint16_t getNumLines | ( | TextProvider & | textProvider , | ||
WideTextAction | wideTextAction , | ||||
TextDirection | textDirection , | ||||
const Font * | font , | ||||
int16_t | width | ||||
) |
Gets number of lines for a given text taking word wrap into consideration.
The font and width are required to find the number of lines in case word wrap is true.
textProvider | The text provider. |
wideTextAction | The wide text action in case lines are longer than the width of the text area. |
textDirection | The text direction (LTR or RTL). |
font | The font. |
width | The width. |
The number lines.
realX
static int realX | ( | const Rect & | widgetArea , | ||
int16_t | x , | ||||
int16_t | y , | ||||
TextRotation | rotation | ||||
) |
Find the real, absolute x coordinate of a point inside a widget with regards to rotation.
widgetArea | The widget containing the point. |
x | The x coordinate. |
y | The y coordinate. |
rotation | Rotation to perform. |
The absolute x coordinate after applying appropriate rotation.
realY
static int realY | ( | const Rect & | widgetArea , | ||
int16_t | x , | ||||
int16_t | y , | ||||
TextRotation | rotation | ||||
) |
Find the real, absolute y coordinate of a point inside a widget with regards to rotation.
widgetArea | The widget containing the point. |
x | The x coordinate. |
y | The y coordinate. |
rotation | Rotation to perform. |
The absolute y coordinate after applying appropriate rotation.
rotateRect
static void rotateRect | ( | Rect & | rect , | ||
const Rect & | canvas , | ||||
const TextRotation | rotation | ||||
) |
Rotate a rectangle inside another rectangle.
rect | The rectangle to rotate. |
canvas | The rectangle containing the rect to rotate. |
rotation | Rotation to perform on rect. |
stringWidth
static uint16_t stringWidth | ( | TextProvider & | textProvider , | ||
const Font & | font , | ||||
const int | numChars , | ||||
TextDirection | textDirection | ||||
) |
Find string width of the given number of ligatures read from the given TextProvider.
After the introduction of Arabic, Thai, Hindi and other languages, ligatures are counted instead of characters. For Latin languages, number of characters equal number of ligatures.
textProvider | The text provider. |
font | The font. |
numChars | Number of characters (ligatures). |
textDirection | The text direction. |
An int16_t.
Protected Attributes Documentation
defaultColor
colortype defaultColor
Default Color to use when displaying transparency-only elements, e.g. A4 bitmaps.
newLine
const uint16_t newLine = 10
NewLine value.