Forked para SNOCC

Dependencies:   GPS

Dependents:   SNOCC_V1 SNOCC_V2

Fork of RA8875 by SNOCC

Committer:
WiredHome
Date:
Sun Feb 23 17:58:39 2014 +0000
Revision:
42:7cbdfd2bbfc5
Parent:
41:2956a0a221e5
Child:
55:dfbabef7003e
Added initial support for .ico file format (does not yet account for them being 2 x height for the mask), but this permitted generalizing the API for loading an image from the file system.

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
WiredHome 32:0e4f2ae512e2 16 #include "Bitmap.h"
dreschpe 0:de9d1462a835 17 #include "TextDisplay.h"
dreschpe 0:de9d1462a835 18
WiredHome 37:f19b7e7449dc 19 // GraphicsDisplay has one "soft font" which is in a different format
WiredHome 37:f19b7e7449dc 20 // then the primary font rendering api - see set_font(...). This is
WiredHome 37:f19b7e7449dc 21 // therefore deprecated, but preserved for a time for backward
WiredHome 37:f19b7e7449dc 22 // compatibility.
WiredHome 37:f19b7e7449dc 23 // #define LOCALFONT
WiredHome 37:f19b7e7449dc 24
WiredHome 37:f19b7e7449dc 25
WiredHome 32:0e4f2ae512e2 26 /// The GraphicsDisplay class
WiredHome 32:0e4f2ae512e2 27 ///
WiredHome 32:0e4f2ae512e2 28 /// This graphics display class supports both graphics and text operations.
WiredHome 32:0e4f2ae512e2 29 /// Typically, a subclass is derived from this which has localizations to
WiredHome 32:0e4f2ae512e2 30 /// adapt to a specific hardware platform (e.g. a display controller chip),
WiredHome 32:0e4f2ae512e2 31 /// that overrides methods in here to either add more capability or perhaps
WiredHome 32:0e4f2ae512e2 32 /// to improve performance, by leveraging specific hardware capabilities.
WiredHome 32:0e4f2ae512e2 33 ///
WiredHome 32:0e4f2ae512e2 34 class GraphicsDisplay : public TextDisplay
WiredHome 32:0e4f2ae512e2 35 {
WiredHome 32:0e4f2ae512e2 36 public:
WiredHome 32:0e4f2ae512e2 37 /// The constructor
dreschpe 0:de9d1462a835 38 GraphicsDisplay(const char* name);
WiredHome 32:0e4f2ae512e2 39
WiredHome 32:0e4f2ae512e2 40 /// Draw a pixel in the specified color.
WiredHome 32:0e4f2ae512e2 41 ///
WiredHome 32:0e4f2ae512e2 42 /// @note this method must be supported in the derived class.
WiredHome 32:0e4f2ae512e2 43 ///
WiredHome 32:0e4f2ae512e2 44 /// @param x is the horizontal offset to this pixel.
WiredHome 32:0e4f2ae512e2 45 /// @param y is the vertical offset to this pixel.
WiredHome 32:0e4f2ae512e2 46 /// @param color defines the color for the pixel.
WiredHome 32:0e4f2ae512e2 47 /// @returns success/failure code. @see RetCode_t.
WiredHome 32:0e4f2ae512e2 48 ///
WiredHome 37:f19b7e7449dc 49 virtual RetCode_t pixel(loc_t x, loc_t y, color_t color) = 0;
WiredHome 32:0e4f2ae512e2 50
WiredHome 41:2956a0a221e5 51 /// Write a stream of pixels to the display.
WiredHome 41:2956a0a221e5 52 ///
WiredHome 41:2956a0a221e5 53 /// @note this method must be supported in the derived class.
WiredHome 41:2956a0a221e5 54 ///
WiredHome 41:2956a0a221e5 55 /// @param p is a pointer to a color_t array to write.
WiredHome 41:2956a0a221e5 56 /// @param count is the number of pixels to write.
WiredHome 41:2956a0a221e5 57 /// @param x is the horizontal position on the display.
WiredHome 41:2956a0a221e5 58 /// @param y is the vertical position on the display.
WiredHome 41:2956a0a221e5 59 /// @returns success/failure code. @see RetCode_t.
WiredHome 41:2956a0a221e5 60 ///
WiredHome 41:2956a0a221e5 61 virtual RetCode_t pixelStream(color_t * p, uint32_t count, loc_t x, loc_t y) = 0;
WiredHome 41:2956a0a221e5 62
WiredHome 41:2956a0a221e5 63 /// Get a pixel from the display.
WiredHome 41:2956a0a221e5 64 ///
WiredHome 41:2956a0a221e5 65 /// @note this method must be supported in the derived class.
WiredHome 41:2956a0a221e5 66 ///
WiredHome 41:2956a0a221e5 67 /// @param x is the horizontal offset to this pixel.
WiredHome 41:2956a0a221e5 68 /// @param y is the vertical offset to this pixel.
WiredHome 41:2956a0a221e5 69 /// @returns the pixel. see @color_t
WiredHome 41:2956a0a221e5 70 ///
WiredHome 41:2956a0a221e5 71 virtual color_t getPixel(loc_t x, loc_t y) = 0;
WiredHome 41:2956a0a221e5 72
WiredHome 41:2956a0a221e5 73 /// Get a stream of pixels from the display.
WiredHome 41:2956a0a221e5 74 ///
WiredHome 41:2956a0a221e5 75 /// @note this method must be supported in the derived class.
WiredHome 41:2956a0a221e5 76 ///
WiredHome 41:2956a0a221e5 77 /// @param p is a pointer to a color_t array to accept the stream.
WiredHome 41:2956a0a221e5 78 /// @param count is the number of pixels to read.
WiredHome 41:2956a0a221e5 79 /// @param x is the horizontal offset to this pixel.
WiredHome 41:2956a0a221e5 80 /// @param y is the vertical offset to this pixel.
WiredHome 41:2956a0a221e5 81 /// @returns success/failure code. @see RetCode_t.
WiredHome 41:2956a0a221e5 82 ///
WiredHome 41:2956a0a221e5 83 virtual RetCode_t getPixelStream(color_t * p, uint32_t count, loc_t x, loc_t y) = 0;
WiredHome 41:2956a0a221e5 84
WiredHome 32:0e4f2ae512e2 85 /// get the screen width in pixels
WiredHome 32:0e4f2ae512e2 86 ///
WiredHome 32:0e4f2ae512e2 87 /// @note this method must be supported in the derived class.
WiredHome 32:0e4f2ae512e2 88 ///
WiredHome 32:0e4f2ae512e2 89 /// @returns screen width in pixels.
WiredHome 32:0e4f2ae512e2 90 ///
WiredHome 32:0e4f2ae512e2 91 virtual uint16_t width() = 0;
WiredHome 32:0e4f2ae512e2 92
WiredHome 32:0e4f2ae512e2 93 /// get the screen height in pixels
WiredHome 32:0e4f2ae512e2 94 ///
WiredHome 32:0e4f2ae512e2 95 /// @note this method must be supported in the derived class.
WiredHome 32:0e4f2ae512e2 96 ///
WiredHome 32:0e4f2ae512e2 97 /// @returns screen height in pixels.
WiredHome 32:0e4f2ae512e2 98 ///
WiredHome 32:0e4f2ae512e2 99 virtual uint16_t height() = 0;
WiredHome 32:0e4f2ae512e2 100
WiredHome 32:0e4f2ae512e2 101 /// Prepare the controller to write binary data to the screen by positioning
WiredHome 32:0e4f2ae512e2 102 /// the memory cursor.
WiredHome 32:0e4f2ae512e2 103 ///
WiredHome 32:0e4f2ae512e2 104 /// @note this method must be supported in the derived class.
WiredHome 32:0e4f2ae512e2 105 ///
WiredHome 32:0e4f2ae512e2 106 /// @param x is the horizontal position in pixels (from the left edge)
WiredHome 32:0e4f2ae512e2 107 /// @param y is the vertical position in pixels (from the top edge)
WiredHome 32:0e4f2ae512e2 108 /// @returns success/failure code. @see RetCode_t.
WiredHome 32:0e4f2ae512e2 109 ///
WiredHome 37:f19b7e7449dc 110 virtual RetCode_t SetGraphicsCursor(loc_t x, loc_t y) = 0;
WiredHome 32:0e4f2ae512e2 111
WiredHome 41:2956a0a221e5 112 /// Prepare the controller to read binary data from the screen by positioning
WiredHome 41:2956a0a221e5 113 /// the memory read cursor.
WiredHome 41:2956a0a221e5 114 ///
WiredHome 41:2956a0a221e5 115 /// @param x is the horizontal position in pixels (from the left edge)
WiredHome 41:2956a0a221e5 116 /// @param y is the vertical position in pixels (from the top edge)
WiredHome 41:2956a0a221e5 117 /// @returns success/failure code. @see RetCode_t.
WiredHome 41:2956a0a221e5 118 ///
WiredHome 41:2956a0a221e5 119 virtual RetCode_t SetGraphicsCursorRead(loc_t x, loc_t y) = 0;
WiredHome 41:2956a0a221e5 120
WiredHome 32:0e4f2ae512e2 121 /// Draw a filled rectangle in the specified color
WiredHome 32:0e4f2ae512e2 122 ///
WiredHome 32:0e4f2ae512e2 123 /// @note As a side effect, this changes the current
WiredHome 32:0e4f2ae512e2 124 /// foreground color for subsequent operations.
WiredHome 32:0e4f2ae512e2 125 ///
WiredHome 32:0e4f2ae512e2 126 /// @note this method must be supported in the derived class.
WiredHome 32:0e4f2ae512e2 127 ///
WiredHome 32:0e4f2ae512e2 128 /// @param x1 is the horizontal start of the line.
WiredHome 32:0e4f2ae512e2 129 /// @param y1 is the vertical start of the line.
WiredHome 32:0e4f2ae512e2 130 /// @param x2 is the horizontal end of the line.
WiredHome 32:0e4f2ae512e2 131 /// @param y2 is the vertical end of the line.
WiredHome 32:0e4f2ae512e2 132 /// @param color defines the foreground color.
WiredHome 32:0e4f2ae512e2 133 /// @param fillit is optional to NOFILL the rectangle. default is FILL.
WiredHome 32:0e4f2ae512e2 134 /// @returns success/failure code. @see RetCode_t.
WiredHome 32:0e4f2ae512e2 135 ///
WiredHome 37:f19b7e7449dc 136 virtual RetCode_t fillrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2,
WiredHome 32:0e4f2ae512e2 137 color_t color, fill_t fillit = FILL) = 0;
WiredHome 32:0e4f2ae512e2 138
WiredHome 32:0e4f2ae512e2 139
WiredHome 32:0e4f2ae512e2 140 virtual RetCode_t WriteCommand(unsigned char command, unsigned int data = 0xFFFF) = 0;
WiredHome 32:0e4f2ae512e2 141 virtual RetCode_t WriteData(unsigned char data) = 0;
WiredHome 32:0e4f2ae512e2 142
WiredHome 32:0e4f2ae512e2 143 /// Set the window, which controls where items are written to the screen.
WiredHome 32:0e4f2ae512e2 144 ///
WiredHome 32:0e4f2ae512e2 145 /// When something hits the window width, it wraps back to the left side
WiredHome 32:0e4f2ae512e2 146 /// and down a row. If the initial write is outside the window, it will
WiredHome 32:0e4f2ae512e2 147 /// be captured into the window when it crosses a boundary.
WiredHome 32:0e4f2ae512e2 148 ///
WiredHome 32:0e4f2ae512e2 149 /// @param x is the left edge in pixels.
WiredHome 32:0e4f2ae512e2 150 /// @param y is the top edge in pixels.
WiredHome 33:b6b710758ab3 151 /// @param w is the window width in pixels.
WiredHome 33:b6b710758ab3 152 /// @param h is the window height in pixels.
WiredHome 32:0e4f2ae512e2 153 /// @returns success/failure code. @see RetCode_t.
WiredHome 32:0e4f2ae512e2 154 ///
WiredHome 37:f19b7e7449dc 155 virtual RetCode_t window(loc_t x, loc_t y, dim_t w, dim_t h);
WiredHome 32:0e4f2ae512e2 156
WiredHome 32:0e4f2ae512e2 157 /// Clear the screen.
WiredHome 32:0e4f2ae512e2 158 ///
WiredHome 32:0e4f2ae512e2 159 /// The behavior is to clear the whole screen.
WiredHome 32:0e4f2ae512e2 160 ///
WiredHome 32:0e4f2ae512e2 161 /// @returns success/failure code. @see RetCode_t.
WiredHome 32:0e4f2ae512e2 162 ///
WiredHome 32:0e4f2ae512e2 163 virtual RetCode_t cls();
WiredHome 32:0e4f2ae512e2 164
WiredHome 32:0e4f2ae512e2 165
WiredHome 31:c72e12cd5c67 166 virtual void WindowMax(void);
dreschpe 0:de9d1462a835 167
WiredHome 32:0e4f2ae512e2 168 /// method to put a single color pixel to the screen.
WiredHome 32:0e4f2ae512e2 169 ///
WiredHome 32:0e4f2ae512e2 170 /// This method may be called as many times as necessary after
WiredHome 32:0e4f2ae512e2 171 /// @see _StartGraphicsStream() is called, and it should be followed
WiredHome 32:0e4f2ae512e2 172 /// by _EndGraphicsStream.
WiredHome 32:0e4f2ae512e2 173 ///
WiredHome 32:0e4f2ae512e2 174 /// @param pixel is a color value to be put on the screen.
WiredHome 32:0e4f2ae512e2 175 /// @returns error code.
WiredHome 32:0e4f2ae512e2 176 ///
WiredHome 32:0e4f2ae512e2 177 virtual RetCode_t putp(color_t pixel);
WiredHome 32:0e4f2ae512e2 178
WiredHome 32:0e4f2ae512e2 179
WiredHome 33:b6b710758ab3 180 virtual void fill(int x, int y, int w, int h, color_t color);
WiredHome 33:b6b710758ab3 181 virtual void blit(int x, int y, int w, int h, const int * color);
WiredHome 29:422616aa04bd 182
WiredHome 29:422616aa04bd 183 /// This method transfers one character from the external font data
WiredHome 29:422616aa04bd 184 /// to the screen.
WiredHome 29:422616aa04bd 185 ///
WiredHome 29:422616aa04bd 186 /// @note the font data is in a special format as generate by
WiredHome 29:422616aa04bd 187 /// the mikroe font creator. \\
WiredHome 29:422616aa04bd 188 /// See http://www.mikroe.com/glcd-font-creator/
WiredHome 29:422616aa04bd 189 ///
WiredHome 29:422616aa04bd 190 /// @param x is the horizontal pixel coordinate
WiredHome 29:422616aa04bd 191 /// @param y is the vertical pixel coordinate
WiredHome 29:422616aa04bd 192 /// @param fontTable is the base of the table which has the metrics
WiredHome 29:422616aa04bd 193 /// @param fontChar is the start of that record in the table for the char (e.g. 'A' - 'Z')
WiredHome 29:422616aa04bd 194 /// @returns how far the cursor should advance to the right in pixels
WiredHome 29:422616aa04bd 195 ///
WiredHome 29:422616aa04bd 196 virtual int fontblit(int x, int y, const unsigned char * fontTable, const unsigned char * fontChar);
WiredHome 29:422616aa04bd 197
WiredHome 32:0e4f2ae512e2 198 /// This method returns the color value from a palette.
WiredHome 32:0e4f2ae512e2 199 ///
WiredHome 32:0e4f2ae512e2 200 /// This method accepts a pointer to a Bitmap color palette, which
WiredHome 32:0e4f2ae512e2 201 /// is a table in memory composed of RGB Quad values (r, g, b, 0),
WiredHome 32:0e4f2ae512e2 202 /// and an index into that table. It then extracts the color information
WiredHome 32:0e4f2ae512e2 203 /// and downsamples it to a color_t value which it returns.
WiredHome 32:0e4f2ae512e2 204 ///
WiredHome 32:0e4f2ae512e2 205 /// @note This method probably has very little value outside of
WiredHome 32:0e4f2ae512e2 206 /// the internal methods for reading BMP files.
WiredHome 32:0e4f2ae512e2 207 ///
WiredHome 32:0e4f2ae512e2 208 /// @param colorPalette is the handle to the color palette to use.
WiredHome 32:0e4f2ae512e2 209 /// @param i is the index into the color palette.
WiredHome 32:0e4f2ae512e2 210 /// @returns the color in color_t format.
WiredHome 32:0e4f2ae512e2 211 ///
WiredHome 32:0e4f2ae512e2 212 color_t RGBQuadToRGB16(RGBQUAD * colorPalette, uint16_t i);
WiredHome 32:0e4f2ae512e2 213
WiredHome 41:2956a0a221e5 214 /// This method converts a 16-bit color value into a 24-bit RGB Quad.
WiredHome 41:2956a0a221e5 215 ///
WiredHome 41:2956a0a221e5 216 /// @param c is the 16-bit color. @see color_t
WiredHome 41:2956a0a221e5 217 /// @returns an RGBQUAD value. @see RGBQUAD
WiredHome 41:2956a0a221e5 218 ///
WiredHome 41:2956a0a221e5 219 RGBQUAD RGB16ToRGBQuad(color_t c);
WiredHome 41:2956a0a221e5 220
WiredHome 42:7cbdfd2bbfc5 221 /// This method attempts to render a specified graphics image file at
WiredHome 42:7cbdfd2bbfc5 222 /// the specified screen location.
WiredHome 42:7cbdfd2bbfc5 223 ///
WiredHome 42:7cbdfd2bbfc5 224 /// This supports several variants of the following file types:
WiredHome 42:7cbdfd2bbfc5 225 /// \li Bitmap file format,
WiredHome 42:7cbdfd2bbfc5 226 /// \li Icon file format.
WiredHome 42:7cbdfd2bbfc5 227 ///
WiredHome 42:7cbdfd2bbfc5 228 /// @note The specified image width and height, when adjusted for the
WiredHome 42:7cbdfd2bbfc5 229 /// x and y origin, must fit on the screen, or the image will not
WiredHome 42:7cbdfd2bbfc5 230 /// be shown (it does not clip the image).
WiredHome 42:7cbdfd2bbfc5 231 ///
WiredHome 42:7cbdfd2bbfc5 232 /// @note The file extension is tested, and if it ends in a supported
WiredHome 42:7cbdfd2bbfc5 233 /// format, the appropriate handler is called to render that image.
WiredHome 42:7cbdfd2bbfc5 234 ///
WiredHome 42:7cbdfd2bbfc5 235 /// @param x is the horizontal pixel coordinate
WiredHome 42:7cbdfd2bbfc5 236 /// @param y is the vertical pixel coordinate
WiredHome 42:7cbdfd2bbfc5 237 /// @param FileName refers to the fully qualified path and file on
WiredHome 42:7cbdfd2bbfc5 238 /// a mounted file system.
WiredHome 42:7cbdfd2bbfc5 239 /// @returns success or error code.
WiredHome 42:7cbdfd2bbfc5 240 ///
WiredHome 42:7cbdfd2bbfc5 241 RetCode_t RenderImageFile(loc_t x, loc_t y, const char *FileName);
WiredHome 42:7cbdfd2bbfc5 242
WiredHome 31:c72e12cd5c67 243 /// This method reads a disk file that is in bitmap format and
WiredHome 31:c72e12cd5c67 244 /// puts it on the screen.
WiredHome 31:c72e12cd5c67 245 ///
WiredHome 36:300f6ee0b2cf 246 /// Supported formats:
WiredHome 36:300f6ee0b2cf 247 /// \li 4-bit color format (16 colors)
WiredHome 36:300f6ee0b2cf 248 /// \li 8-bit color format (256 colors)
WiredHome 36:300f6ee0b2cf 249 /// \li 16-bit color format (65k colors)
WiredHome 36:300f6ee0b2cf 250 /// \li compression: no.
WiredHome 36:300f6ee0b2cf 251 ///
WiredHome 36:300f6ee0b2cf 252 /// @note This is a slow operation, typically due to the use of
WiredHome 36:300f6ee0b2cf 253 /// the file system, and partially because bmp files
WiredHome 31:c72e12cd5c67 254 /// are stored from the bottom up, and the memory is written
WiredHome 32:0e4f2ae512e2 255 /// from the top down; as a result, it constantly 'seeks'
WiredHome 32:0e4f2ae512e2 256 /// on the file system for the next row of information.
WiredHome 31:c72e12cd5c67 257 ///
WiredHome 34:c99ec28fac66 258 /// As a performance test, a sample picture was timed. A family picture
WiredHome 34:c99ec28fac66 259 /// was converted to Bitmap format; shrunk to 352 x 272 pixels and save
WiredHome 34:c99ec28fac66 260 /// in 8-bit color format. The resulting file size was 94.5 KByte.
WiredHome 34:c99ec28fac66 261 /// The SPI port interface was set to 20 MHz.
WiredHome 34:c99ec28fac66 262 /// The original bitmap rendering software was purely in software,
WiredHome 34:c99ec28fac66 263 /// pushing 1 pixel at a time to the write function, which did use SPI
WiredHome 34:c99ec28fac66 264 /// hardware (not pin wiggling) to transfer commands and data to the
WiredHome 34:c99ec28fac66 265 /// display. Then, the driver was improved to leverage the capability
WiredHome 34:c99ec28fac66 266 /// of the derived display driver. As a final check, instead of the
WiredHome 34:c99ec28fac66 267 /// [known slow] local file system, a randomly chosen USB stick was
WiredHome 34:c99ec28fac66 268 /// used. The performance results are impressive (but depend on the
WiredHome 34:c99ec28fac66 269 /// listed factors).
WiredHome 34:c99ec28fac66 270 ///
WiredHome 35:7dcab9e3ab25 271 /// \li 34 seconds, LocalFileSystem, Software Rendering
WiredHome 35:7dcab9e3ab25 272 /// \li 9 seconds, LocalFileSystem, Hardware Rending for RA8875
WiredHome 35:7dcab9e3ab25 273 /// \li 3 seconds, MSCFileSystem, Hardware Rendering for RA8875
WiredHome 34:c99ec28fac66 274 ///
WiredHome 31:c72e12cd5c67 275 /// @param x is the horizontal pixel coordinate
WiredHome 31:c72e12cd5c67 276 /// @param y is the vertical pixel coordinate
WiredHome 42:7cbdfd2bbfc5 277 /// @param Name_BMP is the filename on the mounted file system.
WiredHome 31:c72e12cd5c67 278 /// @returns success or error code.
WiredHome 31:c72e12cd5c67 279 ///
WiredHome 37:f19b7e7449dc 280 RetCode_t RenderBitmapFile(loc_t x, loc_t y, const char *Name_BMP);
WiredHome 31:c72e12cd5c67 281
WiredHome 42:7cbdfd2bbfc5 282
WiredHome 42:7cbdfd2bbfc5 283 /// This method reads a disk file that is in ico format and
WiredHome 42:7cbdfd2bbfc5 284 /// puts it on the screen.
WiredHome 42:7cbdfd2bbfc5 285 ///
WiredHome 42:7cbdfd2bbfc5 286 /// Reading the disk is slow, but a typical icon file is small
WiredHome 42:7cbdfd2bbfc5 287 /// so it should be ok.
WiredHome 42:7cbdfd2bbfc5 288 ///
WiredHome 42:7cbdfd2bbfc5 289 /// @note An Icon file can have more than one icon in it. This
WiredHome 42:7cbdfd2bbfc5 290 /// implementation only processes the first image in the file.
WiredHome 42:7cbdfd2bbfc5 291 ///
WiredHome 42:7cbdfd2bbfc5 292 /// @param x is the horizontal pixel coordinate
WiredHome 42:7cbdfd2bbfc5 293 /// @param y is the vertical pixel coordinate
WiredHome 42:7cbdfd2bbfc5 294 /// @param Name_ICO is the filename on the mounted file system.
WiredHome 42:7cbdfd2bbfc5 295 /// @returns success or error code.
WiredHome 42:7cbdfd2bbfc5 296 ///
WiredHome 42:7cbdfd2bbfc5 297 RetCode_t RenderIconFile(loc_t x, loc_t y, const char *Name_ICO);
WiredHome 42:7cbdfd2bbfc5 298
WiredHome 42:7cbdfd2bbfc5 299
WiredHome 41:2956a0a221e5 300 /// This method captures the specified area as a 24-bit bitmap file.
WiredHome 41:2956a0a221e5 301 ///
WiredHome 41:2956a0a221e5 302 /// Even though this is a 16-bit display, the stored image is in
WiredHome 41:2956a0a221e5 303 /// 24-bit format.
WiredHome 41:2956a0a221e5 304 ///
WiredHome 41:2956a0a221e5 305 /// @param x is the left edge of the region to capture
WiredHome 41:2956a0a221e5 306 /// @param y is the top edge of the region to capture
WiredHome 41:2956a0a221e5 307 /// @param w is the width of the region to capture
WiredHome 41:2956a0a221e5 308 /// @param h is the height of the region to capture.
WiredHome 41:2956a0a221e5 309 /// @return success or error code.
WiredHome 41:2956a0a221e5 310 ///
WiredHome 41:2956a0a221e5 311 RetCode_t PrintScreen(loc_t x, loc_t y, dim_t w, dim_t h, const char *Name_BMP);
WiredHome 41:2956a0a221e5 312
WiredHome 29:422616aa04bd 313 /// prints one character at the specified coordinates.
WiredHome 29:422616aa04bd 314 ///
WiredHome 29:422616aa04bd 315 /// This will print the character at the specified pixel coordinates.
WiredHome 29:422616aa04bd 316 ///
WiredHome 29:422616aa04bd 317 /// @param x is the horizontal offset in pixels.
WiredHome 29:422616aa04bd 318 /// @param y is the vertical offset in pixels.
WiredHome 29:422616aa04bd 319 /// @param value is the character to print.
WiredHome 29:422616aa04bd 320 /// @returns number of pixels to index to the right if a character was printed, 0 otherwise.
WiredHome 29:422616aa04bd 321 ///
WiredHome 29:422616aa04bd 322 virtual int character(int x, int y, int value);
WiredHome 29:422616aa04bd 323
WiredHome 32:0e4f2ae512e2 324 /// get the number of colums based on the currently active font
WiredHome 32:0e4f2ae512e2 325 ///
WiredHome 32:0e4f2ae512e2 326 /// @returns number of columns.
WiredHome 32:0e4f2ae512e2 327 ///
WiredHome 32:0e4f2ae512e2 328 virtual int columns(void);
WiredHome 32:0e4f2ae512e2 329
WiredHome 32:0e4f2ae512e2 330 /// get the number of rows based on the currently active font
WiredHome 32:0e4f2ae512e2 331 ///
WiredHome 32:0e4f2ae512e2 332 /// @returns number of rows.
WiredHome 32:0e4f2ae512e2 333 ///
WiredHome 32:0e4f2ae512e2 334 virtual int rows(void);
WiredHome 32:0e4f2ae512e2 335
WiredHome 36:300f6ee0b2cf 336 /// Select a bitmap font (provided by the user) for all subsequent text
WiredHome 36:300f6ee0b2cf 337 /// rendering.
WiredHome 36:300f6ee0b2cf 338 ///
WiredHome 36:300f6ee0b2cf 339 /// This API permits selection of a special memory mapped font, which
WiredHome 36:300f6ee0b2cf 340 /// enables the presentation of many font sizes and styles, including
WiredHome 36:300f6ee0b2cf 341 /// proportional fonts.
WiredHome 32:0e4f2ae512e2 342 ///
WiredHome 32:0e4f2ae512e2 343 /// @note Tool to create the fonts is accessible from its creator
WiredHome 36:300f6ee0b2cf 344 /// available at http://www.mikroe.com.
WiredHome 36:300f6ee0b2cf 345 /// Hint: Change the data to an array of type char[].
WiredHome 32:0e4f2ae512e2 346 ///
WiredHome 32:0e4f2ae512e2 347 /// This special font array has a 4-byte header, followed by
WiredHome 32:0e4f2ae512e2 348 /// the data:
WiredHome 36:300f6ee0b2cf 349 /// \li the number of bytes per char
WiredHome 36:300f6ee0b2cf 350 /// \li the vertical size in pixels for each character
WiredHome 36:300f6ee0b2cf 351 /// \li the horizontal size in pixels for each character
WiredHome 36:300f6ee0b2cf 352 /// \li the number of bytes per vertical line (width of the array)
WiredHome 36:300f6ee0b2cf 353 /// \li the subsequent records are the font information.
WiredHome 36:300f6ee0b2cf 354 ///
WiredHome 36:300f6ee0b2cf 355 /// @param font is a pointer to a specially formed font array.
WiredHome 36:300f6ee0b2cf 356 /// NULL, or the omission of this parameter will restore the default
WiredHome 36:300f6ee0b2cf 357 /// font capability, which may use the display controllers hardware
WiredHome 36:300f6ee0b2cf 358 /// font (if available), or no font.
WiredHome 32:0e4f2ae512e2 359 /// @returns error code.
WiredHome 32:0e4f2ae512e2 360 ///
WiredHome 29:422616aa04bd 361 virtual RetCode_t set_font(const unsigned char * font = NULL);
WiredHome 32:0e4f2ae512e2 362
WiredHome 32:0e4f2ae512e2 363 protected:
WiredHome 32:0e4f2ae512e2 364
WiredHome 32:0e4f2ae512e2 365 /// Pure virtual method indicating the start of a graphics stream.
WiredHome 32:0e4f2ae512e2 366 ///
WiredHome 32:0e4f2ae512e2 367 /// This is called prior to a stream of pixel data being sent.
WiredHome 32:0e4f2ae512e2 368 /// This may cause register configuration changes in the derived
WiredHome 32:0e4f2ae512e2 369 /// class in order to prepare the hardware to accept the streaming
WiredHome 32:0e4f2ae512e2 370 /// data.
WiredHome 32:0e4f2ae512e2 371 ///
WiredHome 32:0e4f2ae512e2 372 /// @note this method must be supported in the derived class.
WiredHome 32:0e4f2ae512e2 373 ///
WiredHome 32:0e4f2ae512e2 374 /// @returns error code.
WiredHome 32:0e4f2ae512e2 375 ///
WiredHome 32:0e4f2ae512e2 376 virtual RetCode_t _StartGraphicsStream(void) = 0;
dreschpe 0:de9d1462a835 377
WiredHome 32:0e4f2ae512e2 378 /// Pure virtual method indicating the end of a graphics stream.
WiredHome 32:0e4f2ae512e2 379 ///
WiredHome 32:0e4f2ae512e2 380 /// This is called to conclude a stream of pixel data that was sent.
WiredHome 32:0e4f2ae512e2 381 /// This may cause register configuration changes in the derived
WiredHome 32:0e4f2ae512e2 382 /// class in order to stop the hardware from accept the streaming
WiredHome 32:0e4f2ae512e2 383 /// data.
WiredHome 32:0e4f2ae512e2 384 ///
WiredHome 32:0e4f2ae512e2 385 /// @note this method must be supported in the derived class.
WiredHome 32:0e4f2ae512e2 386 ///
WiredHome 32:0e4f2ae512e2 387 /// @returns error code.
WiredHome 32:0e4f2ae512e2 388 ///
WiredHome 32:0e4f2ae512e2 389 virtual RetCode_t _EndGraphicsStream(void) = 0;
WiredHome 32:0e4f2ae512e2 390
WiredHome 42:7cbdfd2bbfc5 391 /// Protected method to render an image given a file handle and
WiredHome 42:7cbdfd2bbfc5 392 /// coordinates.
WiredHome 42:7cbdfd2bbfc5 393 ///
WiredHome 42:7cbdfd2bbfc5 394 /// @param x is the horizontal pixel coordinate
WiredHome 42:7cbdfd2bbfc5 395 /// @param y is the vertical pixel coordinate
WiredHome 42:7cbdfd2bbfc5 396 /// @param w is the image width restriction, or zero to permit full image width.
WiredHome 42:7cbdfd2bbfc5 397 /// @param h is the image height restriction, or zero to permit full image height.
WiredHome 42:7cbdfd2bbfc5 398 /// @param fileOffset is the offset into the file where the image data starts
WiredHome 42:7cbdfd2bbfc5 399 /// @param Image is the filename stream already opened for the data.
WiredHome 42:7cbdfd2bbfc5 400 /// @returns success or error code.
WiredHome 42:7cbdfd2bbfc5 401 ///
WiredHome 42:7cbdfd2bbfc5 402 RetCode_t _RenderBitmap(loc_t x, loc_t y, uint32_t fileOffset, FILE * Image);
WiredHome 42:7cbdfd2bbfc5 403
WiredHome 37:f19b7e7449dc 404 #ifdef LOCALFONT
WiredHome 37:f19b7e7449dc 405 virtual int blitbit(int x, int y, int w, int h, const char * color);
WiredHome 37:f19b7e7449dc 406 #endif
WiredHome 37:f19b7e7449dc 407
WiredHome 29:422616aa04bd 408 const unsigned char * font; ///< reference to an external font somewhere in memory
WiredHome 29:422616aa04bd 409
dreschpe 0:de9d1462a835 410 // pixel location
dreschpe 0:de9d1462a835 411 short _x;
dreschpe 0:de9d1462a835 412 short _y;
dreschpe 0:de9d1462a835 413
dreschpe 0:de9d1462a835 414 // window location
dreschpe 0:de9d1462a835 415 short _x1;
dreschpe 0:de9d1462a835 416 short _x2;
dreschpe 0:de9d1462a835 417 short _y1;
dreschpe 0:de9d1462a835 418 short _y2;
dreschpe 0:de9d1462a835 419 };
dreschpe 0:de9d1462a835 420
dreschpe 0:de9d1462a835 421 #endif
WiredHome 33:b6b710758ab3 422