Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Graphics.h
00001 /* 00002 * libmbed-graphics 2D and wireframe 3D graphics library for the MBED 00003 * microcontroller platform 00004 * Copyright (C) <2009> Michael Sheldon <mike@mikeasoft.com> 00005 * Optimized and adapted for AbstractLCD interface 00006 * Copyright (C) <2010> Igor Skochinsky <skochinsky@gmail.com> 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Library General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Library General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Library General Public 00019 * License along with this library; if not, write to the 00020 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00021 * Boston, MA 02111-1307, USA. 00022 */ 00023 00024 #ifndef MBED_GRAPHICS_H 00025 #define MBED_GRAPHICS_H 00026 00027 #include "mbed.h" 00028 #include "AbstractLCD.h" 00029 00030 /* Class: Graphics 00031 * A general purpose graphics library providing 2D and wireframe 3D functionality. 00032 * Needs an implementation of AbstractLCD interface to work. 00033 */ 00034 class Graphics 00035 { 00036 00037 public: 00038 /* Constructor: Graphics 00039 * Instantiate the graphics library. 00040 * 00041 * Parameters: 00042 * lcd - an implementation of LCD device 00043 */ 00044 Graphics(AbstractLCD *lcd); 00045 00046 /* Function: line 00047 * Draw a coloured line between two points. 00048 * 00049 * Parameters: 00050 * x0 - X co-ordinate of the start of the line. 00051 * y0 - Y co-ordinate of the start of the line. 00052 * x1 - X co-ordinate of the end of the line. 00053 * y1 - Y co-ordinate of the end of the line. 00054 * colour - The colour of the line. 00055 */ 00056 void line(int x0, int y0, int x1, int y1, int colour); 00057 00058 /* Function: line3d 00059 * Draws a coloured line in 3D space. The 3D origin point is in 00060 * the centre of the screen. 00061 * 00062 * Parameters: 00063 * x0 - X co-ordinate of the start of the line. 00064 * y0 - Y co-ordinate of the start of the line. 00065 * z0 - Z (depth) co-ordinate of the start of the line. 00066 * x1 - X co-ordinate of the end of the line. 00067 * y1 - Y co-ordinate of the end of the line. 00068 * z1 - Z co-ordinate of the end of the line. 00069 * colour - The colour of the line. 00070 */ 00071 void line3d(int x0, int y0, int z0, int x1, int y1, int z0, int colour); 00072 00073 /* Function: circle 00074 * Draw a coloured circle. 00075 * 00076 * Parameters: 00077 * cx - X co-ordinate of the centre of the circle. 00078 * cy - Y co-ordinate of the centre of the circle. 00079 * radius - The radius of the circle. 00080 * colour - The colour of the circle. 00081 */ 00082 void circle(int cx, int cy, int radius, int colour); 00083 00084 protected: 00085 int _cx3d, _cy3d, _cz3d; // 3D focal point 00086 AbstractLCD *_lcd; 00087 00088 }; 00089 00090 #endif
Generated on Fri Jul 15 2022 20:49:26 by
1.7.2