KSM edits to RA8875

Dependents:   Liz_Test_Code

Committer:
WiredHome
Date:
Mon Jan 20 19:19:48 2014 +0000
Revision:
31:c72e12cd5c67
Parent:
29:422616aa04bd
Child:
32:0e4f2ae512e2
Support for Bitmap graphics (tested 4-bit and 8-bit formats, have not tested 1-bit or 24-bit).

Who changed what in which revision?

UserRevisionLine numberNew 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);
WiredHome 31:c72e12cd5c67 30 virtual void WindowMax(void);
WiredHome 31:c72e12cd5c67 31 virtual void putp(color_t colour);
dreschpe 0:de9d1462a835 32
WiredHome 19:3f82c1161fd2 33 virtual RetCode_t cls();
WiredHome 31:c72e12cd5c67 34 virtual void fill(int x, int y, int w, int h, color_t colour);
WiredHome 29:422616aa04bd 35 virtual void blit(int x, int y, int w, int h, const int * colour);
WiredHome 29:422616aa04bd 36
WiredHome 29:422616aa04bd 37 virtual int blitbit(int x, int y, int w, int h, const char * colour);
dreschpe 0:de9d1462a835 38
WiredHome 29:422616aa04bd 39 /// This method transfers one character from the external font data
WiredHome 29:422616aa04bd 40 /// to the screen.
WiredHome 29:422616aa04bd 41 ///
WiredHome 29:422616aa04bd 42 /// @note the font data is in a special format as generate by
WiredHome 29:422616aa04bd 43 /// the mikroe font creator. \\
WiredHome 29:422616aa04bd 44 /// See http://www.mikroe.com/glcd-font-creator/
WiredHome 29:422616aa04bd 45 ///
WiredHome 29:422616aa04bd 46 /// @param x is the horizontal pixel coordinate
WiredHome 29:422616aa04bd 47 /// @param y is the vertical pixel coordinate
WiredHome 29:422616aa04bd 48 /// @param fontTable is the base of the table which has the metrics
WiredHome 29:422616aa04bd 49 /// @param fontChar is the start of that record in the table for the char (e.g. 'A' - 'Z')
WiredHome 29:422616aa04bd 50 /// @returns how far the cursor should advance to the right in pixels
WiredHome 29:422616aa04bd 51 ///
WiredHome 29:422616aa04bd 52 virtual int fontblit(int x, int y, const unsigned char * fontTable, const unsigned char * fontChar);
WiredHome 29:422616aa04bd 53
WiredHome 31:c72e12cd5c67 54 /// This method reads a disk file that is in bitmap format and
WiredHome 31:c72e12cd5c67 55 /// puts it on the screen.
WiredHome 31:c72e12cd5c67 56 ///
WiredHome 31:c72e12cd5c67 57 /// @note This only reads 16-bit bitmap format.
WiredHome 31:c72e12cd5c67 58 /// @note This is a slow operation, partially due to the use of
WiredHome 31:c72e12cd5c67 59 /// the local file system, and partially because bmp files
WiredHome 31:c72e12cd5c67 60 /// are stored from the bottom up, and the memory is written
WiredHome 31:c72e12cd5c67 61 /// from the top down.
WiredHome 31:c72e12cd5c67 62 ///
WiredHome 31:c72e12cd5c67 63 /// @param x is the horizontal pixel coordinate
WiredHome 31:c72e12cd5c67 64 /// @param y is the vertical pixel coordinate
WiredHome 31:c72e12cd5c67 65 /// @param Name_BMP is the filename on the local file system.
WiredHome 31:c72e12cd5c67 66 /// @returns success or error code.
WiredHome 31:c72e12cd5c67 67 ///
WiredHome 31:c72e12cd5c67 68 RetCode_t BMP_16(unsigned int x, unsigned int y, const char *Name_BMP);
WiredHome 31:c72e12cd5c67 69
WiredHome 29:422616aa04bd 70 /// prints one character at the specified coordinates.
WiredHome 29:422616aa04bd 71 ///
WiredHome 29:422616aa04bd 72 /// This will print the character at the specified pixel coordinates.
WiredHome 29:422616aa04bd 73 ///
WiredHome 29:422616aa04bd 74 /// @param x is the horizontal offset in pixels.
WiredHome 29:422616aa04bd 75 /// @param y is the vertical offset in pixels.
WiredHome 29:422616aa04bd 76 /// @param value is the character to print.
WiredHome 29:422616aa04bd 77 /// @returns number of pixels to index to the right if a character was printed, 0 otherwise.
WiredHome 29:422616aa04bd 78 ///
WiredHome 29:422616aa04bd 79 virtual int character(int x, int y, int value);
WiredHome 29:422616aa04bd 80
dreschpe 0:de9d1462a835 81 virtual int columns();
dreschpe 0:de9d1462a835 82 virtual int rows();
WiredHome 29:422616aa04bd 83 virtual RetCode_t set_font(const unsigned char * font = NULL);
dreschpe 0:de9d1462a835 84
dreschpe 0:de9d1462a835 85 protected:
WiredHome 29:422616aa04bd 86 const unsigned char * font; ///< reference to an external font somewhere in memory
WiredHome 29:422616aa04bd 87
dreschpe 0:de9d1462a835 88 // pixel location
dreschpe 0:de9d1462a835 89 short _x;
dreschpe 0:de9d1462a835 90 short _y;
dreschpe 0:de9d1462a835 91
dreschpe 0:de9d1462a835 92 // window location
dreschpe 0:de9d1462a835 93 short _x1;
dreschpe 0:de9d1462a835 94 short _x2;
dreschpe 0:de9d1462a835 95 short _y1;
dreschpe 0:de9d1462a835 96 short _y2;
dreschpe 0:de9d1462a835 97 };
dreschpe 0:de9d1462a835 98
dreschpe 0:de9d1462a835 99 #endif