DOGS-102 Graphic LCD module Example. Based on Igor Skochinsky's "DOGLCDDemo" program.
Dependencies: DOG-S_GraphicLCD mbed
Fork of DOGLCDDemo by
Graphics/Graphics.h@0:2a5dccfd318f, 2010-01-14 (annotated)
- Committer:
- igorsk
- Date:
- Thu Jan 14 00:49:39 2010 +0000
- Revision:
- 0:2a5dccfd318f
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
igorsk | 0:2a5dccfd318f | 1 | /* |
igorsk | 0:2a5dccfd318f | 2 | * libmbed-graphics 2D and wireframe 3D graphics library for the MBED |
igorsk | 0:2a5dccfd318f | 3 | * microcontroller platform |
igorsk | 0:2a5dccfd318f | 4 | * Copyright (C) <2009> Michael Sheldon <mike@mikeasoft.com> |
igorsk | 0:2a5dccfd318f | 5 | * Optimized and adapted for AbstractLCD interface |
igorsk | 0:2a5dccfd318f | 6 | * Copyright (C) <2010> Igor Skochinsky <skochinsky@gmail.com> |
igorsk | 0:2a5dccfd318f | 7 | * |
igorsk | 0:2a5dccfd318f | 8 | * This library is free software; you can redistribute it and/or |
igorsk | 0:2a5dccfd318f | 9 | * modify it under the terms of the GNU Library General Public |
igorsk | 0:2a5dccfd318f | 10 | * License as published by the Free Software Foundation; either |
igorsk | 0:2a5dccfd318f | 11 | * version 2 of the License, or (at your option) any later version. |
igorsk | 0:2a5dccfd318f | 12 | * |
igorsk | 0:2a5dccfd318f | 13 | * This library is distributed in the hope that it will be useful, |
igorsk | 0:2a5dccfd318f | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
igorsk | 0:2a5dccfd318f | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
igorsk | 0:2a5dccfd318f | 16 | * Library General Public License for more details. |
igorsk | 0:2a5dccfd318f | 17 | * |
igorsk | 0:2a5dccfd318f | 18 | * You should have received a copy of the GNU Library General Public |
igorsk | 0:2a5dccfd318f | 19 | * License along with this library; if not, write to the |
igorsk | 0:2a5dccfd318f | 20 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
igorsk | 0:2a5dccfd318f | 21 | * Boston, MA 02111-1307, USA. |
igorsk | 0:2a5dccfd318f | 22 | */ |
igorsk | 0:2a5dccfd318f | 23 | |
igorsk | 0:2a5dccfd318f | 24 | #ifndef MBED_GRAPHICS_H |
igorsk | 0:2a5dccfd318f | 25 | #define MBED_GRAPHICS_H |
igorsk | 0:2a5dccfd318f | 26 | |
igorsk | 0:2a5dccfd318f | 27 | #include "mbed.h" |
igorsk | 0:2a5dccfd318f | 28 | #include "AbstractLCD.h" |
igorsk | 0:2a5dccfd318f | 29 | |
igorsk | 0:2a5dccfd318f | 30 | /* Class: Graphics |
igorsk | 0:2a5dccfd318f | 31 | * A general purpose graphics library providing 2D and wireframe 3D functionality. |
igorsk | 0:2a5dccfd318f | 32 | * Needs an implementation of AbstractLCD interface to work. |
igorsk | 0:2a5dccfd318f | 33 | */ |
igorsk | 0:2a5dccfd318f | 34 | class Graphics |
igorsk | 0:2a5dccfd318f | 35 | { |
igorsk | 0:2a5dccfd318f | 36 | |
igorsk | 0:2a5dccfd318f | 37 | public: |
igorsk | 0:2a5dccfd318f | 38 | /* Constructor: Graphics |
igorsk | 0:2a5dccfd318f | 39 | * Instantiate the graphics library. |
igorsk | 0:2a5dccfd318f | 40 | * |
igorsk | 0:2a5dccfd318f | 41 | * Parameters: |
igorsk | 0:2a5dccfd318f | 42 | * lcd - an implementation of LCD device |
igorsk | 0:2a5dccfd318f | 43 | */ |
igorsk | 0:2a5dccfd318f | 44 | Graphics(AbstractLCD *lcd); |
igorsk | 0:2a5dccfd318f | 45 | |
igorsk | 0:2a5dccfd318f | 46 | /* Function: line |
igorsk | 0:2a5dccfd318f | 47 | * Draw a coloured line between two points. |
igorsk | 0:2a5dccfd318f | 48 | * |
igorsk | 0:2a5dccfd318f | 49 | * Parameters: |
igorsk | 0:2a5dccfd318f | 50 | * x0 - X co-ordinate of the start of the line. |
igorsk | 0:2a5dccfd318f | 51 | * y0 - Y co-ordinate of the start of the line. |
igorsk | 0:2a5dccfd318f | 52 | * x1 - X co-ordinate of the end of the line. |
igorsk | 0:2a5dccfd318f | 53 | * y1 - Y co-ordinate of the end of the line. |
igorsk | 0:2a5dccfd318f | 54 | * colour - The colour of the line. |
igorsk | 0:2a5dccfd318f | 55 | */ |
igorsk | 0:2a5dccfd318f | 56 | void line(int x0, int y0, int x1, int y1, int colour); |
igorsk | 0:2a5dccfd318f | 57 | |
igorsk | 0:2a5dccfd318f | 58 | /* Function: line3d |
igorsk | 0:2a5dccfd318f | 59 | * Draws a coloured line in 3D space. The 3D origin point is in |
igorsk | 0:2a5dccfd318f | 60 | * the centre of the screen. |
igorsk | 0:2a5dccfd318f | 61 | * |
igorsk | 0:2a5dccfd318f | 62 | * Parameters: |
igorsk | 0:2a5dccfd318f | 63 | * x0 - X co-ordinate of the start of the line. |
igorsk | 0:2a5dccfd318f | 64 | * y0 - Y co-ordinate of the start of the line. |
igorsk | 0:2a5dccfd318f | 65 | * z0 - Z (depth) co-ordinate of the start of the line. |
igorsk | 0:2a5dccfd318f | 66 | * x1 - X co-ordinate of the end of the line. |
igorsk | 0:2a5dccfd318f | 67 | * y1 - Y co-ordinate of the end of the line. |
igorsk | 0:2a5dccfd318f | 68 | * z1 - Z co-ordinate of the end of the line. |
igorsk | 0:2a5dccfd318f | 69 | * colour - The colour of the line. |
igorsk | 0:2a5dccfd318f | 70 | */ |
igorsk | 0:2a5dccfd318f | 71 | void line3d(int x0, int y0, int z0, int x1, int y1, int z0, int colour); |
igorsk | 0:2a5dccfd318f | 72 | |
igorsk | 0:2a5dccfd318f | 73 | /* Function: circle |
igorsk | 0:2a5dccfd318f | 74 | * Draw a coloured circle. |
igorsk | 0:2a5dccfd318f | 75 | * |
igorsk | 0:2a5dccfd318f | 76 | * Parameters: |
igorsk | 0:2a5dccfd318f | 77 | * cx - X co-ordinate of the centre of the circle. |
igorsk | 0:2a5dccfd318f | 78 | * cy - Y co-ordinate of the centre of the circle. |
igorsk | 0:2a5dccfd318f | 79 | * radius - The radius of the circle. |
igorsk | 0:2a5dccfd318f | 80 | * colour - The colour of the circle. |
igorsk | 0:2a5dccfd318f | 81 | */ |
igorsk | 0:2a5dccfd318f | 82 | void circle(int cx, int cy, int radius, int colour); |
igorsk | 0:2a5dccfd318f | 83 | |
igorsk | 0:2a5dccfd318f | 84 | protected: |
igorsk | 0:2a5dccfd318f | 85 | int _cx3d, _cy3d, _cz3d; // 3D focal point |
igorsk | 0:2a5dccfd318f | 86 | AbstractLCD *_lcd; |
igorsk | 0:2a5dccfd318f | 87 | |
igorsk | 0:2a5dccfd318f | 88 | }; |
igorsk | 0:2a5dccfd318f | 89 | |
igorsk | 0:2a5dccfd318f | 90 | #endif |