Forked para SNOCC
Fork of RA8875 by
GraphicsDisplay.h@29:422616aa04bd, 2014-01-19 (annotated)
- Committer:
- WiredHome
- Date:
- Sun Jan 19 04:24:16 2014 +0000
- Revision:
- 29:422616aa04bd
- Parent:
- 19:3f82c1161fd2
- Child:
- 31:c72e12cd5c67
Initial support for soft fonts compatible with mikroe font creator.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dreschpe | 0:de9d1462a835 | 1 | /* mbed GraphicsDisplay Display Library Base Class |
dreschpe | 0:de9d1462a835 | 2 | * Copyright (c) 2007-2009 sford |
dreschpe | 0:de9d1462a835 | 3 | * Released under the MIT License: http://mbed.org/license/mit |
dreschpe | 0:de9d1462a835 | 4 | * |
dreschpe | 0:de9d1462a835 | 5 | * A library for providing a common base class for Graphics displays |
dreschpe | 0:de9d1462a835 | 6 | * To port a new display, derive from this class and implement |
dreschpe | 0:de9d1462a835 | 7 | * the constructor (setup the display), pixel (put a pixel |
dreschpe | 0:de9d1462a835 | 8 | * at a location), width and height functions. Everything else |
dreschpe | 0:de9d1462a835 | 9 | * (locate, printf, putc, cls, window, putp, fill, blit, blitbit) |
dreschpe | 0:de9d1462a835 | 10 | * will come for free. You can also provide a specialised implementation |
dreschpe | 0:de9d1462a835 | 11 | * of window and putp to speed up the results |
dreschpe | 0:de9d1462a835 | 12 | */ |
dreschpe | 0:de9d1462a835 | 13 | |
dreschpe | 0:de9d1462a835 | 14 | #ifndef MBED_GRAPHICSDISPLAY_H |
dreschpe | 0:de9d1462a835 | 15 | #define MBED_GRAPHICSDISPLAY_H |
dreschpe | 0:de9d1462a835 | 16 | |
dreschpe | 0:de9d1462a835 | 17 | #include "TextDisplay.h" |
dreschpe | 0:de9d1462a835 | 18 | |
dreschpe | 0:de9d1462a835 | 19 | class GraphicsDisplay : public TextDisplay { |
dreschpe | 0:de9d1462a835 | 20 | |
dreschpe | 0:de9d1462a835 | 21 | public: |
dreschpe | 0:de9d1462a835 | 22 | |
dreschpe | 0:de9d1462a835 | 23 | GraphicsDisplay(const char* name); |
dreschpe | 0:de9d1462a835 | 24 | |
WiredHome | 19:3f82c1161fd2 | 25 | virtual RetCode_t pixel(unsigned int x, unsigned int y, color_t colour) = 0; |
dreschpe | 0:de9d1462a835 | 26 | virtual int width() = 0; |
dreschpe | 0:de9d1462a835 | 27 | virtual int height() = 0; |
dreschpe | 0:de9d1462a835 | 28 | |
dreschpe | 11:9bb71766cafc | 29 | virtual void window(unsigned int x,unsigned int y,unsigned int w,unsigned int h); |
dreschpe | 0:de9d1462a835 | 30 | virtual void putp(int colour); |
dreschpe | 0:de9d1462a835 | 31 | |
WiredHome | 19:3f82c1161fd2 | 32 | virtual RetCode_t cls(); |
dreschpe | 0:de9d1462a835 | 33 | virtual void fill(int x, int y, int w, int h, int colour); |
WiredHome | 29:422616aa04bd | 34 | virtual void blit(int x, int y, int w, int h, const int * colour); |
WiredHome | 29:422616aa04bd | 35 | |
WiredHome | 29:422616aa04bd | 36 | virtual int blitbit(int x, int y, int w, int h, const char * colour); |
dreschpe | 0:de9d1462a835 | 37 | |
WiredHome | 29:422616aa04bd | 38 | /// This method transfers one character from the external font data |
WiredHome | 29:422616aa04bd | 39 | /// to the screen. |
WiredHome | 29:422616aa04bd | 40 | /// |
WiredHome | 29:422616aa04bd | 41 | /// @note the font data is in a special format as generate by |
WiredHome | 29:422616aa04bd | 42 | /// the mikroe font creator. \\ |
WiredHome | 29:422616aa04bd | 43 | /// See http://www.mikroe.com/glcd-font-creator/ |
WiredHome | 29:422616aa04bd | 44 | /// |
WiredHome | 29:422616aa04bd | 45 | /// @param x is the horizontal pixel coordinate |
WiredHome | 29:422616aa04bd | 46 | /// @param y is the vertical pixel coordinate |
WiredHome | 29:422616aa04bd | 47 | /// @param fontTable is the base of the table which has the metrics |
WiredHome | 29:422616aa04bd | 48 | /// @param fontChar is the start of that record in the table for the char (e.g. 'A' - 'Z') |
WiredHome | 29:422616aa04bd | 49 | /// @returns how far the cursor should advance to the right in pixels |
WiredHome | 29:422616aa04bd | 50 | /// |
WiredHome | 29:422616aa04bd | 51 | virtual int fontblit(int x, int y, const unsigned char * fontTable, const unsigned char * fontChar); |
WiredHome | 29:422616aa04bd | 52 | |
WiredHome | 29:422616aa04bd | 53 | /// prints one character at the specified coordinates. |
WiredHome | 29:422616aa04bd | 54 | /// |
WiredHome | 29:422616aa04bd | 55 | /// This will print the character at the specified pixel coordinates. |
WiredHome | 29:422616aa04bd | 56 | /// |
WiredHome | 29:422616aa04bd | 57 | /// @param x is the horizontal offset in pixels. |
WiredHome | 29:422616aa04bd | 58 | /// @param y is the vertical offset in pixels. |
WiredHome | 29:422616aa04bd | 59 | /// @param value is the character to print. |
WiredHome | 29:422616aa04bd | 60 | /// @returns number of pixels to index to the right if a character was printed, 0 otherwise. |
WiredHome | 29:422616aa04bd | 61 | /// |
WiredHome | 29:422616aa04bd | 62 | virtual int character(int x, int y, int value); |
WiredHome | 29:422616aa04bd | 63 | |
dreschpe | 0:de9d1462a835 | 64 | virtual int columns(); |
dreschpe | 0:de9d1462a835 | 65 | virtual int rows(); |
WiredHome | 29:422616aa04bd | 66 | virtual RetCode_t set_font(const unsigned char * font = NULL); |
dreschpe | 0:de9d1462a835 | 67 | |
dreschpe | 0:de9d1462a835 | 68 | protected: |
WiredHome | 29:422616aa04bd | 69 | const unsigned char * font; ///< reference to an external font somewhere in memory |
WiredHome | 29:422616aa04bd | 70 | |
dreschpe | 0:de9d1462a835 | 71 | // pixel location |
dreschpe | 0:de9d1462a835 | 72 | short _x; |
dreschpe | 0:de9d1462a835 | 73 | short _y; |
dreschpe | 0:de9d1462a835 | 74 | |
dreschpe | 0:de9d1462a835 | 75 | // window location |
dreschpe | 0:de9d1462a835 | 76 | short _x1; |
dreschpe | 0:de9d1462a835 | 77 | short _x2; |
dreschpe | 0:de9d1462a835 | 78 | short _y1; |
dreschpe | 0:de9d1462a835 | 79 | short _y2; |
dreschpe | 0:de9d1462a835 | 80 | }; |
dreschpe | 0:de9d1462a835 | 81 | |
dreschpe | 0:de9d1462a835 | 82 | #endif |