Skip to main content

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

voidblitCopy(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.
voidblitCopy(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.
voidcopyAreaFromTFTToClientBuffer(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.
RectcopyFrameBufferRegionToMemory(const Rect & visRegion, const Rect & absRegion, uint8_t * dst, int16_t dstWidth, int16_t dstHeight)
Copies part of the framebuffer to memory.
voiddrawGlyph(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.
voiddrawPartialBitmap(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.
voiddrawScaledBitmap(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.
voidfillRect(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.
voidsetFrameBuffer(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_talpha ,
bool
)

Blits (directly copies) a block of data to the framebuffer, performing alpha blending as specified.

Parameters:
sourceDataThe source array pointer (points to the beginning of the data). The sourceData must be stored in the same format as the framebuffer.
sourceThe position and dimensions of the source. The x and y of this rect should both be 0.
blitRectA rectangle describing what region of the sourceData is to be copied to the framebuffer.
alphaThe alpha value to use for blending ranging from 0=invisible to 255=solid=no blending.

blitCopy

void blitCopy(const uint8_t *sourceData ,
Bitmap::BitmapFormatsourceFormat ,
const Rect &source ,
const Rect &blitRect ,
uint8_talpha ,
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.

Parameters:
sourceDataThe source array pointer (points to the beginning of the data). The sourceData must be stored in a format suitable for the selected display.
sourceFormatThe bitmap format used in the source data.
sourceThe position and dimensions of the source. The x and y of this rect should both be 0.
blitRectA rectangle describing what region of the sourceData is to be copied to the framebuffer.
alphaThe 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.

Parameters:
regionA 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 BitmapIdbitmapId
)

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.

Parameters:
visRegionThe visible region.
absRegionThe absolute region.
bitmapIdIdentifier for the bitmap.
Returns:

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.

See also:

copyFrameBufferRegionToMemory

Rect copyFrameBufferRegionToMemory(const Rect &visRegion ,
const Rect &absRegion ,
uint8_t *dst ,
int16_tdstWidth ,
int16_tdstHeight
)

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.

Parameters:
visRegionThe visible region.
absRegionThe absolute region.
dstDestination memory in same format as the framebuffer.
dstWidthWidth of the destination.
dstHeightHeight of the destination.
Returns:

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.

See also:

drawGlyph

void drawGlyph(uint16_t *wbuf16 ,
RectwidgetArea ,
int16_tx ,
int16_ty ,
uint16_toffsetX ,
uint16_toffsetY ,
const Rect &invalidatedArea ,
const GlyphNode *glyph ,
const uint8_t *glyphData ,
uint8_tbyteAlignRow ,
colortypecolor ,
uint8_tbitsPerPixel ,
uint8_talpha ,
TextRotationrotation
)

Private version of draw-glyph with explicit destination buffer pointer argument.

For all parameters (except the buffer pointer) see the public function drawString().

Parameters:
wbuf16The destination (frame) buffer to draw to.
widgetAreaThe canvas to draw the glyph inside.
xHorizontal offset to start drawing the glyph.
yVertical offset to start drawing the glyph.
offsetXHorizontal offset in the glyph to start drawing from.
offsetYVertical offset in the glyph to start drawing from.
invalidatedAreaThe area to draw inside.
glyphSpecifications of the glyph to draw.
glyphDataData containing the actual glyph (dense format)
byteAlignRowEach row of glyph data starts in a new byte.
colorThe color of the glyph.
bitsPerPixelBit depth of the glyph.
alphaThe transparency of the glyph.
rotationRotation to do before drawing the glyph.

drawPartialBitmap

void drawPartialBitmap(const Bitmap &bitmap ,
int16_tx ,
int16_ty ,
const Rect &rect ,
uint8_talpha =255,
booluseOptimized =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.

Parameters:
bitmapThe bitmap to draw.
xThe absolute x coordinate to place (0, 0) of the bitmap on the screen.
yThe absolute y coordinate to place (0, 0) of the bitmap on the screen.
rectA 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 ,
RenderingVariantrenderVariant ,
uint8_talpha =255
)

Draws all (or a part) of a bitmap, scaled to fit desired rect.

Parameters:
bitmapThe bitmap to draw.
blitRectThe destination area to draw the bitmap in, in absolute coordinates.
invalidatedAreaThe subarea of the destination area that should be redrawn, in relative coordinates to the destination area.
renderVariantThe rendering variant to use for the scaling operation.
alphaOptional alpha value ranging from 0=invisible to 255=solid.

fillRect

void fillRect(const Rect &rect ,
colortypecolor ,
uint8_talpha
)

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.

Parameters:
rectThe rectangle to draw in absolute display coordinates.
colorThe 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 *constbuffer ,
uint32_twidth
)

Sets the current framebuffer address and width.

Parameters:
bufferAddress of the framebuffer.
widthWidth of the framebuffer in pixels.