跳转到主要内容

LCD

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

structStringVisuals
The visual elements when writing a string.

Protected Classes

classDrawTextureMapScanLineBase
Base class for drawing scanline by the texture mapper.

Public Functions

virtual uint8_tbitDepth() const =0
Number of bits per pixel used by the display.
virtual voidblitCopy(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 voidblitCopy(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.
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 voiddrawPartialBitmap(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.
voiddrawString(Rect widgetArea, const Rect & invalidatedArea, const StringVisuals & stringVisuals, const Unicode::UnicodeChar * format, ... )
Draws the specified Unicode string.
virtual voiddrawTextureMapQuad(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 voiddrawTextureMapTriangle(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 voidfillBuffer(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 voidfillRect(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::BitmapFormatframebufferFormat() const =0
Framebuffer format used by the display.
virtual uint16_tframebufferStride() const =0
Framebuffer stride in bytes.
colortypegetDefaultColor() const
Gets default color previously set using setDefaultColor.
LCD()
Initializes a new instance of the LCD class.
virtual voidsetDefaultColor(colortype color)
Sets default color as used by alpha level only bitmap formats, e.g.
virtual boolsupportDynamicBitmapDrawing(const Bitmap::BitmapFormat format)
Check if LCD support dynamic bitmap drawing.
virtual ~LCD()
Finalizes an instance of the LCD class.
FORCE_INLINE_FUNCTION uint8_tdiv255(uint16_t num)
Approximates an integer division of a 16bit value by 255.
FORCE_INLINE_FUNCTION uint32_tdiv255g(uint32_t pixelxAlpha)
Divides the green component of pixelxAlpha by 255.
FORCE_INLINE_FUNCTION uint32_tdiv255rb(uint32_t pixelxAlpha)
Divides the red and blue components of pixelxAlpha by 255.

Protected Functions

virtual 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) =0
Private version of draw-glyph with explicit destination buffer pointer argument.
voiddrawStringLTR(const Rect & widgetArea, const Rect & invalidatedArea, const StringVisuals & visuals, const Unicode::UnicodeChar * format, va_list pArg)
Draws the specified Unicode string.
voiddrawStringRTL(const Rect & widgetArea, const Rect & invalidatedArea, const StringVisuals & visuals, const Unicode::UnicodeChar * format, va_list pArg)
Draws the specified Unicode string.
virtual voiddrawTextureMapScanLine(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_tgetAlphaFromA4(const uint16_t * data, uint32_t offset)
Gets alpha from A4 image at given offset.
uint16_tgetNumLines(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.
intrealX(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.
intrealY(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.
voidrotateRect(Rect & rect, const Rect & canvas, const TextRotation rotation)
Rotate a rectangle inside another rectangle.
uint16_tstringWidth(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

colortypedefaultColor
Default Color to use when displaying transparency-only elements, e.g. A4 bitmaps.
const uint16_tnewLine
NewLine value.

Public Functions Documentation

bitDepth

blitCopy

virtual void blitCopy(const uint16_t *sourceData ,=0
const Rect &source ,=0
const Rect &blitRect ,=0
uint8_talpha ,=0
boolhasTransparentPixels=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).

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.
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.
hasTransparentPixelsIf 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::BitmapFormatsourceFormat ,=0
const Rect &source ,=0
const Rect &blitRect ,=0
uint8_talpha ,=0
boolhasTransparentPixels=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.

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

copyFrameBufferRegionToMemory

uint16_t * copyFrameBufferRegionToMemory(const Rect &region ,
const BitmapIdbitmapId =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.

Parameters:
regionThe part of the framebuffer to copy.
bitmapId(Optional) The bitmap to store the data in. Default is to use Animation Storage.
Returns:

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.

See also:

copyFrameBufferRegionToMemory

virtual uint16_t * copyFrameBufferRegionToMemory(const Rect &visRegion ,=0
const Rect &absRegion ,=0
const BitmapIdbitmapId=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.

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:

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_tx ,=0
int16_ty ,=0
const Rect &rect ,=0
uint8_talpha =255,=0
booluseOptimized =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.

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) 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(RectwidgetArea ,
const Rect &invalidatedArea ,
const StringVisuals &stringVisuals ,
const Unicode::UnicodeChar *format ,
...
)

Draws the specified Unicode string.

Breaks line on newline.

Parameters:
widgetAreaThe area covered by the drawing widget in absolute coordinates.
invalidatedAreaThe (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.
stringVisualsThe string visuals (font, alignment, line space, color) with which to draw this string.
formatA 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 ,
RenderingVariantrenderVariant ,
uint8_talpha =255,
uint16_tsubDivisionSize =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.

Parameters:
destThe description of where the texture is drawn - can be used to issue a draw off screen.
verticesThe vertices of the quad.
textureThe texture.
absoluteRectThe containing rectangle in absolute coordinates.
dirtyAreaAbsoluteThe dirty area in absolute coordinates.
renderVariantThe 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 ,
RenderingVariantrenderVariant ,
uint8_talpha =255,
uint16_tsubDivisionSize =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.

Parameters:
destThe description of where the texture is drawn - can be used to issue a draw off screen.
verticesThe vertices of the triangle.
textureThe texture.
absoluteRectThe containing rectangle in absolute coordinates.
dirtyAreaAbsoluteThe dirty area in absolute coordinates.
renderVariantThe 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 *constdestination ,=0
uint16_tpixelStride ,=0
const Rect &rect ,=0
const colortypecolor ,=0
const uint8_talpha=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.

Parameters:
destinationThe start of the memory area to fill.
pixelStrideThe pixel stride, i.e. number of pixels in a row.
rectThe rectangle to fill absolute coordinates.
colorThe rectangle color.
alphaThe 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

virtual void fillRect(const Rect &rect ,=0
colortypecolor ,=0
uint8_talpha =255=0
)=0

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.
See also:

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

framebufferStride

getDefaultColor

colortype getDefaultColor()const

Gets default color previously set using setDefaultColor.

Returns:

The default color.

See also:

LCD

LCD()

Initializes a new instance of the LCD class.

setDefaultColor

virtual void setDefaultColor(colortypecolor)

Sets default color as used by alpha level only bitmap formats, e.g.

A4. The default color, if no color is set, is black.

Parameters:
colorThe color.
See also:

Reimplemented by: touchgfx::LCD4bpp::setDefaultColor

supportDynamicBitmapDrawing

Check if LCD support dynamic bitmap drawing.

Parameters:
formatThe dynamic bitmap format.
Returns:

true if dynamic bitmap drawing is supported, false otherwise.

Reimplemented by: touchgfx::LCD32bpp_XRGB8888::supportDynamicBitmapDrawing

~LCD

virtual ~LCD()

Finalizes an instance of the LCD class.

div255

static FORCE_INLINE_FUNCTION uint8_t div255(uint16_tnum)

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.

Parameters:
numThe numerator to divide by 255.
Returns:

The result of a division by 255.

div255g

static FORCE_INLINE_FUNCTION uint32_t div255g(uint32_tpixelxAlpha)

Divides the green component of pixelxAlpha by 255.

Parameters:
pixelxAlphaThe green component of a 32bit ARGB pixel multiplied by an alpha factor.
Returns:

pixelxAlpha with its green component divided by 255.

div255rb

static FORCE_INLINE_FUNCTION uint32_t div255rb(uint32_tpixelxAlpha)

Divides the red and blue components of pixelxAlpha by 255.

Parameters:
pixelxAlphaThe red and blue components of a 32bit ARGB pixel multiplied by an alpha factor.
Returns:

pixelxAlpha with its red and blue components divided by 255.

Protected Functions Documentation

drawGlyph

virtual void drawGlyph(uint16_t *wbuf16 ,=0
RectwidgetArea ,=0
int16_tx ,=0
int16_ty ,=0
uint16_toffsetX ,=0
uint16_toffsetY ,=0
const Rect &invalidatedArea ,=0
const GlyphNode *glyph ,=0
const uint8_t *glyphData ,=0
uint8_tbyteAlignRow ,=0
colortypecolor ,=0
uint8_tbitsPerPixel ,=0
uint8_talpha ,=0
TextRotationrotation=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().

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.

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

Draws the specified Unicode string.

Breaks line on newline. The string is assumed to contain only Latin characters written left-to-right.

Parameters:
widgetAreaThe area covered by the drawing widget in absolute coordinates.
invalidatedAreaThe (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.
visualsThe string visuals (font, alignment, line space, color) with which to draw this string.
formatA pointer to a null-terminated text string with optional additional wildcard arguments.
pArgVariable arguments providing additional information.
See also:

drawStringRTL

void drawStringRTL(const Rect &widgetArea ,
const Rect &invalidatedArea ,
const StringVisuals &visuals ,
const Unicode::UnicodeChar *format ,
va_listpArg
)

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.

Parameters:
widgetAreaThe area covered by the drawing widget in absolute coordinates.
invalidatedAreaThe (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.
visualsThe string visuals (font, alignment, line space, color) with which to draw this string.
formatA pointer to a null-terminated text string with optional additional wildcard arguments.
pArgVariable arguments providing additional information.
See also:

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 ,
RenderingVariantrenderVariant ,
uint8_talpha ,
uint16_tsubDivisionSize
)

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.

Parameters:
destThe description of where the texture is drawn - can be used to issue a draw off screen.
gradientsThe gradients using in interpolation across the scan line.
leftEdgeThe left edge of the scan line.
rightEdgeThe right edge of the scan line.
textureThe texture.
absoluteRectThe containing rectangle in absolute coordinates.
dirtyAreaAbsoluteThe dirty area in absolute coordinates.
renderVariantThe render variant - includes the algorithm and the pixel format.
alphaThe alpha.
subDivisionSizeThe 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

getAlphaFromA4

static FORCE_INLINE_FUNCTION uint8_t getAlphaFromA4(const uint16_t *data ,
uint32_toffset
)

Gets alpha from A4 image at given offset.

The value is scaled up from range 0-15 to 0- 255.

Parameters:
dataA pointer to the start of the A4 data.
offsetThe offset into the A4 image.
Returns:

The alpha from A4 (0-255).

getNumLines

static uint16_t getNumLines(TextProvider &textProvider ,
WideTextActionwideTextAction ,
TextDirectiontextDirection ,
const Font *font ,
int16_twidth
)

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.

Parameters:
textProviderThe text provider.
wideTextActionThe wide text action in case lines are longer than the width of the text area.
textDirectionThe text direction (LTR or RTL).
fontThe font.
widthThe width.
Returns:

The number lines.

realX

static int realX(const Rect &widgetArea ,
int16_tx ,
int16_ty ,
TextRotationrotation
)

Find the real, absolute x coordinate of a point inside a widget with regards to rotation.

Parameters:
widgetAreaThe widget containing the point.
xThe x coordinate.
yThe y coordinate.
rotationRotation to perform.
Returns:

The absolute x coordinate after applying appropriate rotation.

realY

static int realY(const Rect &widgetArea ,
int16_tx ,
int16_ty ,
TextRotationrotation
)

Find the real, absolute y coordinate of a point inside a widget with regards to rotation.

Parameters:
widgetAreaThe widget containing the point.
xThe x coordinate.
yThe y coordinate.
rotationRotation to perform.
Returns:

The absolute y coordinate after applying appropriate rotation.

rotateRect

static void rotateRect(Rect &rect ,
const Rect &canvas ,
const TextRotationrotation
)

Rotate a rectangle inside another rectangle.

Parameters:
rectThe rectangle to rotate.
canvasThe rectangle containing the rect to rotate.
rotationRotation to perform on rect.

stringWidth

static uint16_t stringWidth(TextProvider &textProvider ,
const Font &font ,
const intnumChars ,
TextDirectiontextDirection
)

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.

Parameters:
textProviderThe text provider.
fontThe font.
numCharsNumber of characters (ligatures).
textDirectionThe text direction.
Returns:

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.