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