주요 내용으로 건너뛰기

PainterGRAY2Bitmap

touchgfx/widgets/canvas/PainterGRAY2Bitmap.hpp

PainterGRAY2Bitmap will take the color for a given point in the shape from a bitmap. Please be aware, the the bitmap is used by the CanvasWidgetRenderer (not Shape), so any rotation you might specify for a CanvasWidget (e.g. Shape) is not applied to the bitmap as CWR is not aware of this rotation.

See: AbstractPainter

Inherits from: AbstractPainterGRAY2, AbstractPainterBitmap, AbstractPainter

Public Functions

virtual voidpaint(uint8_t * destination, int16_t offset, int16_t widgetX, int16_t widgetY, int16_t count, uint8_t alpha) const
Paints a streak of pixels (all with the same alpha) in the framebuffer.
PainterGRAY2Bitmap(const Bitmap & bmp =Bitmap(BITMAP_INVALID))
Constructor.
virtual voidsetBitmap(const Bitmap & bmp)
Sets a bitmap to be used when drawing the CanvasWidget.
virtual boolsetup(const Rect & widgetRect) const
This function is called before any actual paint operation is started.

Protected Attributes

const uint8_t *bitmapExtraData
Pointer to the bitmap extra data.

Additional inherited members

Public Functions inherited from AbstractPainterGRAY2

Public Functions inherited from AbstractPainterBitmap

AbstractPainterBitmap(const Bitmap & bmp =Bitmap(BITMAP_INVALID))
Constructor.
BitmapgetBitmap() const
Gets the bitmap previously set using setBitmap().
voidgetOffset(int16_t & x, int16_t & y)
Gets the bitmap offset previously set using setOffset().
boolgetTiled() const
Gets the tiled setting, previously set using setTiled().
virtual voidsetOffset(int16_t x, int16_t y)
Sets an offset for the bitmap used.
virtual voidsetTiled(bool tiled)
Instruct the painter to tile the bitmap specified.
virtual ~AbstractPainterBitmap()
Destructor.

Protected Functions inherited from AbstractPainterBitmap

booladjustBitmapXY(int16_t & bitmapX, int16_t & bitmapY, int16_t & offset, int16_t & count) const
Adjust bitmap x and y.
voidupdateBitmapOffsets(int16_t widgetWidth) const
Updates the bitmap offsets described by widgetWidth, these offset are used by bitmap painters adjust the coordinate position inside the widget.

Protected Attributes inherited from AbstractPainterBitmap

Bitmapbitmap
The bitmap to be used when painting.
const uint8_t *bitmapData
Pointer to the bitmap data.
Bitmap::BitmapFormatbitmapFormat
Copy of the bitmap format (for speed reasons)
RectbitmapRect
Bitmap rectangle translated to framebuffer coordinates.
boolisTiled
True if bitmap should be tiled, false if not.
int16_txOffset
The x offset of the bitmap.
int16_tyOffset
The y offset of the bitmap.

Public Functions inherited from AbstractPainter

AbstractPainter()
Initializes a new instance of the AbstractPainter class.
voidframebufferToDisplay(int16_t & widgetX, int16_t & widgetY) const
Convert Framebuffer widget coordinates to display widget coordinates.
virtual HAL::RenderingMethodgetRenderingMethod() const
Return the applicable rendering method of the painter.
virtual voidtearDown() const
This function is called after all paint operation have finished.
virtual ~AbstractPainter()
Finalizes an instance of the AbstractPainter class.

Protected Functions inherited from AbstractPainter

FORCE_INLINE_FUNCTION boolcompatibleFramebuffer(Bitmap::BitmapFormat format)
Helper function to check if the provided bitmap format matches the current framebuffer format.

Protected Attributes inherited from AbstractPainter

int16_twidgetWidth
The width of the widget on screen, used by framebufferToDisplay()

Public Functions Documentation

paint

virtual void paint(uint8_t *destination ,const
int16_toffset ,const
int16_twidgetX ,const
int16_twidgetY ,const
int16_tcount ,const
uint8_talphaconst
)const

Paints a streak of pixels (all with the same alpha) in the framebuffer.

The first pixel to paint is at 'offset' relative to 'destination' (to be able to support 1bpp, 2bpp and 4bpp). The first pixel to paint is at the given 'widgetX', 'widgetY' coordinate. The number of pixels to paint is 'count' and the alpha to apply is 'alpha'.

Note that the widgetX, widgetY is relative to the widget in the framebuffer, not the display. To convert the coordinate to display widget coordinates, use framebufferToDisplay().

Parameters:
destinationIf non-null, the pointer.
offsetThe offset to add to the destination.
widgetXThe widget x coordinate.
widgetYThe widget y coordinate.
countNumber of pixels.
alphaThe alpha of the pixels.
See also:

Reimplements: touchgfx::AbstractPainter::paint

PainterGRAY2Bitmap

PainterGRAY2Bitmap(const Bitmap &bmp =Bitmap(BITMAP_INVALID))

Constructor.

Parameters:
bmp(Optional) The bitmap to use in the painter.

setBitmap

virtual void setBitmap(const Bitmap &bmp)

Sets a bitmap to be used when drawing the CanvasWidget.

Parameters:
bmpThe bitmap.

Reimplements: touchgfx::AbstractPainterBitmap::setBitmap

setup

virtual bool setup(const Rect &widgetRect)

This function is called before any actual paint operation is started.

This allows the painter to initialize variables and optional dma queues. This happens before the first scan line segment is being drawn. If the painter is unable to draw, e.g. no bitmap assigned to a bitmap painter, 'false' should be returned.

Parameters:
widgetRectThe widget rectangle.
Returns:

True if the painter is ready to paint, false otherwise.

See also:

Reimplements: touchgfx::AbstractPainter::setup

Protected Attributes Documentation

bitmapExtraData

const uint8_t * bitmapExtraData

Pointer to the bitmap extra data.