LCDDMA2D3_CMDList
platform/driver/lcd/LCDDMA2D3_CMDList.hpp
This class contains the various low-level drawing routines for drawing bitmaps, texts and rectangles in a 16/24/32 bit framebuffer using DMA2DV3 command lists. The LCD_TYPE template argument is the corresponding "normal" LCD class name: LCD16bpp, LCD24bpp, LCD32bpp. The FORMAT argument is values from DMA2DV3_ColorMode. Must be in the range [0:2]. The BYTES_PR_PIXEL is 2/3/4 correspondingly.
See: LCD
Note: All coordinates are expected to be in absolute coordinates!
Inherits from: LCD_TYPE
Public Functions
void | blitCopy(const uint16_t * sourceData, const Rect & source, const Rect & blitRect, uint8_t alpha, bool ) |
Blits (directly copies) a block of data to the framebuffer, performing alpha blending as specified. | |
void | blitCopy(const uint8_t * sourceData, Bitmap::BitmapFormat sourceFormat, const Rect & source, const Rect & blitRect, uint8_t alpha, bool ) |
Blits (directly copies) a block of data to the framebuffer, performing alpha blending as specified. | |
void | copyAreaFromTFTToClientBuffer(const Rect & region) |
Copies part of the displayed framebuffer to current framebuffer. | |
uint16_t * | copyFrameBufferRegionToMemory(const Rect & visRegion, const Rect & absRegion, const BitmapId bitmapId) |
Copies part of the framebuffer to the data section of a bitmap. | |
Rect | copyFrameBufferRegionToMemory(const Rect & visRegion, const Rect & absRegion, uint8_t * dst, int16_t dstWidth, int16_t dstHeight) |
Copies part of the framebuffer to memory. | |
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) |
Private version of draw-glyph with explicit destination buffer pointer argument. | |
void | drawPartialBitmap(const Bitmap & bitmap, int16_t x, int16_t y, const Rect & rect, uint8_t alpha =255, bool useOptimized =true) |
Draws all (or a part) of a bitmap. | |
void | drawScaledBitmap(const Bitmap & bitmap, const Rect & blitRect, const Rect & invalidatedArea, RenderingVariant renderVariant, uint8_t alpha =255) |
Draws all (or a part) of a bitmap, scaled to fit desired rect. | |
void | fillRect(const Rect & rect, colortype color, uint8_t alpha) |
Draws a filled rectangle in the framebuffer in the specified color and opacity. | |
LCDDMA2D3_CMDList() | |
Initializes members and super class. | |
void | setFrameBuffer(uint8_t *const buffer, uint32_t width) |
Sets the current framebuffer address and width. | |
Public Functions Documentation
blitCopy
void blitCopy | ( | const uint16_t * | sourceData , | ||
const Rect & | source , | ||||
const Rect & | blitRect , | ||||
uint8_t | alpha , | ||||
bool | |||||
) |
Blits (directly copies) a block of data to the framebuffer, performing alpha blending as specified.
sourceData | The source array pointer (points to the beginning of the data). The sourceData must be stored in the same format as the framebuffer. |
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. |
blitCopy
void blitCopy | ( | const uint8_t * | sourceData , | ||
Bitmap::BitmapFormat | sourceFormat , | ||||
const Rect & | source , | ||||
const Rect & | blitRect , | ||||
uint8_t | alpha , | ||||
bool | |||||
) |
Blits (directly copies) a block of data to the framebuffer, performing alpha blending as specified.
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. |
copyAreaFromTFTToClientBuffer
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.
copyFrameBufferRegionToMemory
uint16_t * copyFrameBufferRegionToMemory | ( | const Rect & | visRegion , | ||
const Rect & | absRegion , | ||||
const BitmapId | bitmapId | ||||
) |
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.
copyFrameBufferRegionToMemory
Rect copyFrameBufferRegionToMemory | ( | const Rect & | visRegion , | ||
const Rect & | absRegion , | ||||
uint8_t * | dst , | ||||
int16_t | dstWidth , | ||||
int16_t | dstHeight | ||||
) |
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.
drawGlyph
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 | ||||
) |
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. |
drawPartialBitmap
void drawPartialBitmap | ( | const Bitmap & | bitmap , | ||
int16_t | x , | ||||
int16_t | y , | ||||
const Rect & | rect , | ||||
uint8_t | alpha =255, | ||||
bool | useOptimized =true | ||||
) |
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) 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. |
drawScaledBitmap
void drawScaledBitmap | ( | const Bitmap & | bitmap , | ||
const Rect & | blitRect , | ||||
const Rect & | invalidatedArea , | ||||
RenderingVariant | renderVariant , | ||||
uint8_t | alpha =255 | ||||
) |
Draws all (or a part) of a bitmap, scaled to fit desired rect.
bitmap | The bitmap to draw. |
blitRect | The destination area to draw the bitmap in, in absolute coordinates. |
invalidatedArea | The subarea of the destination area that should be redrawn, in relative coordinates to the destination area. |
renderVariant | The rendering variant to use for the scaling operation. |
alpha | Optional alpha value ranging from 0=invisible to 255=solid. |
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. |
LCDDMA2D3_CMDList
Initializes members and super class.
setFrameBuffer
void setFrameBuffer | ( | uint8_t *const | buffer , | ||
uint32_t | width | ||||
) |
Sets the current framebuffer address and width.
buffer | Address of the framebuffer. |
width | Width of the framebuffer in pixels. |