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.
BitmapImage.h
00001 /* NeatGUI Library 00002 * Copyright (c) 2013 Neil Thiessen 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef BITMAP_IMAGE_H 00018 #define BITMAP_IMAGE_H 00019 00020 #include "mbed.h" 00021 #include "Image.h" 00022 00023 /** BitmapImage class. 00024 * Used to access a monochrome bitmap stored in an external table. 00025 */ 00026 class BitmapImage : public Image 00027 { 00028 public: 00029 /** Create a BitmapImage object from the specified image table with a white foreground, and an alpha background 00030 * 00031 * @param table Pointer to the image table. 00032 */ 00033 BitmapImage(const char* table); 00034 00035 /** Create a BitmapImage object from the specified image table with the specified foreground, and an alpha background 00036 * 00037 * @param table Pointer to the image table. 00038 * @param fg_color The foreground color as a 32-bit ARGB value. 00039 */ 00040 BitmapImage(const char* table, unsigned int fg_color); 00041 00042 /** Create a BitmapImage object from the specified image table with the specified foreground and background colors 00043 * 00044 * @param table Pointer to the image table. 00045 * @param fg_color The foreground color as a 32-bit ARGB value. 00046 * @param bg_color The background color as a 32-bit ARGB value. 00047 */ 00048 BitmapImage(const char* table, unsigned int fg_color, unsigned int bg_color); 00049 00050 /** Get the pixel at the specified coordinates 00051 * 00052 * @param x The X coordinate. 00053 * @param y The Y coordinate. 00054 * 00055 * @returns The color of the pixel as a 32-bit ARGB value. 00056 */ 00057 virtual unsigned int pixel(int x, int y); 00058 00059 /** Get the foreground color 00060 * 00061 * @returns The foreground color as a 32-bit ARGB value. 00062 */ 00063 unsigned int foreground(); 00064 00065 /** Set the foreground color 00066 * 00067 * @param c The new foreground color as a 32-bit ARGB value. 00068 */ 00069 void foreground(unsigned int c); 00070 00071 /** Get the background color 00072 * 00073 * @returns The background color as a 32-bit ARGB value. 00074 */ 00075 unsigned int background(); 00076 00077 /** Set the background color 00078 * 00079 * @param c The new background color as a 32-bit ARGB value. 00080 */ 00081 void background(unsigned int c); 00082 00083 protected: 00084 //Pointer to the image table 00085 const char* m_ImageTable; 00086 00087 //The foreground and background colors 00088 unsigned int m_FgColor, m_BgColor; 00089 00090 int bytesPerLine(); 00091 }; 00092 00093 #endif
Generated on Tue Jul 12 2022 21:38:03 by
1.7.2