KSM edits to RA8875

Dependents:   Liz_Test_Code

GraphicsDisplay.h

Committer:
WiredHome
Date:
2014-01-19
Revision:
29:422616aa04bd
Parent:
19:3f82c1161fd2
Child:
31:c72e12cd5c67

File content as of revision 29:422616aa04bd:

/* mbed GraphicsDisplay Display Library Base Class
 * Copyright (c) 2007-2009 sford
 * Released under the MIT License: http://mbed.org/license/mit
 *
 * A library for providing a common base class for Graphics displays
 * To port a new display, derive from this class and implement
 * the constructor (setup the display), pixel (put a pixel
 * at a location), width and height functions. Everything else
 * (locate, printf, putc, cls, window, putp, fill, blit, blitbit) 
 * will come for free. You can also provide a specialised implementation
 * of window and putp to speed up the results
 */

#ifndef MBED_GRAPHICSDISPLAY_H
#define MBED_GRAPHICSDISPLAY_H

#include "TextDisplay.h"

class GraphicsDisplay : public TextDisplay {

public:         
          
    GraphicsDisplay(const char* name);
     
    virtual RetCode_t pixel(unsigned int x, unsigned int y, color_t colour) = 0;
    virtual int width() = 0;
    virtual int height() = 0;
        
    virtual void window(unsigned int x,unsigned int y,unsigned int w,unsigned int h);
    virtual void putp(int colour);
    
    virtual RetCode_t cls();
    virtual void fill(int x, int y, int w, int h, int colour);
    virtual void blit(int x, int y, int w, int h, const int * colour);    
    
    virtual int blitbit(int x, int y, int w, int h, const char * colour);
    
    /// This method transfers one character from the external font data
    /// to the screen.
    ///
    /// @note the font data is in a special format as generate by
    ///         the mikroe font creator. \\
    ///         See http://www.mikroe.com/glcd-font-creator/
    ///
    /// @param x is the horizontal pixel coordinate
    /// @param y is the vertical pixel coordinate
    /// @param fontTable is the base of the table which has the metrics
    /// @param fontChar is the start of that record in the table for the char (e.g. 'A' - 'Z')
    /// @returns how far the cursor should advance to the right in pixels
    ///
    virtual int fontblit(int x, int y, const unsigned char * fontTable, const unsigned char * fontChar);
    
    /// prints one character at the specified coordinates.
    ///
    /// This will print the character at the specified pixel coordinates.
    ///
    /// @param x is the horizontal offset in pixels.
    /// @param y is the vertical offset in pixels.
    /// @param value is the character to print.
    /// @returns number of pixels to index to the right if a character was printed, 0 otherwise.
    ///
    virtual int character(int x, int y, int value);
    
    virtual int columns();
    virtual int rows();
    virtual RetCode_t set_font(const unsigned char * font = NULL);
    
protected:
    const unsigned char * font;     ///< reference to an external font somewhere in memory
    
    // pixel location
    short _x;
    short _y;
    
    // window location
    short _x1;
    short _x2;
    short _y1;
    short _y2;
};

#endif