Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: GraphicsDisplay.h
- Revision:
- 152:a013ac0133e4
- Parent:
- 143:e872d65a710d
- Child:
- 153:8a85efb3eb71
--- a/GraphicsDisplay.h Sun Sep 24 02:09:57 2017 +0000
+++ b/GraphicsDisplay.h Mon Nov 06 01:41:55 2017 +0000
@@ -16,6 +16,7 @@
#include "Bitmap.h"
#include "TextDisplay.h"
#include "GraphicsDisplayJPEG.h"
+#include "GraphicsDisplayGIF.h"
/// The GraphicsDisplay class
///
@@ -455,6 +456,30 @@
RetCode_t RenderIconFile(loc_t x, loc_t y, const char *Name_ICO);
+ /// Render a GIF file on screen.
+ ///
+ /// This function reads a GIF file, and places it onscreen at the specified
+ /// coordinates.
+ ///
+ /// @param[in] x is the left edge of the on-screen coordinates.
+ /// @param[in] y is the top edge of the on-screen coordinates.
+ /// @param[in] Name_GIF is a pointer to the fully qualified filename.
+ /// @returns noerror, or a variety of error codes.
+ ///
+ RetCode_t RenderGIFFile(loc_t x, loc_t y, const char *Name_GIF);
+
+
+ /// GetGIFMetrics
+ ///
+ /// Get the GIF Image metrics.
+ ///
+ /// @param[out] imageDescriptor contains the image metrics on success.
+ /// @param[in] Name_GIF is the filename of the GIF file of interest.
+ /// @returns noerror, or a variety of error codes.
+ ///
+ RetCode_t GetGIFMetrics(gif_screen_descriptor_t * imageDescriptor, const char * Name_GIF);
+
+
/// prints one character at the specified coordinates.
///
/// This will print the character at the specified pixel coordinates.
@@ -530,6 +555,18 @@
///
RetCode_t _RenderBitmap(loc_t x, loc_t y, uint32_t fileOffset, FILE * Image);
+
+ /// Protected method to render a GIF given a file handle and
+ /// coordinates.
+ ///
+ /// @param[in] x is the horizontal pixel coordinate
+ /// @param[in] y is the vertical pixel coordinate
+ /// @param[in] Image is the filename stream already opened for the data.
+ /// @returns success or error code.
+ ///
+ RetCode_t _RenderGIF(loc_t x, loc_t y, FILE * fh);
+
+
private:
loc_t img_x; /// x position of a rendered jpg
@@ -583,6 +620,22 @@
JDEC * jd /* Pointer to the decompressor object */
);
+ gif_screen_descriptor_t screen_descriptor; // attributes for the whole screen
+ bool screen_descriptor_isvalid; // has been read
+ color_t * global_color_table;
+ int global_color_table_size;
+ color_t * local_color_table;
+ int local_color_table_size;
+ RetCode_t GetGIFHeader(FILE * fh);
+ bool hasGIFHeader(FILE * fh);
+ int process_gif_extension(FILE * fh);
+ RetCode_t process_gif_image_descriptor(FILE * fh, uint8_t ** uncompress_gifed_data, int width, int height);
+ int read_gif_sub_blocks(FILE * fh, unsigned char **data);
+ RetCode_t uncompress_gif(int code_length, const unsigned char *input, int input_length, unsigned char *out);
+ size_t read_filesystem_bytes(void * buffer, int numBytes, FILE * fh);
+ RetCode_t readGIFImageDescriptor(FILE * fh, gif_image_descriptor_t * gif_image_descriptor);
+ RetCode_t readColorTable(color_t * colorTable, int colorTableSize, FILE * fh);
+
protected:
/// Pure virtual method to write a boolean stream to the display.