EmbeddedArtists AB
/
app_lcdboard_demo_picture
Example for the LPC4088 QSB Base Board
Image.h@0:83b8ee8e8d4b, 2014-01-08 (annotated)
- Committer:
- embeddedartists
- Date:
- Wed Jan 08 12:35:11 2014 +0000
- Revision:
- 0:83b8ee8e8d4b
First version (with temporary STACK fix)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 0:83b8ee8e8d4b | 1 | |
embeddedartists | 0:83b8ee8e8d4b | 2 | #ifndef IMAGE_H |
embeddedartists | 0:83b8ee8e8d4b | 3 | #define IMAGE_H |
embeddedartists | 0:83b8ee8e8d4b | 4 | |
embeddedartists | 0:83b8ee8e8d4b | 5 | class Image { |
embeddedartists | 0:83b8ee8e8d4b | 6 | public: |
embeddedartists | 0:83b8ee8e8d4b | 7 | |
embeddedartists | 0:83b8ee8e8d4b | 8 | enum Type { |
embeddedartists | 0:83b8ee8e8d4b | 9 | BMP = 0, |
embeddedartists | 0:83b8ee8e8d4b | 10 | PNG, |
embeddedartists | 0:83b8ee8e8d4b | 11 | UNKNOWN |
embeddedartists | 0:83b8ee8e8d4b | 12 | }; |
embeddedartists | 0:83b8ee8e8d4b | 13 | |
embeddedartists | 0:83b8ee8e8d4b | 14 | typedef struct { |
embeddedartists | 0:83b8ee8e8d4b | 15 | uint16_t* pixels; |
embeddedartists | 0:83b8ee8e8d4b | 16 | uint32_t width; |
embeddedartists | 0:83b8ee8e8d4b | 17 | uint32_t height; |
embeddedartists | 0:83b8ee8e8d4b | 18 | } ImageData_t; |
embeddedartists | 0:83b8ee8e8d4b | 19 | |
embeddedartists | 0:83b8ee8e8d4b | 20 | /** Decodes the specified image data |
embeddedartists | 0:83b8ee8e8d4b | 21 | * |
embeddedartists | 0:83b8ee8e8d4b | 22 | * Note that if this function returns a zero, indicating success, |
embeddedartists | 0:83b8ee8e8d4b | 23 | * the pixels member of the pDataOut structure must be |
embeddedartists | 0:83b8ee8e8d4b | 24 | * deallocated using lpc_free() when no longer needed. |
embeddedartists | 0:83b8ee8e8d4b | 25 | * |
embeddedartists | 0:83b8ee8e8d4b | 26 | * @param pDataIn the image data |
embeddedartists | 0:83b8ee8e8d4b | 27 | * @param sizeIn the number of bytes in the pDataIn array |
embeddedartists | 0:83b8ee8e8d4b | 28 | * @param pDataOut the decoded image (only valid if 0 is returned) |
embeddedartists | 0:83b8ee8e8d4b | 29 | * |
embeddedartists | 0:83b8ee8e8d4b | 30 | * @returns |
embeddedartists | 0:83b8ee8e8d4b | 31 | * 0 on success |
embeddedartists | 0:83b8ee8e8d4b | 32 | * 1 on failure |
embeddedartists | 0:83b8ee8e8d4b | 33 | */ |
embeddedartists | 0:83b8ee8e8d4b | 34 | static int decode(const unsigned char* pDataIn, unsigned int sizeIn, ImageData_t* pDataOut); |
embeddedartists | 0:83b8ee8e8d4b | 35 | |
embeddedartists | 0:83b8ee8e8d4b | 36 | private: |
embeddedartists | 0:83b8ee8e8d4b | 37 | |
embeddedartists | 0:83b8ee8e8d4b | 38 | /** No instance needed |
embeddedartists | 0:83b8ee8e8d4b | 39 | * |
embeddedartists | 0:83b8ee8e8d4b | 40 | */ |
embeddedartists | 0:83b8ee8e8d4b | 41 | Image(); |
embeddedartists | 0:83b8ee8e8d4b | 42 | |
embeddedartists | 0:83b8ee8e8d4b | 43 | static Type imageType(const unsigned char* pDataIn, unsigned int sizeIn); |
embeddedartists | 0:83b8ee8e8d4b | 44 | }; |
embeddedartists | 0:83b8ee8e8d4b | 45 | |
embeddedartists | 0:83b8ee8e8d4b | 46 | #endif |
embeddedartists | 0:83b8ee8e8d4b | 47 | |
embeddedartists | 0:83b8ee8e8d4b | 48 |