Library to control a Graphics TFT connected to 4-wire SPI - revised for the Raio RA8875 Display Controller.

Dependents:   FRDM_RA8875_mPaint RA8875_Demo RA8875_KeyPadDemo SignalGenerator ... more

Fork of SPI_TFT by Peter Drescher

See Components - RA8875 Based Display

Enhanced touch-screen support - where it previous supported both the Resistive Touch and Capacitive Touch based on the FT5206 Touch Controller, now it also has support for the GSL1680 Touch Controller.

Offline Help Manual (Windows chm)

/media/uploads/WiredHome/ra8875.zip.bin (download, rename to .zip and unzip)

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.