A basic graphics package for the LPC4088 Display Module.

Dependents:   lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI lpc4088_displaymodule_fs_aid ... more

Fork of DMBasicGUI by EmbeddedArtists AB

Embed: (wiki syntax)

« Back to documentation index

<title>Image Class Reference</title>

Image Class Reference

Image example. More...

#include <Image.h>

Static Public Member Functions

static int decode (const unsigned char *pDataIn, unsigned int sizeIn, Resolution res, ImageData_t *pDataOut)
 Decodes the specified image data.
static int decode (const char *filename, Resolution res, ImageData_t *pDataOut, Mutex *pLock=NULL)
 Reads the specified file and decodes the image data.
static int decode (Resource *res, Resolution resolution, ImageData_t *pDataOut, Mutex *pLock=NULL)
 Decodes the specified image resource.

Detailed Description

Image example.

 #include "mbed.h"
 #include "Image.h"

 const unsigned char cube_image1[] = { 137,80,78,71, ... };
 int cube_image1_sz = sizeof(cube_image1);

 int main(void) {
    // initialize the display
    ...

    // decode an image from an array
    Image::ImageData_t img;
    if (Image::decode(cube_image1, cube_image1_sz, &img) == 0) {
         // draw on display using img.pixels, img.width and img.height
         ...
         free(img.pixels);
    }

    // decode an image from a file
    if (Image::decode("/ram/image.png", &img) == 0) {
         // draw on display using img.pixels, img.width and img.height
         ...
         free(img.pixels);
    }
 }

Definition at line 56 of file Image.h.


Member Function Documentation

int decode ( const unsigned char *  pDataIn,
unsigned int  sizeIn,
Resolution  res,
ImageData_t *  pDataOut 
) [static]

Decodes the specified image data.

Note that if this function returns a zero, indicating success, the pixels member of the pDataOut structure must be deallocated using free() when no longer needed.

Parameters:
pDataInthe image data
sizeInthe number of bytes in the pDataIn array
resthe format of the display
pDataOutthe decoded image (only valid if 0 is returned)
Returns:
0 on success 1 on failure

Definition at line 31 of file Image.cpp.

int decode ( Resource res,
Resolution  resolution,
ImageData_t *  pDataOut,
Mutex *  pLock = NULL 
) [static]

Decodes the specified image resource.

Note that if this function returns a zero, indicating success, the pixels member of the pDataOut structure must be deallocated using free() when no longer needed.

The decoded image is cached in the Resource to prevent decoding the same resource over and over.

Parameters:
resthe resource to decode
resolutionthe format of the display
pDataOutthe decoded image (only valid if 0 is returned)
Returns:
0 on success 1 on failure

Definition at line 232 of file Image.cpp.

int decode ( const char *  filename,
Resolution  res,
ImageData_t *  pDataOut,
Mutex *  pLock = NULL 
) [static]

Reads the specified file and decodes the image data.

Note that if this function returns a zero, indicating success, the pixels member of the pDataOut structure must be deallocated using free() when no longer needed.

Parameters:
filenamethe file name and path
resthe format of the display
pDataOutthe decoded image (only valid if 0 is returned)
pLockan optional mutex to prevent multiple access to file operations
Returns:
0 on success 1 on failure

Definition at line 153 of file Image.cpp.