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.
Dependents: SignalProcessLab DigitalSignalAlgorithm_Lab DigitalSignal_Lab
Canvas.h
00001 /* 00002 Canvas.h - Simple canvas class declaration 00003 00004 Copyright(c) 2016 karpent at gmail.com, MIT License 00005 00006 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), 00007 to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 00008 and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions : 00009 00010 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 00011 00012 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00013 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00014 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 00015 THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00016 */ 00017 00018 #pragma once 00019 00020 #include "Commons.h" 00021 #include "Display.h" 00022 00023 #define PLANE_BITMAP_ELEMENT_BITS 8 00024 00025 /** 00026 * @brief Canvas is a frame buffer where everything is drawn, 00027 * uses its own graphics commands to create graphics. 00028 * Cavas bitmap must be copied to the display to make image visible. 00029 */ 00030 class Canvas : public Display 00031 { 00032 public: 00033 00034 /// <summary> 00035 /// Initializes a new instance of the <see cref="Canvas"/> class. 00036 /// </summary> 00037 /// Class constructor 00038 Canvas(); 00039 00040 /// <summary> 00041 /// Initializes a new instance of the <see cref="Canvas"/> class. 00042 /// </summary> 00043 /// <param name="width">The width.</param> 00044 /// <param name="height">The height.</param> 00045 Canvas(uint16_t width, uint16_t height); 00046 00047 /// <summary> 00048 /// Finalizes an instance of the <see cref="Canvas"/> class. 00049 /// </summary> 00050 ~Canvas(); 00051 00052 /// <summary> 00053 /// Clears the canvas. 00054 /// </summary> 00055 void Clear(); 00056 00057 /// <summary> 00058 /// Gets the bitmap. 00059 /// </summary> 00060 /// <returns></returns> 00061 uint8_t* GetBitmap(); 00062 00063 /// <summary> 00064 /// Returns screen width. 00065 /// </summary> 00066 /// <returns></returns> 00067 uint16_t virtual DisplayWidth(); 00068 00069 /// <summary> 00070 /// Redurns screen height. 00071 /// </summary> 00072 /// <returns></returns> 00073 uint16_t virtual DisplayHeight(); 00074 00075 /// <summary> 00076 /// Draws the point. 00077 /// </summary> 00078 /// <param name="posX">The position x.</param> 00079 /// <param name="posY">The position y.</param> 00080 /// <param name="colorMask">The color mask.</param> 00081 void virtual DrawPoint(int posX, int posY, uint32_t colorMask); 00082 00083 /// <summary> 00084 /// Sets the size. 00085 /// </summary> 00086 /// <param name="width">The width.</param> 00087 /// <param name="height">The height.</param> 00088 /// <returns></returns> 00089 bool SetSize(uint16_t width, uint16_t height); 00090 00091 /// <summary> 00092 /// Determines whether this instance is set. 00093 /// </summary> 00094 /// <returns> 00095 /// <c>true</c> if this instance is set; otherwise, <c>false</c>. 00096 /// </returns> 00097 bool IsSet(); 00098 00099 private: 00100 /// <summary> 00101 /// Resets this instance. 00102 /// </summary> 00103 void Reset(); 00104 00105 uint16_t _width; 00106 uint32_t _height; 00107 00108 /* 00109 * Canvas plane bitmap - depth 1. 00110 */ 00111 uint8_t *_planeBitmap; 00112 uint32_t _planeBitmapSize; 00113 };
Generated on Sat Jul 23 2022 05:48:59 by
1.7.2