MPLABĀ® Harmony Graphics Suite  GFX v3.13.0
Legato API Documentation
legato_image.h File Reference

Image functions and defintions. More...

Include dependency graph for legato_image.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  leImageMap
 This struct represents an image map. More...
 
struct  leImage
 
struct  leImageDecoder
 This struct represents an image decoder. More...
 

Macros

#define LE_IMAGE_FORMAT_COUNT   (LE_IMAGE_FORMAT_RLE + 1)
 

Typedefs

typedef struct lePalette lePalette
 
typedef enum leImageFormat leImageFormat
 This enum represents an image format. More...
 
typedef enum leImageFlags leImageFlags
 This enum represents image flags. More...
 
typedef enum leImageFilterMode leImageFilterMode
 This enum represents image filter modes. More...
 
typedef struct leImageMap leImageMap
 This struct represents an image map. More...
 
typedef struct leImage leImage
 
typedef struct leImageDecoder leImageDecoder
 This struct represents an image decoder. More...
 

Enumerations

enum  leImageFormat {
  LE_IMAGE_FORMAT_RAW = 0, LE_IMAGE_FORMAT_RLE, LE_IMAGE_FORMAT_JPEG, LE_IMAGE_FORMAT_PNG,
  LE_IMAGE_FORMAT_MONO
}
 This enum represents an image format. More...
 
enum  leImageFlags {
  LE_IMAGE_USE_MASK_COLOR = 1 << 0, LE_IMAGE_USE_MASK_MAP = 1 << 1, LE_IMAGE_USE_ALPHA_MAP = 1 << 2, LE_IMAGE_INTERNAL_ALLOC = 1 << 3,
  LE_IMAGE_DIRECT_BLIT = 1 << 4
}
 This enum represents image flags. More...
 
enum  leImageFilterMode { LE_IMAGEFILTER_NONE, LE_IMAGEFILTER_NEAREST_NEIGHBOR, LE_IMAGEFILTER_BILINEAR }
 This enum represents image filter modes. More...
 

Functions

leResult leImage_Create (leImage *img, uint32_t width, uint32_t height, leColorMode mode, void *data, uint32_t locationID)
 Create an image. More...
 
leImageleImage_Allocate (uint32_t width, uint32_t height, leColorMode mode)
 Allocate an image buffer. More...
 
leResult leImage_Free (leImage *img)
 Free image buffer. More...
 
void leImage_InitDecoders (void)
 Get Event Count. More...
 
leResult leImage_Draw (const leImage *img, const leRect *sourceRect, int32_t x, int32_t y, uint32_t a)
 Draw an Image. More...
 
leResult leImage_Resize (const leImage *src, const leRect *sourceRect, leImageFilterMode mode, uint32_t sizeX, uint32_t sizeY, leImage *target)
 Resize image. More...
 
leResult leImage_ResizeDraw (const leImage *src, const leRect *sourceRect, leImageFilterMode mode, uint32_t sizeX, uint32_t sizeY, int32_t x, int32_t y, uint32_t a)
 Resize draw image. More...
 
leResult leImage_Copy (const leImage *src, const leRect *sourceRect, int32_t x, int32_t y, leImage *dst)
 Copy image. More...
 
leResult leImage_Render (const leImage *src, const leRect *sourceRect, int32_t x, int32_t y, leBool ignoreMask, leBool ignoreAlpha, leImage *dst)
 Render image. More...
 
leResult leImage_Rotate (const leImage *src, const leRect *sourceRect, leImageFilterMode mode, int32_t angle, leImage **dst, leBool alloc)
 Rotate image. More...
 
leResult leImage_RotateDraw (const leImage *src, const leRect *sourceRect, leImageFilterMode mode, int32_t angle, int32_t x, int32_t y, uint32_t a)
 Rotate draw image. More...
 
void leProcessImage (leImage *img, size_t addr, leColorMode mode)
 Process an image to another location. More...
 

Detailed Description

Image functions and defintions.

Image drawing at specified coordinates.

Typedef Documentation

◆ leImageDecoder

This struct represents an image decoder.

Structure defining a general image decoder object. Specific decoders will implement this in their own way.

◆ leImageFilterMode

This enum represents image filter modes.

Image filter modes are used to list supported image filters.

◆ leImageFlags

typedef enum leImageFlags leImageFlags

This enum represents image flags.

Image flags are used to describe an image asset.

◆ leImageFormat

This enum represents an image format.

Image format is used to list supported image encodings.

◆ leImageMap

typedef struct leImageMap leImageMap

This struct represents an image map.

An image map is used to describe an image map buffer.

Enumeration Type Documentation

◆ leImageFilterMode

This enum represents image filter modes.

Image filter modes are used to list supported image filters.

◆ leImageFlags

This enum represents image flags.

Image flags are used to describe an image asset.

◆ leImageFormat

This enum represents an image format.

Image format is used to list supported image encodings.

Function Documentation

◆ leImage_Allocate()

leImage* leImage_Allocate ( uint32_t  width,
uint32_t  height,
leColorMode  mode 
)

Allocate an image buffer.

Dynamically allocates an image buffer in local memory using width and height color mode mode.

uint32_t width;
uint32_t height;
Parameters
widththe width of the image in pixels
heightthe height of the image in pixels
modethe color mode of the image
Returns
a valid image or null if there wasn't enough memory for the allocation

