CUER / RA8875

Fork of RA8875 by David Smart

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GraphicsDisplay.h Source File

GraphicsDisplay.h

00001 /* mbed GraphicsDisplay Display Library Base Class
00002  * Copyright (c) 2007-2009 sford
00003  * Released under the MIT License: http://mbed.org/license/mit
00004  *
00005  * A library for providing a common base class for Graphics displays
00006  * To port a new display, derive from this class and implement
00007  * the constructor (setup the display), pixel (put a pixel
00008  * at a location), width and height functions. Everything else
00009  * (locate, printf, putc, cls, window, putp, fill, blit, blitbit) 
00010  * will come for free. You can also provide a specialised implementation
00011  * of window and putp to speed up the results
00012  */
00013 
00014 #ifndef MBED_GRAPHICSDISPLAY_H
00015 #define MBED_GRAPHICSDISPLAY_H
00016 #include "Bitmap.h"
00017 #include "TextDisplay.h"
00018 #include "GraphicsDisplayJPEG.h"
00019 
00020 /// The GraphicsDisplay class 
00021 /// 
00022 /// This graphics display class supports both graphics and text operations.
00023 /// Typically, a subclass is derived from this which has localizations to
00024 /// adapt to a specific hardware platform (e.g. a display controller chip),
00025 /// that overrides methods in here to either add more capability or perhaps 
00026 /// to improve performance, by leveraging specific hardware capabilities.
00027 ///
00028 class GraphicsDisplay : public TextDisplay 
00029 {
00030 public:
00031     /// The constructor
00032     GraphicsDisplay(const char* name);
00033     
00034     //~GraphicsDisplay();
00035     
00036     /// Draw a pixel in the specified color.
00037     ///
00038     /// @note this method must be supported in the derived class.
00039     ///
00040     /// @param[in] x is the horizontal offset to this pixel.
00041     /// @param[in] y is the vertical offset to this pixel.
00042     /// @param[in] color defines the color for the pixel.
00043     /// @returns success/failure code. @see RetCode_t.
00044     ///
00045     virtual RetCode_t pixel(loc_t x, loc_t y, color_t color) = 0;
00046     
00047     /// Write a stream of pixels to the display.
00048     ///
00049     /// @note this method must be supported in the derived class.
00050     ///
00051     /// @param[in] p is a pointer to a color_t array to write.
00052     /// @param[in] count is the number of pixels to write.
00053     /// @param[in] x is the horizontal position on the display.
00054     /// @param[in] y is the vertical position on the display.
00055     /// @returns success/failure code. @see RetCode_t.
00056     ///
00057     virtual RetCode_t pixelStream(color_t * p, uint32_t count, loc_t x, loc_t y) = 0;
00058 
00059     /// Get a pixel from the display.
00060     ///
00061     /// @note this method must be supported in the derived class.
00062     ///
00063     /// @param[in] x is the horizontal offset to this pixel.
00064     /// @param[in] y is the vertical offset to this pixel.
00065     /// @returns the pixel. @see color_t
00066     ///
00067     virtual color_t getPixel(loc_t x, loc_t y) = 0;
00068 
00069     /// Get a stream of pixels from the display.
00070     ///
00071     /// @note this method must be supported in the derived class.
00072     ///
00073     /// @param[out] p is a pointer to a color_t array to accept the stream.
00074     /// @param[in] count is the number of pixels to read.
00075     /// @param[in] x is the horizontal offset to this pixel.
00076     /// @param[in] y is the vertical offset to this pixel.
00077     /// @returns success/failure code. @see RetCode_t.
00078     ///
00079     virtual RetCode_t getPixelStream(color_t * p, uint32_t count, loc_t x, loc_t y) = 0;
00080     
00081     /// get the screen width in pixels
00082     ///
00083     /// @note this method must be supported in the derived class.
00084     ///
00085     /// @returns screen width in pixels.
00086     ///
00087     virtual uint16_t width() = 0;
00088     
00089     /// get the screen height in pixels
00090     ///
00091     /// @note this method must be supported in the derived class.
00092     ///
00093     /// @returns screen height in pixels.
00094     ///
00095     virtual uint16_t height() = 0;
00096 
00097     /// Prepare the controller to write binary data to the screen by positioning
00098     /// the memory cursor.
00099     ///
00100     /// @note this method must be supported in the derived class.
00101     ///
00102     /// @param[in] x is the horizontal position in pixels (from the left edge)
00103     /// @param[in] y is the vertical position in pixels (from the top edge)
00104     /// @returns success/failure code. @see RetCode_t.
00105     ///
00106     virtual RetCode_t SetGraphicsCursor(loc_t x, loc_t y) = 0;
00107     
00108     
00109     /// Prepare the controller to write binary data to the screen by positioning
00110     /// the memory cursor.
00111     ///
00112     /// @param[in] p is the point representing the cursor position to set
00113     /// @returns success/failure code. See @ref RetCode_t.
00114     ///
00115     virtual RetCode_t SetGraphicsCursor(point_t p) = 0;
00116     
00117     /// Read the current graphics cursor position as a point.
00118     ///
00119     /// @returns the graphics cursor as a point.
00120     ///
00121     virtual point_t GetGraphicsCursor(void) = 0;
00122 
00123     /// Prepare the controller to read binary data from the screen by positioning
00124     /// the memory read cursor.
00125     ///
00126     /// @param[in] x is the horizontal position in pixels (from the left edge)
00127     /// @param[in] y is the vertical position in pixels (from the top edge)
00128     /// @returns success/failure code. @see RetCode_t.
00129     ///
00130     virtual RetCode_t SetGraphicsCursorRead(loc_t x, loc_t y) = 0;
00131     
00132     /// Draw a filled rectangle in the specified color
00133     ///
00134     /// @note As a side effect, this changes the current
00135     ///     foreground color for subsequent operations.
00136     ///
00137     /// @note this method must be supported in the derived class.
00138     ///
00139     /// @param[in] x1 is the horizontal start of the line.
00140     /// @param[in] y1 is the vertical start of the line.
00141     /// @param[in] x2 is the horizontal end of the line.
00142     /// @param[in] y2 is the vertical end of the line.
00143     /// @param[in] color defines the foreground color.
00144     /// @param[in] fillit is optional to NOFILL the rectangle. default is FILL.
00145     /// @returns success/failure code. @see RetCode_t.
00146     ///
00147     virtual RetCode_t fillrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, 
00148         color_t color, fill_t fillit = FILL) = 0;
00149 
00150     /// Select the drawing layer for subsequent commands.
00151     ///
00152     /// If the screen configuration is 480 x 272, or if it is 800 x 480 
00153     /// and 8-bit color, the the display supports two layers, which can 
00154     /// be independently drawn on and shown. Additionally, complex
00155     /// operations involving both layers are permitted.
00156     ///
00157     /// @code
00158     ///     //lcd.SetLayerMode(OnlyLayer0); // default is layer 0
00159     ///     lcd.rect(400,130, 475,155,Brown);
00160     ///     lcd.SelectDrawingLayer(1);
00161     ///     lcd.circle(400,25, 25, BrightRed);
00162     ///     wait(1);
00163     ///     lcd.SetLayerMode(ShowLayer1);
00164     /// @endcode
00165     ///
00166     /// @attention The user manual refers to Layer 1 and Layer 2, however the
00167     ///     actual register values are value 0 and 1. This API as well as
00168     ///     others that reference the layers use the values 0 and 1 for
00169     ///     cleaner iteration in the code.
00170     ///
00171     /// @param[in] layer is 0 or 1 to select the layer for subsequent 
00172     ///     commands.
00173     /// @param[out] prevLayer is an optiona pointer to where the previous layer
00174     ///     will be written, making it a little easer to restore layers.
00175     ///     Writes 0 or 1 when the pointer is not NULL.
00176     /// @returns success/failure code. See @ref RetCode_t.
00177     ///
00178     virtual RetCode_t SelectDrawingLayer(uint16_t layer, uint16_t * prevLayer = NULL) = 0;
00179  
00180     
00181     /// Get the currently active drawing layer.
00182     ///
00183     /// This returns a value, 0 or 1, based on the screen configuration
00184     /// and the currently active drawing layer.
00185     ///
00186     /// @code
00187     ///     uint16_t prevLayer;
00188     ///     lcd.SelectDrawingLayer(x, &prevLayer);
00189     ///     lcd.circle(400,25, 25, BrightRed);
00190     ///     lcd.SelectDrawingLayer(prevLayer);
00191     /// @endcode
00192     ///
00193     /// @attention The user manual refers to Layer 1 and Layer 2, however the
00194     ///     actual register values are value 0 and 1. This API as well as
00195     ///     others that reference the layers use the values 0 and 1 for
00196     ///     cleaner iteration in the code.
00197     ///
00198     /// @returns the current drawing layer; 0 or 1.
00199     /// 
00200     virtual uint16_t GetDrawingLayer(void) = 0;
00201 
00202     /// a function to write the command and data to the RA8875 chip.
00203     ///
00204     /// @param command is the RA8875 instruction to perform
00205     /// @param data is the optional data to the instruction.
00206     /// @returns success/failure code. @see RetCode_t.
00207     ///
00208     virtual RetCode_t WriteCommand(unsigned char command, unsigned int data = 0xFFFF) = 0;
00209     
00210     
00211     /// a function to write the data to the RA8875 chip.
00212     ///
00213     /// This is typically used after a command has been initiated, and where
00214     /// there may be a data stream to follow.
00215     ///
00216     /// @param data is the optional data to the instruction.
00217     /// @returns success/failure code. @see RetCode_t.
00218     ///
00219     virtual RetCode_t WriteData(unsigned char data) = 0;
00220 
00221     /// Set the window, which controls where items are written to the screen.
00222     ///
00223     /// When something hits the window width, it wraps back to the left side
00224     /// and down a row. 
00225     ///
00226     /// @note If the initial write is outside the window, it will
00227     ///     be captured into the window when it crosses a boundary. It may
00228     ///     be appropriate to SetGraphicsCursor() to a point in the window.
00229     ///
00230     /// @param[in] r is the rect_t rect to define the window.
00231     /// @returns success/failure code. @see RetCode_t.
00232     ///
00233     virtual RetCode_t window(rect_t r);
00234 
00235     /// Set the window, which controls where items are written to the screen.
00236     ///
00237     /// When something hits the window width, it wraps back to the left side
00238     /// and down a row. 
00239     ///
00240     /// @note If the initial write is outside the window, it will
00241     ///     be captured into the window when it crosses a boundary. It may
00242     ///     be appropriate to SetGraphicsCursor() to a point in the window.
00243     ///
00244     /// @note if no parameters are provided, it restores the window to full screen.
00245     ///
00246     /// @param[in] x is the left edge in pixels.
00247     /// @param[in] y is the top edge in pixels.
00248     /// @param[in] w is the window width in pixels.
00249     /// @param[in] h is the window height in pixels.
00250     /// @returns success/failure code. @see RetCode_t.
00251     ///
00252     virtual RetCode_t window(loc_t x = 0, loc_t y = 0, dim_t w = (dim_t)-1, dim_t h = (dim_t)-1);
00253     
00254     /// method to set the window region to the full screen.
00255     ///
00256     /// This restores the 'window' to the full screen, so that 
00257     /// other operations (@see cls) would clear the whole screen.
00258     ///
00259     /// @returns success/failure code. @see RetCode_t.
00260     ///
00261     virtual RetCode_t WindowMax(void);
00262     
00263     /// Clear the screen.
00264     ///
00265     /// The behavior is to clear the whole screen.
00266     ///
00267     /// @param[in] layers is ignored, but supports maintaining the same 
00268     ///     API for the graphics layer.
00269     /// @returns success/failure code. @see RetCode_t.
00270     ///
00271     virtual RetCode_t cls(uint16_t layers = 0);
00272     
00273     /// method to put a single color pixel to the screen.
00274     ///
00275     /// This method may be called as many times as necessary after 
00276     /// @see _StartGraphicsStream() is called, and it should be followed 
00277     /// by _EndGraphicsStream.
00278     ///
00279     /// @param[in] pixel is a color value to be put on the screen.
00280     /// @returns success/failure code. @see RetCode_t.
00281     ///
00282     virtual RetCode_t _putp(color_t pixel);
00283 
00284     /// method to fill a region.
00285     ///
00286     /// This method fills a region with the specified color. It essentially
00287     /// is an alias for fillrect, however this uses width and height rather
00288     /// than a second x,y pair.
00289     ///
00290     /// @param[in] x is the left-edge of the region.
00291     /// @param[in] y is the top-edge of the region.
00292     /// @param[in] w specifies the width of the region.
00293     /// @param[in] h specifies the height of the region.
00294     /// @param[in] color is the color value to use to fill the region
00295     /// @returns success/failure code. @see RetCode_t.
00296     /// 
00297     virtual RetCode_t fill(loc_t x, loc_t y, dim_t w, dim_t h, color_t color);
00298     
00299     /// method to stream bitmap data to the display
00300     ///
00301     /// This method fills a region from a stream of color data.
00302     ///
00303     /// @param[in] x is the left-edge of the region.
00304     /// @param[in] y is the top-edge of the region.
00305     /// @param[in] w specifies the width of the region.
00306     /// @param[in] h specifies the height of the region.
00307     /// @param[in] color is a pointer to a color stream with w x h values.
00308     /// @returns success/failure code. @see RetCode_t.
00309     /// 
00310     virtual RetCode_t blit(loc_t x, loc_t y, dim_t w, dim_t h, const int * color);    
00311     
00312     /// This method returns the width in pixels of the chosen character
00313     /// from the previously selected external font.
00314     ///
00315     /// @param[in] c is the character of interest.
00316     /// @param[in, out] width is a pointer to where the width will be stored.
00317     ///     This parameter is NULL tested and will only be written if not null
00318     ///     which is convenient if you only want the height.
00319     /// @param[in, out] height is a pointer to where the height will be stored.
00320     ///     This parameter is NULL tested and will only be written if not null
00321     ///     which is convenient if you only want the width.
00322     /// @returns a pointer to the raw character data or NULL if not found.
00323     ///
00324     virtual const uint8_t * getCharMetrics(const unsigned char c, dim_t * width, dim_t * height);
00325     
00326     /// This method transfers one character from the external font data
00327     /// to the screen.
00328     ///
00329     /// The font being used has already been set with the SelectUserFont
00330     /// API.
00331     ///
00332     /// @note the font data is in a special format as generate by
00333     ///         the mikroe font creator.
00334     ///         See http://www.mikroe.com/glcd-font-creator/
00335     ///
00336     /// @param[in] x is the horizontal pixel coordinate
00337     /// @param[in] y is the vertical pixel coordinate
00338     /// @param[in] c is the character to render
00339     /// @returns how far the cursor should advance to the right in pixels.
00340     /// @returns zero if the character could not be rendered.
00341     ///
00342     virtual int fontblit(loc_t x, loc_t y, const unsigned char c);
00343     
00344     /// This method returns the color value from a palette.
00345     ///
00346     /// This method accepts a pointer to a Bitmap color palette, which
00347     /// is a table in memory composed of RGB Quad values (r, g, b, 0),
00348     /// and an index into that table. It then extracts the color information
00349     /// and downsamples it to a color_t value which it returns.
00350     ///
00351     /// @note This method probably has very little value outside of
00352     ///         the internal methods for reading BMP files.
00353     ///
00354     /// @param[in] colorPaletteArray is the handle to the color palette array to use.
00355     /// @param[in] index is the index into the color palette.
00356     /// @returns the color in color_t format.
00357     ///
00358     color_t RGBQuadToRGB16(RGBQUAD * colorPaletteArray, uint16_t index);
00359     
00360     /// This method converts a 16-bit color value into a 24-bit RGB Quad.
00361     ///
00362     /// @param[in] c is the 16-bit color. @see color_t.
00363     /// @returns an RGBQUAD value. @see RGBQUAD
00364     ///
00365     RGBQUAD RGB16ToRGBQuad(color_t c);
00366 
00367     /// This method attempts to render a specified graphics image file at
00368     /// the specified screen location.
00369     ///
00370     /// This supports several variants of the following file types:
00371     /// \li Bitmap file format,
00372     /// \li Icon file format.
00373     ///
00374     /// @note The specified image width and height, when adjusted for the 
00375     ///     x and y origin, must fit on the screen, or the image will not
00376     ///     be shown (it does not clip the image).
00377     ///
00378     /// @note The file extension is tested, and if it ends in a supported
00379     ///     format, the appropriate handler is called to render that image.
00380     ///
00381     /// @param[in] x is the horizontal pixel coordinate
00382     /// @param[in] y is the vertical pixel coordinate
00383     /// @param[in] FileName refers to the fully qualified path and file on 
00384     ///     a mounted file system.
00385     /// @returns success or error code.
00386     ///
00387     RetCode_t RenderImageFile(loc_t x, loc_t y, const char *FileName);
00388 
00389     /// This method reads a disk file that is in jpeg format and 
00390     /// puts it on the screen.
00391     ///
00392     /// @param[in] x is the horizontal pixel coordinate
00393     /// @param[in] y is the vertical pixel coordinate
00394     /// @param[in] Name_JPG is the filename on the mounted file system.
00395     /// @returns success or error code.
00396     ///
00397     RetCode_t RenderJpegFile(loc_t x, loc_t y, const char *Name_JPG);
00398 
00399     /// This method reads a disk file that is in bitmap format and 
00400     /// puts it on the screen.
00401     ///
00402     /// Supported formats:
00403     /// \li 1-bit color format  (2 colors)
00404     /// \li 4-bit color format  (16 colors)
00405     /// \li 8-bit color format  (256 colors)
00406     /// \li 16-bit color format (65k colors)
00407     /// \li 24-bit color format (16M colors)
00408     /// \li compression: no.
00409     ///
00410     /// @note This is a slow operation, typically due to the use of
00411     ///         the file system, and partially because bmp files
00412     ///         are stored from the bottom up, and the memory is written
00413     ///         from the top down; as a result, it constantly 'seeks'
00414     ///         on the file system for the next row of information.
00415     ///
00416     /// As a performance test, a sample picture was timed. A family picture
00417     /// was converted to Bitmap format; shrunk to 352 x 272 pixels and save
00418     /// in 8-bit color format. The resulting file size was 94.5 KByte.
00419     /// The SPI port interface was set to 20 MHz.
00420     /// The original bitmap rendering software was purely in software, 
00421     /// pushing 1 pixel at a time to the write function, which did use SPI
00422     /// hardware (not pin wiggling) to transfer commands and data to the 
00423     /// display. Then, the driver was improved to leverage the capability
00424     /// of the derived display driver. As a final check, instead of the
00425     /// [known slow] local file system, a randomly chosen USB stick was 
00426     /// used. The performance results are impressive (but depend on the
00427     /// listed factors). 
00428     ///
00429     /// \li 34 seconds, LocalFileSystem, Software Rendering
00430     /// \li 9 seconds, LocalFileSystem, Hardware Rending for RA8875
00431     /// \li 3 seconds, MSCFileSystem, Hardware Rendering for RA8875
00432     /// 
00433     /// @param[in] x is the horizontal pixel coordinate
00434     /// @param[in] y is the vertical pixel coordinate
00435     /// @param[in] Name_BMP is the filename on the mounted file system.
00436     /// @returns success or error code.
00437     ///
00438     RetCode_t RenderBitmapFile(loc_t x, loc_t y, const char *Name_BMP);
00439     
00440     
00441     /// This method reads a disk file that is in ico format and 
00442     /// puts it on the screen.
00443     ///
00444     /// Reading the disk is slow, but a typical icon file is small
00445     /// so it should be ok.
00446     ///
00447     /// @note An Icon file can have more than one icon in it. This
00448     ///     implementation only processes the first image in the file.
00449     ///
00450     /// @param[in] x is the horizontal pixel coordinate
00451     /// @param[in] y is the vertical pixel coordinate
00452     /// @param[in] Name_ICO is the filename on the mounted file system.
00453     /// @returns success or error code.
00454     ///
00455     RetCode_t RenderIconFile(loc_t x, loc_t y, const char *Name_ICO);
00456 
00457     
00458     /// prints one character at the specified coordinates.
00459     ///
00460     /// This will print the character at the specified pixel coordinates.
00461     ///
00462     /// @param[in] x is the horizontal offset in pixels.
00463     /// @param[in] y is the vertical offset in pixels.
00464     /// @param[in] value is the character to print.
00465     /// @returns number of pixels to index to the right if a character was printed, 0 otherwise.
00466     ///
00467     virtual int character(int x, int y, int value);
00468     
00469     /// get the number of colums based on the currently active font
00470     ///
00471     /// @returns number of columns.
00472     ///    
00473     virtual int columns(void);
00474 
00475     /// get the number of rows based on the currently active font
00476     ///
00477     /// @returns number of rows.
00478     ///    
00479     virtual int rows(void);
00480     
00481     /// Select a User Font for all subsequent text.
00482     ///
00483     /// @note Tool to create the fonts is accessible from its creator
00484     ///     available at http://www.mikroe.com. 
00485     ///     For version 1.2.0.0, choose the "Export for TFT and new GLCD"
00486     ///     format.
00487     ///
00488     /// @param[in] font is a pointer to a specially formed font resource.
00489     /// @returns error code.
00490     ///
00491     virtual RetCode_t SelectUserFont(const uint8_t * font = NULL);
00492 
00493 
00494 protected:
00495 
00496     /// Pure virtual method indicating the start of a graphics stream.
00497     ///
00498     /// This is called prior to a stream of pixel data being sent.
00499     /// This may cause register configuration changes in the derived
00500     /// class in order to prepare the hardware to accept the streaming
00501     /// data.
00502     ///
00503     /// @note this method must be supported in the derived class.
00504     ///
00505     /// @returns error code.
00506     ///
00507     virtual RetCode_t _StartGraphicsStream(void) = 0;
00508     
00509     /// Pure virtual method indicating the end of a graphics stream.
00510     ///
00511     /// This is called to conclude a stream of pixel data that was sent.
00512     /// This may cause register configuration changes in the derived
00513     /// class in order to stop the hardware from accept the streaming
00514     /// data.
00515     ///
00516     /// @note this method must be supported in the derived class.
00517     ///
00518     /// @returns error code.
00519     ///
00520     virtual RetCode_t _EndGraphicsStream(void) = 0;
00521 
00522     /// Protected method to render an image given a file handle and 
00523     /// coordinates.
00524     ///
00525     /// @param[in] x is the horizontal pixel coordinate
00526     /// @param[in] y is the vertical pixel coordinate
00527     /// @param[in] fileOffset is the offset into the file where the image data starts
00528     /// @param[in] Image is the filename stream already opened for the data.
00529     /// @returns success or error code.
00530     ///
00531     RetCode_t _RenderBitmap(loc_t x, loc_t y, uint32_t fileOffset, FILE * Image);
00532 
00533 private:
00534 
00535     loc_t img_x;    /// x position of a rendered jpg
00536     loc_t img_y;    /// y position of a rendered jpg
00537 
00538     /// Analyze the jpeg data in preparation for decompression.
00539     ///
00540     JRESULT jd_prepare(JDEC * jd, uint16_t(* infunc)(JDEC * jd, uint8_t * buffer, uint16_t bufsize), void * pool, uint16_t poolsize, void * filehandle);
00541     
00542     /// Decompress the jpeg and render it.
00543     ///
00544     JRESULT jd_decomp(JDEC * jd, uint16_t(* outfunct)(JDEC * jd, void * stream, JRECT * rect), uint8_t scale);
00545 
00546     /// helper function to read data from the file system
00547     ///
00548     uint16_t privInFunc(JDEC * jd, uint8_t * buff, uint16_t ndata);
00549 
00550     /// helper function to read data from the file system
00551     ///
00552     uint16_t getJpegData(JDEC * jd, uint8_t *buff, uint16_t ndata);
00553 
00554     /// helper function to write data to the display
00555     ///
00556     uint16_t privOutFunc(JDEC * jd, void * bitmap, JRECT * rect);
00557     
00558     JRESULT mcu_output (
00559         JDEC * jd,   /* Pointer to the decompressor object */
00560         uint16_t (* outfunc)(JDEC * jd, void * stream, JRECT * rect),  /* RGB output function */
00561         uint16_t x,     /* MCU position in the image (left of the MCU) */
00562         uint16_t y      /* MCU position in the image (top of the MCU) */
00563     );
00564 
00565     int16_t bitext (    /* >=0: extracted data, <0: error code */
00566         JDEC * jd,   /* Pointer to the decompressor object */
00567         uint16_t nbit   /* Number of bits to extract (1 to 11) */
00568     );
00569 
00570     int16_t huffext (           /* >=0: decoded data, <0: error code */
00571         JDEC * jd,           /* Pointer to the decompressor object */
00572         const uint8_t * hbits,  /* Pointer to the bit distribution table */
00573         const uint16_t * hcode,  /* Pointer to the code word table */
00574         const uint8_t * hdata   /* Pointer to the data table */
00575     );
00576 
00577     JRESULT restart (
00578         JDEC * jd,   /* Pointer to the decompressor object */
00579         uint16_t rstn   /* Expected restert sequense number */
00580     );
00581 
00582     JRESULT mcu_load (
00583         JDEC * jd        /* Pointer to the decompressor object */
00584     );
00585 
00586 
00587 protected:
00588     /// Pure virtual method to write a boolean stream to the display.
00589     ///
00590     /// This takes a bit stream in memory and using the current color settings
00591     /// it will stream it to the display. Along the way, each bit is translated
00592     /// to either the foreground or background color value and then that pixel
00593     /// is pushed onward.
00594     ///
00595     /// This is similar, but different, to the @ref pixelStream API, which is 
00596     /// given a stream of color values.
00597     /// 
00598     /// @param[in] x is the horizontal position on the display.
00599     /// @param[in] y is the vertical position on the display.
00600     /// @param[in] w is the width of the rectangular region to fill.
00601     /// @param[in] h is the height of the rectangular region to fill.
00602     /// @param[in] boolStream is the inline memory image from which to extract
00603     ///         the bitstream.
00604     /// @returns success/failure code. See @ref RetCode_t.
00605     ///
00606     virtual RetCode_t booleanStream(loc_t x, loc_t y, dim_t w, dim_t h, const uint8_t * boolStream) = 0;
00607     
00608 
00609     const unsigned char * font;     ///< reference to an external font somewhere in memory
00610     
00611     // pixel location
00612     short _x;                       ///< keeps track of current X location
00613     short _y;                       ///< keeps track of current Y location
00614     
00615     rect_t windowrect;              ///< window commands are held here for speed of access 
00616 };
00617 
00618 #endif
00619