KSM edits to RA8875

Dependents:   Liz_Test_Code

Committer:
WiredHome
Date:
Tue Feb 26 19:52:57 2019 +0000
Revision:
167:8aa3fb2a5a31
Parent:
153:8a85efb3eb71
Documentation update to the script in the Fonts/FontMods.h file to improve the understanding of what it does.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
WiredHome 167:8aa3fb2a5a31 1 /// @page GraphicDisplay_Copyright GraphicDisplay Library Base Class
WiredHome 167:8aa3fb2a5a31 2 ///
WiredHome 167:8aa3fb2a5a31 3 /// mbed GraphicsDisplay Display Library Base Class
WiredHome 167:8aa3fb2a5a31 4 /// @copyright © 2007-2009 sford
WiredHome 167:8aa3fb2a5a31 5 /// Released under the MIT License: http://mbed.org/license/mit
WiredHome 167:8aa3fb2a5a31 6 ///
WiredHome 167:8aa3fb2a5a31 7 /// A library for providing a common base class for Graphics displays
WiredHome 167:8aa3fb2a5a31 8 /// To port a new display, derive from this class and implement
WiredHome 167:8aa3fb2a5a31 9 /// the constructor (setup the display), pixel (put a pixel
WiredHome 167:8aa3fb2a5a31 10 /// at a location), width and height functions. Everything else
WiredHome 167:8aa3fb2a5a31 11 /// (locate, printf, putc, cls, window, putp, fill, blit, blitbit)
WiredHome 167:8aa3fb2a5a31 12 /// will come for free. You can also provide a specialised implementation
WiredHome 167:8aa3fb2a5a31 13 /// of window and putp to speed up the results
WiredHome 167:8aa3fb2a5a31 14 ///
dreschpe 0:de9d1462a835 15 #ifndef MBED_GRAPHICSDISPLAY_H
dreschpe 0:de9d1462a835 16 #define MBED_GRAPHICSDISPLAY_H
WiredHome 32:0e4f2ae512e2 17 #include "Bitmap.h"
dreschpe 0:de9d1462a835 18 #include "TextDisplay.h"
WiredHome 115:c9862fd0c689 19 #include "GraphicsDisplayJPEG.h"
WiredHome 152:a013ac0133e4 20 #include "GraphicsDisplayGIF.h"
dreschpe 0:de9d1462a835 21
WiredHome 32:0e4f2ae512e2 22 /// The GraphicsDisplay class
WiredHome 32:0e4f2ae512e2 23 ///
WiredHome 32:0e4f2ae512e2 24 /// This graphics display class supports both graphics and text operations.
WiredHome 32:0e4f2ae512e2 25 /// Typically, a subclass is derived from this which has localizations to
WiredHome 32:0e4f2ae512e2 26 /// adapt to a specific hardware platform (e.g. a display controller chip),
WiredHome 32:0e4f2ae512e2 27 /// that overrides methods in here to either add more capability or perhaps
WiredHome 32:0e4f2ae512e2 28 /// to improve performance, by leveraging specific hardware capabilities.
WiredHome 32:0e4f2ae512e2 29 ///
WiredHome 32:0e4f2ae512e2 30 class GraphicsDisplay : public TextDisplay
WiredHome 32:0e4f2ae512e2 31 {
WiredHome 32:0e4f2ae512e2 32 public:
WiredHome 32:0e4f2ae512e2 33 /// The constructor
dreschpe 0:de9d1462a835 34 GraphicsDisplay(const char* name);
WiredHome 32:0e4f2ae512e2 35
WiredHome 104:8d1d3832a215 36 //~GraphicsDisplay();
WiredHome 104:8d1d3832a215 37
WiredHome 32:0e4f2ae512e2 38 /// Draw a pixel in the specified color.
WiredHome 32:0e4f2ae512e2 39 ///
WiredHome 32:0e4f2ae512e2 40 /// @note this method must be supported in the derived class.
WiredHome 32:0e4f2ae512e2 41 ///
WiredHome 76:c981284eb513 42 /// @param[in] x is the horizontal offset to this pixel.
WiredHome 76:c981284eb513 43 /// @param[in] y is the vertical offset to this pixel.
WiredHome 76:c981284eb513 44 /// @param[in] color defines the color for the pixel.
WiredHome 32:0e4f2ae512e2 45 /// @returns success/failure code. @see RetCode_t.
WiredHome 32:0e4f2ae512e2 46 ///
WiredHome 37:f19b7e7449dc 47 virtual RetCode_t pixel(loc_t x, loc_t y, color_t color) = 0;
WiredHome 32:0e4f2ae512e2 48
WiredHome 41:2956a0a221e5 49 /// Write a stream of pixels to the display.
WiredHome 41:2956a0a221e5 50 ///
WiredHome 41:2956a0a221e5 51 /// @note this method must be supported in the derived class.
WiredHome 41:2956a0a221e5 52 ///
WiredHome 76:c981284eb513 53 /// @param[in] p is a pointer to a color_t array to write.
WiredHome 76:c981284eb513 54 /// @param[in] count is the number of pixels to write.
WiredHome 76:c981284eb513 55 /// @param[in] x is the horizontal position on the display.
WiredHome 76:c981284eb513 56 /// @param[in] y is the vertical position on the display.
WiredHome 41:2956a0a221e5 57 /// @returns success/failure code. @see RetCode_t.
WiredHome 41:2956a0a221e5 58 ///
WiredHome 41:2956a0a221e5 59 virtual RetCode_t pixelStream(color_t * p, uint32_t count, loc_t x, loc_t y) = 0;
WiredHome 41:2956a0a221e5 60
WiredHome 41:2956a0a221e5 61 /// Get a pixel from the display.
WiredHome 41:2956a0a221e5 62 ///
WiredHome 41:2956a0a221e5 63 /// @note this method must be supported in the derived class.
WiredHome 41:2956a0a221e5 64 ///
WiredHome 76:c981284eb513 65 /// @param[in] x is the horizontal offset to this pixel.
WiredHome 76:c981284eb513 66 /// @param[in] y is the vertical offset to this pixel.
WiredHome 125:7a0b70f56550 67 /// @returns the pixel. @see color_t
WiredHome 41:2956a0a221e5 68 ///
WiredHome 41:2956a0a221e5 69 virtual color_t getPixel(loc_t x, loc_t y) = 0;
WiredHome 41:2956a0a221e5 70
WiredHome 41:2956a0a221e5 71 /// Get a stream of pixels from the display.
WiredHome 41:2956a0a221e5 72 ///
WiredHome 41:2956a0a221e5 73 /// @note this method must be supported in the derived class.
WiredHome 41:2956a0a221e5 74 ///
WiredHome 76:c981284eb513 75 /// @param[out] p is a pointer to a color_t array to accept the stream.
WiredHome 76:c981284eb513 76 /// @param[in] count is the number of pixels to read.
WiredHome 76:c981284eb513 77 /// @param[in] x is the horizontal offset to this pixel.
WiredHome 76:c981284eb513 78 /// @param[in] y is the vertical offset to this pixel.
WiredHome 41:2956a0a221e5 79 /// @returns success/failure code. @see RetCode_t.
WiredHome 41:2956a0a221e5 80 ///
WiredHome 41:2956a0a221e5 81 virtual RetCode_t getPixelStream(color_t * p, uint32_t count, loc_t x, loc_t y) = 0;
WiredHome 41:2956a0a221e5 82
WiredHome 32:0e4f2ae512e2 83 /// get the screen width in pixels
WiredHome 32:0e4f2ae512e2 84 ///
WiredHome 32:0e4f2ae512e2 85 /// @note this method must be supported in the derived class.
WiredHome 32:0e4f2ae512e2 86 ///
WiredHome 32:0e4f2ae512e2 87 /// @returns screen width in pixels.
WiredHome 32:0e4f2ae512e2 88 ///
WiredHome 32:0e4f2ae512e2 89 virtual uint16_t width() = 0;
WiredHome 32:0e4f2ae512e2 90
WiredHome 32:0e4f2ae512e2 91 /// get the screen height in pixels
WiredHome 32:0e4f2ae512e2 92 ///
WiredHome 32:0e4f2ae512e2 93 /// @note this method must be supported in the derived class.
WiredHome 32:0e4f2ae512e2 94 ///
WiredHome 32:0e4f2ae512e2 95 /// @returns screen height in pixels.
WiredHome 32:0e4f2ae512e2 96 ///
WiredHome 32:0e4f2ae512e2 97 virtual uint16_t height() = 0;
WiredHome 32:0e4f2ae512e2 98
WiredHome 32:0e4f2ae512e2 99 /// Prepare the controller to write binary data to the screen by positioning
WiredHome 32:0e4f2ae512e2 100 /// the memory cursor.
WiredHome 32:0e4f2ae512e2 101 ///
WiredHome 32:0e4f2ae512e2 102 /// @note this method must be supported in the derived class.
WiredHome 32:0e4f2ae512e2 103 ///
WiredHome 76:c981284eb513 104 /// @param[in] x is the horizontal position in pixels (from the left edge)
WiredHome 76:c981284eb513 105 /// @param[in] y is the vertical position in pixels (from the top edge)
WiredHome 32:0e4f2ae512e2 106 /// @returns success/failure code. @see RetCode_t.
WiredHome 32:0e4f2ae512e2 107 ///
WiredHome 37:f19b7e7449dc 108 virtual RetCode_t SetGraphicsCursor(loc_t x, loc_t y) = 0;
WiredHome 32:0e4f2ae512e2 109
WiredHome 136:224e03d5c31f 110
WiredHome 136:224e03d5c31f 111 /// Prepare the controller to write binary data to the screen by positioning
WiredHome 136:224e03d5c31f 112 /// the memory cursor.
WiredHome 136:224e03d5c31f 113 ///
WiredHome 136:224e03d5c31f 114 /// @param[in] p is the point representing the cursor position to set
WiredHome 167:8aa3fb2a5a31 115 /// @returns @ref RetCode_t value.
WiredHome 136:224e03d5c31f 116 ///
WiredHome 136:224e03d5c31f 117 virtual RetCode_t SetGraphicsCursor(point_t p) = 0;
WiredHome 136:224e03d5c31f 118
WiredHome 136:224e03d5c31f 119 /// Read the current graphics cursor position as a point.
WiredHome 136:224e03d5c31f 120 ///
WiredHome 136:224e03d5c31f 121 /// @returns the graphics cursor as a point.
WiredHome 136:224e03d5c31f 122 ///
WiredHome 136:224e03d5c31f 123 virtual point_t GetGraphicsCursor(void) = 0;
WiredHome 136:224e03d5c31f 124
WiredHome 41:2956a0a221e5 125 /// Prepare the controller to read binary data from the screen by positioning
WiredHome 41:2956a0a221e5 126 /// the memory read cursor.
WiredHome 41:2956a0a221e5 127 ///
WiredHome 76:c981284eb513 128 /// @param[in] x is the horizontal position in pixels (from the left edge)
WiredHome 76:c981284eb513 129 /// @param[in] y is the vertical position in pixels (from the top edge)
WiredHome 41:2956a0a221e5 130 /// @returns success/failure code. @see RetCode_t.
WiredHome 41:2956a0a221e5 131 ///
WiredHome 41:2956a0a221e5 132 virtual RetCode_t SetGraphicsCursorRead(loc_t x, loc_t y) = 0;
WiredHome 41:2956a0a221e5 133
WiredHome 32:0e4f2ae512e2 134 /// Draw a filled rectangle in the specified color
WiredHome 32:0e4f2ae512e2 135 ///
WiredHome 32:0e4f2ae512e2 136 /// @note As a side effect, this changes the current
WiredHome 32:0e4f2ae512e2 137 /// foreground color for subsequent operations.
WiredHome 32:0e4f2ae512e2 138 ///
WiredHome 32:0e4f2ae512e2 139 /// @note this method must be supported in the derived class.
WiredHome 32:0e4f2ae512e2 140 ///
WiredHome 76:c981284eb513 141 /// @param[in] x1 is the horizontal start of the line.
WiredHome 76:c981284eb513 142 /// @param[in] y1 is the vertical start of the line.
WiredHome 76:c981284eb513 143 /// @param[in] x2 is the horizontal end of the line.
WiredHome 76:c981284eb513 144 /// @param[in] y2 is the vertical end of the line.
WiredHome 76:c981284eb513 145 /// @param[in] color defines the foreground color.
WiredHome 76:c981284eb513 146 /// @param[in] fillit is optional to NOFILL the rectangle. default is FILL.
WiredHome 32:0e4f2ae512e2 147 /// @returns success/failure code. @see RetCode_t.
WiredHome 32:0e4f2ae512e2 148 ///
WiredHome 37:f19b7e7449dc 149 virtual RetCode_t fillrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2,
WiredHome 32:0e4f2ae512e2 150 color_t color, fill_t fillit = FILL) = 0;
WiredHome 32:0e4f2ae512e2 151
WiredHome 142:6e9bff59878a 152 /// Select the drawing layer for subsequent commands.
WiredHome 142:6e9bff59878a 153 ///
WiredHome 142:6e9bff59878a 154 /// If the screen configuration is 480 x 272, or if it is 800 x 480
WiredHome 142:6e9bff59878a 155 /// and 8-bit color, the the display supports two layers, which can
WiredHome 142:6e9bff59878a 156 /// be independently drawn on and shown. Additionally, complex
WiredHome 142:6e9bff59878a 157 /// operations involving both layers are permitted.
WiredHome 142:6e9bff59878a 158 ///
WiredHome 142:6e9bff59878a 159 /// @code
WiredHome 142:6e9bff59878a 160 /// //lcd.SetLayerMode(OnlyLayer0); // default is layer 0
WiredHome 142:6e9bff59878a 161 /// lcd.rect(400,130, 475,155,Brown);
WiredHome 142:6e9bff59878a 162 /// lcd.SelectDrawingLayer(1);
WiredHome 142:6e9bff59878a 163 /// lcd.circle(400,25, 25, BrightRed);
WiredHome 142:6e9bff59878a 164 /// wait(1);
WiredHome 142:6e9bff59878a 165 /// lcd.SetLayerMode(ShowLayer1);
WiredHome 142:6e9bff59878a 166 /// @endcode
WiredHome 142:6e9bff59878a 167 ///
WiredHome 142:6e9bff59878a 168 /// @attention The user manual refers to Layer 1 and Layer 2, however the
WiredHome 142:6e9bff59878a 169 /// actual register values are value 0 and 1. This API as well as
WiredHome 142:6e9bff59878a 170 /// others that reference the layers use the values 0 and 1 for
WiredHome 142:6e9bff59878a 171 /// cleaner iteration in the code.
WiredHome 142:6e9bff59878a 172 ///
WiredHome 142:6e9bff59878a 173 /// @param[in] layer is 0 or 1 to select the layer for subsequent
WiredHome 142:6e9bff59878a 174 /// commands.
WiredHome 143:e872d65a710d 175 /// @param[out] prevLayer is an optiona pointer to where the previous layer
WiredHome 143:e872d65a710d 176 /// will be written, making it a little easer to restore layers.
WiredHome 143:e872d65a710d 177 /// Writes 0 or 1 when the pointer is not NULL.
WiredHome 167:8aa3fb2a5a31 178 /// @returns @ref RetCode_t value.
WiredHome 142:6e9bff59878a 179 ///
WiredHome 143:e872d65a710d 180 virtual RetCode_t SelectDrawingLayer(uint16_t layer, uint16_t * prevLayer = NULL) = 0;
WiredHome 142:6e9bff59878a 181
WiredHome 142:6e9bff59878a 182
WiredHome 142:6e9bff59878a 183 /// Get the currently active drawing layer.
WiredHome 142:6e9bff59878a 184 ///
WiredHome 142:6e9bff59878a 185 /// This returns a value, 0 or 1, based on the screen configuration
WiredHome 142:6e9bff59878a 186 /// and the currently active drawing layer.
WiredHome 142:6e9bff59878a 187 ///
WiredHome 142:6e9bff59878a 188 /// @code
WiredHome 143:e872d65a710d 189 /// uint16_t prevLayer;
WiredHome 143:e872d65a710d 190 /// lcd.SelectDrawingLayer(x, &prevLayer);
WiredHome 142:6e9bff59878a 191 /// lcd.circle(400,25, 25, BrightRed);
WiredHome 142:6e9bff59878a 192 /// lcd.SelectDrawingLayer(prevLayer);
WiredHome 142:6e9bff59878a 193 /// @endcode
WiredHome 142:6e9bff59878a 194 ///
WiredHome 142:6e9bff59878a 195 /// @attention The user manual refers to Layer 1 and Layer 2, however the
WiredHome 142:6e9bff59878a 196 /// actual register values are value 0 and 1. This API as well as
WiredHome 142:6e9bff59878a 197 /// others that reference the layers use the values 0 and 1 for
WiredHome 142:6e9bff59878a 198 /// cleaner iteration in the code.
WiredHome 142:6e9bff59878a 199 ///
WiredHome 142:6e9bff59878a 200 /// @returns the current drawing layer; 0 or 1.
WiredHome 142:6e9bff59878a 201 ///
WiredHome 142:6e9bff59878a 202 virtual uint16_t GetDrawingLayer(void) = 0;
WiredHome 142:6e9bff59878a 203
WiredHome 125:7a0b70f56550 204 /// a function to write the command and data to the RA8875 chip.
WiredHome 125:7a0b70f56550 205 ///
WiredHome 125:7a0b70f56550 206 /// @param command is the RA8875 instruction to perform
WiredHome 125:7a0b70f56550 207 /// @param data is the optional data to the instruction.
WiredHome 125:7a0b70f56550 208 /// @returns success/failure code. @see RetCode_t.
WiredHome 125:7a0b70f56550 209 ///
WiredHome 32:0e4f2ae512e2 210 virtual RetCode_t WriteCommand(unsigned char command, unsigned int data = 0xFFFF) = 0;
WiredHome 125:7a0b70f56550 211
WiredHome 125:7a0b70f56550 212
WiredHome 125:7a0b70f56550 213 /// a function to write the data to the RA8875 chip.
WiredHome 125:7a0b70f56550 214 ///
WiredHome 125:7a0b70f56550 215 /// This is typically used after a command has been initiated, and where
WiredHome 125:7a0b70f56550 216 /// there may be a data stream to follow.
WiredHome 125:7a0b70f56550 217 ///
WiredHome 125:7a0b70f56550 218 /// @param data is the optional data to the instruction.
WiredHome 125:7a0b70f56550 219 /// @returns success/failure code. @see RetCode_t.
WiredHome 125:7a0b70f56550 220 ///
WiredHome 32:0e4f2ae512e2 221 virtual RetCode_t WriteData(unsigned char data) = 0;
WiredHome 32:0e4f2ae512e2 222
WiredHome 32:0e4f2ae512e2 223 /// Set the window, which controls where items are written to the screen.
WiredHome 32:0e4f2ae512e2 224 ///
WiredHome 32:0e4f2ae512e2 225 /// When something hits the window width, it wraps back to the left side
WiredHome 126:c91bd2e500b9 226 /// and down a row.
WiredHome 126:c91bd2e500b9 227 ///
WiredHome 126:c91bd2e500b9 228 /// @note If the initial write is outside the window, it will
WiredHome 126:c91bd2e500b9 229 /// be captured into the window when it crosses a boundary. It may
WiredHome 126:c91bd2e500b9 230 /// be appropriate to SetGraphicsCursor() to a point in the window.
WiredHome 32:0e4f2ae512e2 231 ///
WiredHome 111:efe436c43aba 232 /// @param[in] r is the rect_t rect to define the window.
WiredHome 111:efe436c43aba 233 /// @returns success/failure code. @see RetCode_t.
WiredHome 111:efe436c43aba 234 ///
WiredHome 111:efe436c43aba 235 virtual RetCode_t window(rect_t r);
WiredHome 111:efe436c43aba 236
WiredHome 111:efe436c43aba 237 /// Set the window, which controls where items are written to the screen.
WiredHome 111:efe436c43aba 238 ///
WiredHome 111:efe436c43aba 239 /// When something hits the window width, it wraps back to the left side
WiredHome 126:c91bd2e500b9 240 /// and down a row.
WiredHome 126:c91bd2e500b9 241 ///
WiredHome 126:c91bd2e500b9 242 /// @note If the initial write is outside the window, it will
WiredHome 126:c91bd2e500b9 243 /// be captured into the window when it crosses a boundary. It may
WiredHome 126:c91bd2e500b9 244 /// be appropriate to SetGraphicsCursor() to a point in the window.
WiredHome 111:efe436c43aba 245 ///
WiredHome 114:dbfb996bfbf3 246 /// @note if no parameters are provided, it restores the window to full screen.
WiredHome 114:dbfb996bfbf3 247 ///
WiredHome 76:c981284eb513 248 /// @param[in] x is the left edge in pixels.
WiredHome 76:c981284eb513 249 /// @param[in] y is the top edge in pixels.
WiredHome 76:c981284eb513 250 /// @param[in] w is the window width in pixels.
WiredHome 76:c981284eb513 251 /// @param[in] h is the window height in pixels.
WiredHome 32:0e4f2ae512e2 252 /// @returns success/failure code. @see RetCode_t.
WiredHome 32:0e4f2ae512e2 253 ///
WiredHome 114:dbfb996bfbf3 254 virtual RetCode_t window(loc_t x = 0, loc_t y = 0, dim_t w = (dim_t)-1, dim_t h = (dim_t)-1);
WiredHome 32:0e4f2ae512e2 255
WiredHome 111:efe436c43aba 256 /// method to set the window region to the full screen.
WiredHome 111:efe436c43aba 257 ///
WiredHome 111:efe436c43aba 258 /// This restores the 'window' to the full screen, so that
WiredHome 111:efe436c43aba 259 /// other operations (@see cls) would clear the whole screen.
WiredHome 111:efe436c43aba 260 ///
WiredHome 111:efe436c43aba 261 /// @returns success/failure code. @see RetCode_t.
WiredHome 111:efe436c43aba 262 ///
WiredHome 111:efe436c43aba 263 virtual RetCode_t WindowMax(void);
WiredHome 111:efe436c43aba 264
WiredHome 32:0e4f2ae512e2 265 /// Clear the screen.
WiredHome 32:0e4f2ae512e2 266 ///
WiredHome 32:0e4f2ae512e2 267 /// The behavior is to clear the whole screen.
WiredHome 32:0e4f2ae512e2 268 ///
WiredHome 76:c981284eb513 269 /// @param[in] layers is ignored, but supports maintaining the same
WiredHome 61:8f3153bf0baa 270 /// API for the graphics layer.
WiredHome 32:0e4f2ae512e2 271 /// @returns success/failure code. @see RetCode_t.
WiredHome 32:0e4f2ae512e2 272 ///
WiredHome 61:8f3153bf0baa 273 virtual RetCode_t cls(uint16_t layers = 0);
WiredHome 32:0e4f2ae512e2 274
WiredHome 32:0e4f2ae512e2 275 /// method to put a single color pixel to the screen.
WiredHome 32:0e4f2ae512e2 276 ///
WiredHome 32:0e4f2ae512e2 277 /// This method may be called as many times as necessary after
WiredHome 32:0e4f2ae512e2 278 /// @see _StartGraphicsStream() is called, and it should be followed
WiredHome 32:0e4f2ae512e2 279 /// by _EndGraphicsStream.
WiredHome 32:0e4f2ae512e2 280 ///
WiredHome 76:c981284eb513 281 /// @param[in] pixel is a color value to be put on the screen.
WiredHome 79:544eb4964795 282 /// @returns success/failure code. @see RetCode_t.
WiredHome 32:0e4f2ae512e2 283 ///
WiredHome 55:dfbabef7003e 284 virtual RetCode_t _putp(color_t pixel);
WiredHome 32:0e4f2ae512e2 285
WiredHome 79:544eb4964795 286 /// method to fill a region.
WiredHome 79:544eb4964795 287 ///
WiredHome 125:7a0b70f56550 288 /// This method fills a region with the specified color. It essentially
WiredHome 125:7a0b70f56550 289 /// is an alias for fillrect, however this uses width and height rather
WiredHome 125:7a0b70f56550 290 /// than a second x,y pair.
WiredHome 79:544eb4964795 291 ///
WiredHome 79:544eb4964795 292 /// @param[in] x is the left-edge of the region.
WiredHome 79:544eb4964795 293 /// @param[in] y is the top-edge of the region.
WiredHome 79:544eb4964795 294 /// @param[in] w specifies the width of the region.
WiredHome 79:544eb4964795 295 /// @param[in] h specifies the height of the region.
WiredHome 125:7a0b70f56550 296 /// @param[in] color is the color value to use to fill the region
WiredHome 79:544eb4964795 297 /// @returns success/failure code. @see RetCode_t.
WiredHome 79:544eb4964795 298 ///
WiredHome 109:7b94f06f085b 299 virtual RetCode_t fill(loc_t x, loc_t y, dim_t w, dim_t h, color_t color);
WiredHome 76:c981284eb513 300
WiredHome 125:7a0b70f56550 301 /// method to stream bitmap data to the display
WiredHome 125:7a0b70f56550 302 ///
WiredHome 125:7a0b70f56550 303 /// This method fills a region from a stream of color data.
WiredHome 125:7a0b70f56550 304 ///
WiredHome 125:7a0b70f56550 305 /// @param[in] x is the left-edge of the region.
WiredHome 125:7a0b70f56550 306 /// @param[in] y is the top-edge of the region.
WiredHome 125:7a0b70f56550 307 /// @param[in] w specifies the width of the region.
WiredHome 125:7a0b70f56550 308 /// @param[in] h specifies the height of the region.
WiredHome 125:7a0b70f56550 309 /// @param[in] color is a pointer to a color stream with w x h values.
WiredHome 125:7a0b70f56550 310 /// @returns success/failure code. @see RetCode_t.
WiredHome 125:7a0b70f56550 311 ///
WiredHome 109:7b94f06f085b 312 virtual RetCode_t blit(loc_t x, loc_t y, dim_t w, dim_t h, const int * color);
WiredHome 29:422616aa04bd 313
WiredHome 101:e0aad446094a 314 /// This method returns the width in pixels of the chosen character
WiredHome 101:e0aad446094a 315 /// from the previously selected external font.
WiredHome 101:e0aad446094a 316 ///
WiredHome 101:e0aad446094a 317 /// @param[in] c is the character of interest.
WiredHome 106:c80828f5dea4 318 /// @param[in, out] width is a pointer to where the width will be stored.
WiredHome 101:e0aad446094a 319 /// This parameter is NULL tested and will only be written if not null
WiredHome 101:e0aad446094a 320 /// which is convenient if you only want the height.
WiredHome 106:c80828f5dea4 321 /// @param[in, out] height is a pointer to where the height will be stored.
WiredHome 101:e0aad446094a 322 /// This parameter is NULL tested and will only be written if not null
WiredHome 101:e0aad446094a 323 /// which is convenient if you only want the width.
WiredHome 101:e0aad446094a 324 /// @returns a pointer to the raw character data or NULL if not found.
WiredHome 101:e0aad446094a 325 ///
WiredHome 109:7b94f06f085b 326 virtual const uint8_t * getCharMetrics(const unsigned char c, dim_t * width, dim_t * height);
WiredHome 101:e0aad446094a 327
WiredHome 29:422616aa04bd 328 /// This method transfers one character from the external font data
WiredHome 29:422616aa04bd 329 /// to the screen.
WiredHome 29:422616aa04bd 330 ///
WiredHome 101:e0aad446094a 331 /// The font being used has already been set with the SelectUserFont
WiredHome 101:e0aad446094a 332 /// API.
WiredHome 101:e0aad446094a 333 ///
WiredHome 29:422616aa04bd 334 /// @note the font data is in a special format as generate by
WiredHome 95:ef538bd687c0 335 /// the mikroe font creator.
WiredHome 29:422616aa04bd 336 /// See http://www.mikroe.com/glcd-font-creator/
WiredHome 29:422616aa04bd 337 ///
WiredHome 76:c981284eb513 338 /// @param[in] x is the horizontal pixel coordinate
WiredHome 76:c981284eb513 339 /// @param[in] y is the vertical pixel coordinate
WiredHome 98:ecebed9b80b2 340 /// @param[in] c is the character to render
WiredHome 98:ecebed9b80b2 341 /// @returns how far the cursor should advance to the right in pixels.
WiredHome 98:ecebed9b80b2 342 /// @returns zero if the character could not be rendered.
WiredHome 29:422616aa04bd 343 ///
WiredHome 109:7b94f06f085b 344 virtual int fontblit(loc_t x, loc_t y, const unsigned char c);
WiredHome 29:422616aa04bd 345
WiredHome 32:0e4f2ae512e2 346 /// This method returns the color value from a palette.
WiredHome 32:0e4f2ae512e2 347 ///
WiredHome 32:0e4f2ae512e2 348 /// This method accepts a pointer to a Bitmap color palette, which
WiredHome 32:0e4f2ae512e2 349 /// is a table in memory composed of RGB Quad values (r, g, b, 0),
WiredHome 32:0e4f2ae512e2 350 /// and an index into that table. It then extracts the color information
WiredHome 32:0e4f2ae512e2 351 /// and downsamples it to a color_t value which it returns.
WiredHome 32:0e4f2ae512e2 352 ///
WiredHome 32:0e4f2ae512e2 353 /// @note This method probably has very little value outside of
WiredHome 32:0e4f2ae512e2 354 /// the internal methods for reading BMP files.
WiredHome 32:0e4f2ae512e2 355 ///
WiredHome 76:c981284eb513 356 /// @param[in] colorPaletteArray is the handle to the color palette array to use.
WiredHome 76:c981284eb513 357 /// @param[in] index is the index into the color palette.
WiredHome 32:0e4f2ae512e2 358 /// @returns the color in color_t format.
WiredHome 32:0e4f2ae512e2 359 ///
WiredHome 73:f22a18707b5e 360 color_t RGBQuadToRGB16(RGBQUAD * colorPaletteArray, uint16_t index);
WiredHome 32:0e4f2ae512e2 361
WiredHome 41:2956a0a221e5 362 /// This method converts a 16-bit color value into a 24-bit RGB Quad.
WiredHome 41:2956a0a221e5 363 ///
WiredHome 76:c981284eb513 364 /// @param[in] c is the 16-bit color. @see color_t.
WiredHome 41:2956a0a221e5 365 /// @returns an RGBQUAD value. @see RGBQUAD
WiredHome 41:2956a0a221e5 366 ///
WiredHome 41:2956a0a221e5 367 RGBQUAD RGB16ToRGBQuad(color_t c);
WiredHome 41:2956a0a221e5 368
WiredHome 42:7cbdfd2bbfc5 369 /// This method attempts to render a specified graphics image file at
WiredHome 42:7cbdfd2bbfc5 370 /// the specified screen location.
WiredHome 42:7cbdfd2bbfc5 371 ///
WiredHome 42:7cbdfd2bbfc5 372 /// This supports several variants of the following file types:
WiredHome 42:7cbdfd2bbfc5 373 /// \li Bitmap file format,
WiredHome 42:7cbdfd2bbfc5 374 /// \li Icon file format.
WiredHome 42:7cbdfd2bbfc5 375 ///
WiredHome 42:7cbdfd2bbfc5 376 /// @note The specified image width and height, when adjusted for the
WiredHome 42:7cbdfd2bbfc5 377 /// x and y origin, must fit on the screen, or the image will not
WiredHome 42:7cbdfd2bbfc5 378 /// be shown (it does not clip the image).
WiredHome 42:7cbdfd2bbfc5 379 ///
WiredHome 42:7cbdfd2bbfc5 380 /// @note The file extension is tested, and if it ends in a supported
WiredHome 42:7cbdfd2bbfc5 381 /// format, the appropriate handler is called to render that image.
WiredHome 42:7cbdfd2bbfc5 382 ///
WiredHome 76:c981284eb513 383 /// @param[in] x is the horizontal pixel coordinate
WiredHome 76:c981284eb513 384 /// @param[in] y is the vertical pixel coordinate
WiredHome 76:c981284eb513 385 /// @param[in] FileName refers to the fully qualified path and file on
WiredHome 42:7cbdfd2bbfc5 386 /// a mounted file system.
WiredHome 42:7cbdfd2bbfc5 387 /// @returns success or error code.
WiredHome 42:7cbdfd2bbfc5 388 ///
WiredHome 42:7cbdfd2bbfc5 389 RetCode_t RenderImageFile(loc_t x, loc_t y, const char *FileName);
WiredHome 42:7cbdfd2bbfc5 390
WiredHome 115:c9862fd0c689 391 /// This method reads a disk file that is in jpeg format and
WiredHome 115:c9862fd0c689 392 /// puts it on the screen.
WiredHome 115:c9862fd0c689 393 ///
WiredHome 115:c9862fd0c689 394 /// @param[in] x is the horizontal pixel coordinate
WiredHome 115:c9862fd0c689 395 /// @param[in] y is the vertical pixel coordinate
WiredHome 115:c9862fd0c689 396 /// @param[in] Name_JPG is the filename on the mounted file system.
WiredHome 115:c9862fd0c689 397 /// @returns success or error code.
WiredHome 115:c9862fd0c689 398 ///
WiredHome 115:c9862fd0c689 399 RetCode_t RenderJpegFile(loc_t x, loc_t y, const char *Name_JPG);
WiredHome 115:c9862fd0c689 400
WiredHome 31:c72e12cd5c67 401 /// This method reads a disk file that is in bitmap format and
WiredHome 31:c72e12cd5c67 402 /// puts it on the screen.
WiredHome 31:c72e12cd5c67 403 ///
WiredHome 36:300f6ee0b2cf 404 /// Supported formats:
WiredHome 112:325ca91bc03d 405 /// \li 1-bit color format (2 colors)
WiredHome 112:325ca91bc03d 406 /// \li 4-bit color format (16 colors)
WiredHome 112:325ca91bc03d 407 /// \li 8-bit color format (256 colors)
WiredHome 36:300f6ee0b2cf 408 /// \li 16-bit color format (65k colors)
WiredHome 112:325ca91bc03d 409 /// \li 24-bit color format (16M colors)
WiredHome 36:300f6ee0b2cf 410 /// \li compression: no.
WiredHome 36:300f6ee0b2cf 411 ///
WiredHome 36:300f6ee0b2cf 412 /// @note This is a slow operation, typically due to the use of
WiredHome 36:300f6ee0b2cf 413 /// the file system, and partially because bmp files
WiredHome 31:c72e12cd5c67 414 /// are stored from the bottom up, and the memory is written
WiredHome 32:0e4f2ae512e2 415 /// from the top down; as a result, it constantly 'seeks'
WiredHome 32:0e4f2ae512e2 416 /// on the file system for the next row of information.
WiredHome 31:c72e12cd5c67 417 ///
WiredHome 34:c99ec28fac66 418 /// As a performance test, a sample picture was timed. A family picture
WiredHome 34:c99ec28fac66 419 /// was converted to Bitmap format; shrunk to 352 x 272 pixels and save
WiredHome 34:c99ec28fac66 420 /// in 8-bit color format. The resulting file size was 94.5 KByte.
WiredHome 34:c99ec28fac66 421 /// The SPI port interface was set to 20 MHz.
WiredHome 34:c99ec28fac66 422 /// The original bitmap rendering software was purely in software,
WiredHome 34:c99ec28fac66 423 /// pushing 1 pixel at a time to the write function, which did use SPI
WiredHome 34:c99ec28fac66 424 /// hardware (not pin wiggling) to transfer commands and data to the
WiredHome 34:c99ec28fac66 425 /// display. Then, the driver was improved to leverage the capability
WiredHome 34:c99ec28fac66 426 /// of the derived display driver. As a final check, instead of the
WiredHome 34:c99ec28fac66 427 /// [known slow] local file system, a randomly chosen USB stick was
WiredHome 34:c99ec28fac66 428 /// used. The performance results are impressive (but depend on the
WiredHome 34:c99ec28fac66 429 /// listed factors).
WiredHome 34:c99ec28fac66 430 ///
WiredHome 35:7dcab9e3ab25 431 /// \li 34 seconds, LocalFileSystem, Software Rendering
WiredHome 35:7dcab9e3ab25 432 /// \li 9 seconds, LocalFileSystem, Hardware Rending for RA8875
WiredHome 35:7dcab9e3ab25 433 /// \li 3 seconds, MSCFileSystem, Hardware Rendering for RA8875
WiredHome 34:c99ec28fac66 434 ///
WiredHome 76:c981284eb513 435 /// @param[in] x is the horizontal pixel coordinate
WiredHome 76:c981284eb513 436 /// @param[in] y is the vertical pixel coordinate
WiredHome 76:c981284eb513 437 /// @param[in] Name_BMP is the filename on the mounted file system.
WiredHome 31:c72e12cd5c67 438 /// @returns success or error code.
WiredHome 31:c72e12cd5c67 439 ///
WiredHome 37:f19b7e7449dc 440 RetCode_t RenderBitmapFile(loc_t x, loc_t y, const char *Name_BMP);
WiredHome 31:c72e12cd5c67 441
WiredHome 42:7cbdfd2bbfc5 442
WiredHome 42:7cbdfd2bbfc5 443 /// This method reads a disk file that is in ico format and
WiredHome 42:7cbdfd2bbfc5 444 /// puts it on the screen.
WiredHome 42:7cbdfd2bbfc5 445 ///
WiredHome 42:7cbdfd2bbfc5 446 /// Reading the disk is slow, but a typical icon file is small
WiredHome 42:7cbdfd2bbfc5 447 /// so it should be ok.
WiredHome 42:7cbdfd2bbfc5 448 ///
WiredHome 42:7cbdfd2bbfc5 449 /// @note An Icon file can have more than one icon in it. This
WiredHome 42:7cbdfd2bbfc5 450 /// implementation only processes the first image in the file.
WiredHome 42:7cbdfd2bbfc5 451 ///
WiredHome 76:c981284eb513 452 /// @param[in] x is the horizontal pixel coordinate
WiredHome 76:c981284eb513 453 /// @param[in] y is the vertical pixel coordinate
WiredHome 76:c981284eb513 454 /// @param[in] Name_ICO is the filename on the mounted file system.
WiredHome 42:7cbdfd2bbfc5 455 /// @returns success or error code.
WiredHome 42:7cbdfd2bbfc5 456 ///
WiredHome 42:7cbdfd2bbfc5 457 RetCode_t RenderIconFile(loc_t x, loc_t y, const char *Name_ICO);
WiredHome 42:7cbdfd2bbfc5 458
WiredHome 42:7cbdfd2bbfc5 459
WiredHome 152:a013ac0133e4 460 /// Render a GIF file on screen.
WiredHome 152:a013ac0133e4 461 ///
WiredHome 152:a013ac0133e4 462 /// This function reads a GIF file, and places it onscreen at the specified
WiredHome 152:a013ac0133e4 463 /// coordinates.
WiredHome 152:a013ac0133e4 464 ///
WiredHome 152:a013ac0133e4 465 /// @param[in] x is the left edge of the on-screen coordinates.
WiredHome 152:a013ac0133e4 466 /// @param[in] y is the top edge of the on-screen coordinates.
WiredHome 152:a013ac0133e4 467 /// @param[in] Name_GIF is a pointer to the fully qualified filename.
WiredHome 152:a013ac0133e4 468 /// @returns noerror, or a variety of error codes.
WiredHome 152:a013ac0133e4 469 ///
WiredHome 152:a013ac0133e4 470 RetCode_t RenderGIFFile(loc_t x, loc_t y, const char *Name_GIF);
WiredHome 152:a013ac0133e4 471
WiredHome 152:a013ac0133e4 472
WiredHome 152:a013ac0133e4 473 /// GetGIFMetrics
WiredHome 152:a013ac0133e4 474 ///
WiredHome 152:a013ac0133e4 475 /// Get the GIF Image metrics.
WiredHome 152:a013ac0133e4 476 ///
WiredHome 152:a013ac0133e4 477 /// @param[out] imageDescriptor contains the image metrics on success.
WiredHome 152:a013ac0133e4 478 /// @param[in] Name_GIF is the filename of the GIF file of interest.
WiredHome 152:a013ac0133e4 479 /// @returns noerror, or a variety of error codes.
WiredHome 152:a013ac0133e4 480 ///
WiredHome 152:a013ac0133e4 481 RetCode_t GetGIFMetrics(gif_screen_descriptor_t * imageDescriptor, const char * Name_GIF);
WiredHome 152:a013ac0133e4 482
WiredHome 152:a013ac0133e4 483
WiredHome 29:422616aa04bd 484 /// prints one character at the specified coordinates.
WiredHome 29:422616aa04bd 485 ///
WiredHome 29:422616aa04bd 486 /// This will print the character at the specified pixel coordinates.
WiredHome 29:422616aa04bd 487 ///
WiredHome 76:c981284eb513 488 /// @param[in] x is the horizontal offset in pixels.
WiredHome 76:c981284eb513 489 /// @param[in] y is the vertical offset in pixels.
WiredHome 76:c981284eb513 490 /// @param[in] value is the character to print.
WiredHome 29:422616aa04bd 491 /// @returns number of pixels to index to the right if a character was printed, 0 otherwise.
WiredHome 29:422616aa04bd 492 ///
WiredHome 29:422616aa04bd 493 virtual int character(int x, int y, int value);
WiredHome 29:422616aa04bd 494
WiredHome 32:0e4f2ae512e2 495 /// get the number of colums based on the currently active font
WiredHome 32:0e4f2ae512e2 496 ///
WiredHome 32:0e4f2ae512e2 497 /// @returns number of columns.
WiredHome 32:0e4f2ae512e2 498 ///
WiredHome 32:0e4f2ae512e2 499 virtual int columns(void);
WiredHome 32:0e4f2ae512e2 500
WiredHome 32:0e4f2ae512e2 501 /// get the number of rows based on the currently active font
WiredHome 32:0e4f2ae512e2 502 ///
WiredHome 32:0e4f2ae512e2 503 /// @returns number of rows.
WiredHome 32:0e4f2ae512e2 504 ///
WiredHome 32:0e4f2ae512e2 505 virtual int rows(void);
WiredHome 32:0e4f2ae512e2 506
WiredHome 98:ecebed9b80b2 507 /// Select a User Font for all subsequent text.
WiredHome 98:ecebed9b80b2 508 ///
WiredHome 98:ecebed9b80b2 509 /// @note Tool to create the fonts is accessible from its creator
WiredHome 98:ecebed9b80b2 510 /// available at http://www.mikroe.com.
WiredHome 98:ecebed9b80b2 511 /// For version 1.2.0.0, choose the "Export for TFT and new GLCD"
WiredHome 98:ecebed9b80b2 512 /// format.
WiredHome 98:ecebed9b80b2 513 ///
WiredHome 98:ecebed9b80b2 514 /// @param[in] font is a pointer to a specially formed font resource.
WiredHome 167:8aa3fb2a5a31 515 /// @returns @ref RetCode_t value.
WiredHome 98:ecebed9b80b2 516 ///
WiredHome 98:ecebed9b80b2 517 virtual RetCode_t SelectUserFont(const uint8_t * font = NULL);
WiredHome 98:ecebed9b80b2 518
WiredHome 32:0e4f2ae512e2 519
WiredHome 32:0e4f2ae512e2 520 protected:
WiredHome 32:0e4f2ae512e2 521
WiredHome 32:0e4f2ae512e2 522 /// Pure virtual method indicating the start of a graphics stream.
WiredHome 32:0e4f2ae512e2 523 ///
WiredHome 32:0e4f2ae512e2 524 /// This is called prior to a stream of pixel data being sent.
WiredHome 32:0e4f2ae512e2 525 /// This may cause register configuration changes in the derived
WiredHome 32:0e4f2ae512e2 526 /// class in order to prepare the hardware to accept the streaming
WiredHome 32:0e4f2ae512e2 527 /// data.
WiredHome 32:0e4f2ae512e2 528 ///
WiredHome 32:0e4f2ae512e2 529 /// @note this method must be supported in the derived class.
WiredHome 32:0e4f2ae512e2 530 ///
WiredHome 167:8aa3fb2a5a31 531 /// @returns @ref RetCode_t value.
WiredHome 32:0e4f2ae512e2 532 ///
WiredHome 32:0e4f2ae512e2 533 virtual RetCode_t _StartGraphicsStream(void) = 0;
dreschpe 0:de9d1462a835 534
WiredHome 32:0e4f2ae512e2 535 /// Pure virtual method indicating the end of a graphics stream.
WiredHome 32:0e4f2ae512e2 536 ///
WiredHome 32:0e4f2ae512e2 537 /// This is called to conclude a stream of pixel data that was sent.
WiredHome 32:0e4f2ae512e2 538 /// This may cause register configuration changes in the derived
WiredHome 32:0e4f2ae512e2 539 /// class in order to stop the hardware from accept the streaming
WiredHome 32:0e4f2ae512e2 540 /// data.
WiredHome 32:0e4f2ae512e2 541 ///
WiredHome 32:0e4f2ae512e2 542 /// @note this method must be supported in the derived class.
WiredHome 32:0e4f2ae512e2 543 ///
WiredHome 167:8aa3fb2a5a31 544 /// @returns @ref RetCode_t value.
WiredHome 32:0e4f2ae512e2 545 ///
WiredHome 32:0e4f2ae512e2 546 virtual RetCode_t _EndGraphicsStream(void) = 0;
WiredHome 32:0e4f2ae512e2 547
WiredHome 42:7cbdfd2bbfc5 548 /// Protected method to render an image given a file handle and
WiredHome 42:7cbdfd2bbfc5 549 /// coordinates.
WiredHome 42:7cbdfd2bbfc5 550 ///
WiredHome 76:c981284eb513 551 /// @param[in] x is the horizontal pixel coordinate
WiredHome 76:c981284eb513 552 /// @param[in] y is the vertical pixel coordinate
WiredHome 76:c981284eb513 553 /// @param[in] fileOffset is the offset into the file where the image data starts
WiredHome 167:8aa3fb2a5a31 554 /// @param[in] fh is the file handle to the stream already opened for the data.
WiredHome 42:7cbdfd2bbfc5 555 /// @returns success or error code.
WiredHome 42:7cbdfd2bbfc5 556 ///
WiredHome 167:8aa3fb2a5a31 557 RetCode_t _RenderBitmap(loc_t x, loc_t y, uint32_t fileOffset, FILE * fh);
WiredHome 42:7cbdfd2bbfc5 558
WiredHome 152:a013ac0133e4 559
WiredHome 152:a013ac0133e4 560 /// Protected method to render a GIF given a file handle and
WiredHome 152:a013ac0133e4 561 /// coordinates.
WiredHome 152:a013ac0133e4 562 ///
WiredHome 152:a013ac0133e4 563 /// @param[in] x is the horizontal pixel coordinate
WiredHome 152:a013ac0133e4 564 /// @param[in] y is the vertical pixel coordinate
WiredHome 167:8aa3fb2a5a31 565 /// @param[in] fh is the file handle to the stream already opened for the data.
WiredHome 152:a013ac0133e4 566 /// @returns success or error code.
WiredHome 152:a013ac0133e4 567 ///
WiredHome 152:a013ac0133e4 568 RetCode_t _RenderGIF(loc_t x, loc_t y, FILE * fh);
WiredHome 152:a013ac0133e4 569
WiredHome 152:a013ac0133e4 570
WiredHome 115:c9862fd0c689 571 private:
WiredHome 122:79e431f98fa9 572
WiredHome 136:224e03d5c31f 573 loc_t img_x; /// x position of a rendered jpg
WiredHome 136:224e03d5c31f 574 loc_t img_y; /// y position of a rendered jpg
WiredHome 136:224e03d5c31f 575
WiredHome 122:79e431f98fa9 576 /// Analyze the jpeg data in preparation for decompression.
WiredHome 122:79e431f98fa9 577 ///
WiredHome 115:c9862fd0c689 578 JRESULT jd_prepare(JDEC * jd, uint16_t(* infunc)(JDEC * jd, uint8_t * buffer, uint16_t bufsize), void * pool, uint16_t poolsize, void * filehandle);
WiredHome 115:c9862fd0c689 579
WiredHome 122:79e431f98fa9 580 /// Decompress the jpeg and render it.
WiredHome 122:79e431f98fa9 581 ///
WiredHome 115:c9862fd0c689 582 JRESULT jd_decomp(JDEC * jd, uint16_t(* outfunct)(JDEC * jd, void * stream, JRECT * rect), uint8_t scale);
WiredHome 115:c9862fd0c689 583
WiredHome 122:79e431f98fa9 584 /// helper function to read data from the file system
WiredHome 122:79e431f98fa9 585 ///
WiredHome 115:c9862fd0c689 586 uint16_t privInFunc(JDEC * jd, uint8_t * buff, uint16_t ndata);
WiredHome 115:c9862fd0c689 587
WiredHome 122:79e431f98fa9 588 /// helper function to read data from the file system
WiredHome 122:79e431f98fa9 589 ///
WiredHome 115:c9862fd0c689 590 uint16_t getJpegData(JDEC * jd, uint8_t *buff, uint16_t ndata);
WiredHome 115:c9862fd0c689 591
WiredHome 122:79e431f98fa9 592 /// helper function to write data to the display
WiredHome 122:79e431f98fa9 593 ///
WiredHome 115:c9862fd0c689 594 uint16_t privOutFunc(JDEC * jd, void * bitmap, JRECT * rect);
WiredHome 115:c9862fd0c689 595
WiredHome 115:c9862fd0c689 596 JRESULT mcu_output (
WiredHome 115:c9862fd0c689 597 JDEC * jd, /* Pointer to the decompressor object */
WiredHome 115:c9862fd0c689 598 uint16_t (* outfunc)(JDEC * jd, void * stream, JRECT * rect), /* RGB output function */
WiredHome 115:c9862fd0c689 599 uint16_t x, /* MCU position in the image (left of the MCU) */
WiredHome 115:c9862fd0c689 600 uint16_t y /* MCU position in the image (top of the MCU) */
WiredHome 115:c9862fd0c689 601 );
WiredHome 115:c9862fd0c689 602
WiredHome 115:c9862fd0c689 603 int16_t bitext ( /* >=0: extracted data, <0: error code */
WiredHome 115:c9862fd0c689 604 JDEC * jd, /* Pointer to the decompressor object */
WiredHome 115:c9862fd0c689 605 uint16_t nbit /* Number of bits to extract (1 to 11) */
WiredHome 115:c9862fd0c689 606 );
WiredHome 115:c9862fd0c689 607
WiredHome 115:c9862fd0c689 608 int16_t huffext ( /* >=0: decoded data, <0: error code */
WiredHome 115:c9862fd0c689 609 JDEC * jd, /* Pointer to the decompressor object */
WiredHome 115:c9862fd0c689 610 const uint8_t * hbits, /* Pointer to the bit distribution table */
WiredHome 115:c9862fd0c689 611 const uint16_t * hcode, /* Pointer to the code word table */
WiredHome 115:c9862fd0c689 612 const uint8_t * hdata /* Pointer to the data table */
WiredHome 115:c9862fd0c689 613 );
WiredHome 115:c9862fd0c689 614
WiredHome 115:c9862fd0c689 615 JRESULT restart (
WiredHome 115:c9862fd0c689 616 JDEC * jd, /* Pointer to the decompressor object */
WiredHome 115:c9862fd0c689 617 uint16_t rstn /* Expected restert sequense number */
WiredHome 115:c9862fd0c689 618 );
WiredHome 115:c9862fd0c689 619
WiredHome 115:c9862fd0c689 620 JRESULT mcu_load (
WiredHome 115:c9862fd0c689 621 JDEC * jd /* Pointer to the decompressor object */
WiredHome 115:c9862fd0c689 622 );
WiredHome 115:c9862fd0c689 623
WiredHome 152:a013ac0133e4 624 gif_screen_descriptor_t screen_descriptor; // attributes for the whole screen
WiredHome 152:a013ac0133e4 625 bool screen_descriptor_isvalid; // has been read
WiredHome 152:a013ac0133e4 626 color_t * global_color_table;
WiredHome 152:a013ac0133e4 627 int global_color_table_size;
WiredHome 152:a013ac0133e4 628 color_t * local_color_table;
WiredHome 152:a013ac0133e4 629 int local_color_table_size;
WiredHome 152:a013ac0133e4 630 RetCode_t GetGIFHeader(FILE * fh);
WiredHome 152:a013ac0133e4 631 bool hasGIFHeader(FILE * fh);
WiredHome 152:a013ac0133e4 632 int process_gif_extension(FILE * fh);
WiredHome 152:a013ac0133e4 633 RetCode_t process_gif_image_descriptor(FILE * fh, uint8_t ** uncompress_gifed_data, int width, int height);
WiredHome 152:a013ac0133e4 634 int read_gif_sub_blocks(FILE * fh, unsigned char **data);
WiredHome 152:a013ac0133e4 635 RetCode_t uncompress_gif(int code_length, const unsigned char *input, int input_length, unsigned char *out);
WiredHome 152:a013ac0133e4 636 size_t read_filesystem_bytes(void * buffer, int numBytes, FILE * fh);
WiredHome 152:a013ac0133e4 637 RetCode_t readGIFImageDescriptor(FILE * fh, gif_image_descriptor_t * gif_image_descriptor);
WiredHome 152:a013ac0133e4 638 RetCode_t readColorTable(color_t * colorTable, int colorTableSize, FILE * fh);
WiredHome 152:a013ac0133e4 639
WiredHome 122:79e431f98fa9 640
WiredHome 115:c9862fd0c689 641 protected:
WiredHome 109:7b94f06f085b 642 /// Pure virtual method to write a boolean stream to the display.
WiredHome 109:7b94f06f085b 643 ///
WiredHome 109:7b94f06f085b 644 /// This takes a bit stream in memory and using the current color settings
WiredHome 109:7b94f06f085b 645 /// it will stream it to the display. Along the way, each bit is translated
WiredHome 109:7b94f06f085b 646 /// to either the foreground or background color value and then that pixel
WiredHome 109:7b94f06f085b 647 /// is pushed onward.
WiredHome 109:7b94f06f085b 648 ///
WiredHome 109:7b94f06f085b 649 /// This is similar, but different, to the @ref pixelStream API, which is
WiredHome 109:7b94f06f085b 650 /// given a stream of color values.
WiredHome 109:7b94f06f085b 651 ///
WiredHome 109:7b94f06f085b 652 /// @param[in] x is the horizontal position on the display.
WiredHome 109:7b94f06f085b 653 /// @param[in] y is the vertical position on the display.
WiredHome 109:7b94f06f085b 654 /// @param[in] w is the width of the rectangular region to fill.
WiredHome 109:7b94f06f085b 655 /// @param[in] h is the height of the rectangular region to fill.
WiredHome 109:7b94f06f085b 656 /// @param[in] boolStream is the inline memory image from which to extract
WiredHome 109:7b94f06f085b 657 /// the bitstream.
WiredHome 167:8aa3fb2a5a31 658 /// @returns @ref RetCode_t value.
WiredHome 109:7b94f06f085b 659 ///
WiredHome 109:7b94f06f085b 660 virtual RetCode_t booleanStream(loc_t x, loc_t y, dim_t w, dim_t h, const uint8_t * boolStream) = 0;
WiredHome 109:7b94f06f085b 661
WiredHome 109:7b94f06f085b 662
WiredHome 29:422616aa04bd 663 const unsigned char * font; ///< reference to an external font somewhere in memory
WiredHome 29:422616aa04bd 664
dreschpe 0:de9d1462a835 665 // pixel location
WiredHome 125:7a0b70f56550 666 short _x; ///< keeps track of current X location
WiredHome 125:7a0b70f56550 667 short _y; ///< keeps track of current Y location
dreschpe 0:de9d1462a835 668
WiredHome 153:8a85efb3eb71 669 uint8_t fontScaleX; ///< tracks the font scale factor for Soft fonts. Range: 1 .. 4
WiredHome 153:8a85efb3eb71 670 uint8_t fontScaleY; ///< tracks the font scale factor for soft fonts. Range: 1 .. 4
WiredHome 153:8a85efb3eb71 671
WiredHome 111:efe436c43aba 672 rect_t windowrect; ///< window commands are held here for speed of access
dreschpe 0:de9d1462a835 673 };
dreschpe 0:de9d1462a835 674
dreschpe 0:de9d1462a835 675 #endif
WiredHome 33:b6b710758ab3 676