◆ leImage_Copy()

leResult leImage_Copy ( const leImage src,
const leRect sourceRect,
int32_t  x,
int32_t  y,
leImage dst 
)

Copy image.

Copies img bounded by srcRect to location x and y.

leImage* src;
leRect* sourceRect;
int32_t x;
int32_t y;
leImage* dst;
leResult res = leImage_Copy(src, sourceRect, x, y, dst);
Parameters
srcpointer to source image asset to draw
sourceRectthe source rectangle of the image to decode
xthe x position
ythe y position
dstthe destination image to fill
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leImage_Create()

leResult leImage_Create ( leImage img,
uint32_t  width,
uint32_t  height,
leColorMode  mode,
void *  data,
uint32_t  locationID 
)

Create an image.

Creates an image img given width, height, and mode. The image is located at data with locationID.

Parameters
imgthe image object to initialize
widththe width of the image
heightthe height of the image
modethe color mode of the image
datathe data address of the image
locationIDthe location ID of the image
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.
Here is the caller graph for this function:

◆ leImage_Draw()

leResult leImage_Draw ( const leImage img,
const leRect sourceRect,
int32_t  x,
int32_t  y,
uint32_t  a 
)

Draw an Image.

Draws an image img bounded by sourceRect to location x and y.

leImage * fnptr;
Parameters
imgis the image to draw.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leImage_Free()

leResult leImage_Free ( leImage img)

Free image buffer.

Frees an image buffer img.

Remarks
Buffer must be allocated using leImage_Allocate.
leImage* img;
Parameters
imgthe image to free
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leImage_InitDecoders()

void leImage_InitDecoders ( void  )

Get Event Count.

Returns the number of events listed in the current context.

uint32_t cnt = leEvent_GetCount();
Parameters
void.
Returns
number of events.

◆ leImage_Render()

leResult leImage_Render ( const leImage src,
const leRect sourceRect,
int32_t  x,
int32_t  y,
leBool  ignoreMask,
leBool  ignoreAlpha,
leImage dst 
)

Render image.

Copies img bounded by srcRect to location x and y. The flag ignoreMask determines if the masking color should be performed. The flag ignoreAlpha determines if the alpha blending is performed.

leImage * src;
Parameters
srcis the image to render.
sourceRectthe source rectangle
xthe x position
ythe y position
ignoreMaskset to true to skip the mask stage for the source image
ignoreAlphathe destination image to fill
dstset to true to skip the blend stage for the source image
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.
Here is the caller graph for this function:

◆ leImage_Resize()

leResult leImage_Resize ( const leImage src,
const leRect sourceRect,
leImageFilterMode  mode,
uint32_t  sizeX,
uint32_t  sizeY,
leImage target 
)

Resize image.

Resizes the source image src to destination image dst to location x and y. using the specified filter mode.

leImage * src;
Parameters
srcis the image to resize.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leImage_ResizeDraw()

leResult leImage_ResizeDraw ( const leImage src,
const leRect sourceRect,
leImageFilterMode  mode,
uint32_t  sizeX,
uint32_t  sizeY,
int32_t  x,
int32_t  y,
uint32_t  a 
)

Resize draw image.

Resizes the source image src to destination image dst to location x and y. using the specified filter mode.

leImage * src;
leResult res = fnptr->resizeDraw(src, sourceRect, mode, sizeX, sizeY, x, y, a);
Parameters
srcis the image to resize.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leImage_Rotate()

leResult leImage_Rotate ( const leImage src,
const leRect sourceRect,
leImageFilterMode  mode,
int32_t  angle,
leImage **  dst,
leBool  alloc 
)

Rotate image.

Rotate image src bounded by srcRect by angle degress. The resulting image is dst The result image is automatically allocated and should be freed by the caller.

leImage * fnptr;
Parameters
srcis the image to render.
sourceRectthe source rectangle
modethe the filter mode
anglethe angle to rotate by (positive is counter clockwise)
dstthe destination image to fill
alloctrue if the decoder should automatically allocate the destination image
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leImage_RotateDraw()

leResult leImage_RotateDraw ( const leImage src,
const leRect sourceRect,
leImageFilterMode  mode,
int32_t  angle,
int32_t  x,
int32_t  y,
uint32_t  a 
)

Rotate draw image.

Rotate image src bounded by srcRect around origin at angle degress. The resulting image is dst.

Parameters
srcis the image to render.
sourceRectthe source rectangle
angleset to true to skip the mask stage for the source image
xthe destination image to fill
yis the image to resize.
athe alpha value to use
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leProcessImage()

void leProcessImage ( leImage img,
size_t  addr,
leColorMode  mode 
)

Process an image to another location.

Processes an image from one location (typically an external source) to an internally accessible memory address. The source image img will be uncompressed and rendered in a raw format to the address addr using the color mode mode. This operation is typically used to transform an image into a GPU-compatible state.

leImage* img;
uint32_t addr = 0xA0000000;
leColorMode mode = LE_COLOR_MODE_RGBA8888;
leProcessImage(img, addr, mode);
Parameters
imgthe source image to process.
addrthe address of the location for the new image data
modethe new color mode of the image
Here is the call graph for this function: