Image functions - Ambercroft/TFT_eSPI GitHub Wiki

Image functions

XBM

drawXBitmap(uint16_t X0, uint16_t Y0, const uint8 * BITMAP, int16_t W, int16_t H, uint16_t FGCOLOUR, uint16_t BGCOLOUR);

Draw an image stored in an array on the TFT. XBM source format.

  • X0,Y0 >> Origin.
  • W, H >> Width and height of image.
  • BITMAP >> XBM source pointer.
  • FGCOLOUR >> Optional Foreground colour.
  • BGCOLOUR >> Optional background colour.
    Put in a format of the XBM format > in a file or example !!

BPM

drawBitmap(int16_t X0, int16_t Y0, const uint8_t *BITMAP, int16_t W, int16_t H, uint16_t FGCOLOUR, uint16_t BGCOLOUR);

Draw an image stored in an array on the TFT. BPM source format.

  • X0,Y0 >> Origin.
  • W, H >> Width and height of image.
  • BITMAP >> BPM source pointer.
  • FGCOLOUR >> Optional Foreground colour.
  • BGCOLOUR >> Optional background colour.
    Put in a format of the BPM format > in a file or example !!

Support functions

getSwapBytes(void);

Returns the swap byte order for colours.
Returns BOOL

setSwapBytes(BOOL SWAP);

Used by pushImage()

  • SWAP >> Change order of bytes for colours.

readRectRGB(int32_t X0, int32_t Y0, int32_t W, int32_t H, uint8_t *DATA);

Read RGB pixel colours from a defined area.
If W and H are 1, then 1 pixel is read, *DATA array size must be 3 bytes per pixel.
Data Size = W * H * 3
This will call readRect() if it is a 8 bit parallel interface.

  • X0,Y0 >> Origin.
  • W >> Width.
  • H >> Height.
  • *DATA >> Array to store the information.

readRect(int32_t X0, int32_t Y0, int32_t W, int32_t H, uint8_t *DATA);

Read 565 pixel colours from a defined area.
If W and H are 1, then 1 pixel is read, *DATA array size must be 3 bytes per pixel.
Data Size = W * H * 3

  • X0,Y0 >> Origin.
  • W >> Width.
  • H >> Height.
  • *DATA >> Array to store the information.

pushImage(int32_t X0, int32_t Y0, int32_t W, int32_t H, uint16_t *DATA);

Plot 16 bit colour sprite or image onto TFT.

  • X0,Y0 >> Origin.
  • W >> Width.
  • H >> Height.
  • *DATA >> Array of source of information.

pushRect(int32_t X0, int32_t Y0, int32_t W, int32_t H, uint16_t *DATA);

PLOT 565 pixel colours into a defined area.
This handles swapBytes then calls pushImage().

  • X0,Y0 >> Origin.
  • W >> Width.
  • H >> Height.
  • *DATA >> Array of source of information.

setPivot(int16_t X, int16_t Y);

Set the pivot point on the TFT.

  • X, Y >> Point of pivot.
    REF !! What routine(s) relies on pivot !!

getPivotX(void);

Get the X pivot point. Returns int16_t X point.
REF !! What routine(s) relies on pivot !!

getPivotY(void);

Get the Y pivot point. Returns int16_t Y point.
REF !! What routine(s) relies on pivot !!


SORT ME

Put function here if uncertain the position to be placed on page.