DeepCover Embedded Security in IoT: Public-key Secured Data Paths
Dependencies: MaximInterface
Bitmap.hpp
00001 /******************************************************************************* 00002 * Copyright (C) Maxim Integrated Products, Inc., All Rights Reserved. 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining a 00005 * copy of this software and associated documentation files (the "Software"), 00006 * to deal in the Software without restriction, including without limitation 00007 * 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 00009 * Software is furnished to do so, subject to the following conditions: 00010 * 00011 * The above copyright notice and this permission notice shall be included 00012 * in all copies or substantial portions of the Software. 00013 * 00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00015 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00016 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00017 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES 00018 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00019 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00020 * OTHER DEALINGS IN THE SOFTWARE. 00021 * 00022 * Except as contained in this notice, the name of Maxim Integrated 00023 * Products, Inc. shall not be used except as stated in the Maxim Integrated 00024 * Products, Inc. Branding Policy. 00025 * 00026 * The mere transfer of this software does not imply any licenses 00027 * of trade secrets, proprietary technology, copyrights, patents, 00028 * trademarks, maskwork rights, or any other form of intellectual 00029 * property whatsoever. Maxim Integrated Products, Inc. retains all 00030 * ownership rights. 00031 *******************************************************************************/ 00032 00033 #ifndef BITMAP_HPP 00034 #define BITMAP_HPP 00035 00036 #include <stddef.h> 00037 #include <stdint.h> 00038 #include <vector> 00039 00040 /// Stores a black and white bitmap image. 00041 class Bitmap { 00042 public: 00043 /// @brief Construct a zero-initialized bitmap with specified dimensions. 00044 /// @param width Width in pixels that is >= 1. 00045 /// @param height Height in pixels that is >= 1. 00046 Bitmap(int width, int height); 00047 00048 /// @brief Load bitmap from a byte array. 00049 /// @param data Array of scanline bitmap data. 00050 /// @param size Size of data array. 00051 /// @param width Width of loaded image in pixels that is >= 1. 00052 Bitmap(const uint8_t * data, size_t size, int width); 00053 00054 /// Width in pixels. 00055 int width() const { return width_; } 00056 00057 /// Height in pixels. 00058 int height() const { return height_; } 00059 00060 /// @brief Check if a pixel is enabled (black). 00061 /// @returns 00062 /// True if the pixel is enabled or false if the coordinate is out of range. 00063 bool pixelEnabled(int x, int y) const; 00064 00065 /// @brief Enable or disable a pixel. 00066 /// @param True to set to black. False to set to white. 00067 void setPixelEnabled(int x, int y, bool enabled); 00068 00069 /// @brief Overlay another bitmap on top of this bitmap. 00070 /// @param x x-coordinate location to overlay. 00071 /// @param y y-coordinate location to overlay. 00072 /// @param src Bitmap to overlay. 00073 void overlay(int x, int y, const Bitmap & src); 00074 00075 /// @brief Overlay bitmap data from a byte array on top of this bitmap. 00076 /// @param x x-coordinate location to overlay. 00077 /// @param y y-coordinate location to overlay. 00078 /// @param data Array of scanline bitmap data. 00079 /// @param size Size of data array. 00080 /// @param width Width of overlayed image in pixels that is >= 1. 00081 void overlay(int x, int y, const uint8_t * data, size_t size, int width); 00082 00083 /// Reset to initial state. 00084 void clear(); 00085 00086 /// @brief Reset region to initial state. 00087 /// @param x,y Coordinates to begin clearing at. 00088 /// @param width,height Dimensions of the cleared region. 00089 void clear(int x, int y, int width, int height); 00090 00091 private: 00092 int width_; 00093 int height_; 00094 std::vector<uint8_t> data_; 00095 }; 00096 00097 #endif
Generated on Tue Jul 12 2022 12:06:48 by 1.7.2