A simple yet powerful library for controlling graphical displays. Multiple display controllers are supported using inheritance.

Dependents:   mbed_rifletool Hexi_Bubble_Game Hexi_Catch-the-dot_Game Hexi_Acceleromagnetic_Synth

NOTE: This library is in beta right now. As far as I know, everything here works, but there are many features that are lacking so far. Most notably containers, button handling, and display drivers other than the SSD1306.

Committer:
neilt6
Date:
Tue May 27 21:41:28 2014 +0000
Revision:
3:a8f72d4864e6
Parent:
1:f7003ec66a51
Syntax improvements

Who changed what in which revision?

UserRevisionLine numberNew contents of line
neilt6 0:b876cf091464 1 /* NeatGUI Library
neilt6 0:b876cf091464 2 * Copyright (c) 2013 Neil Thiessen
neilt6 0:b876cf091464 3 *
neilt6 0:b876cf091464 4 * Licensed under the Apache License, Version 2.0 (the "License");
neilt6 0:b876cf091464 5 * you may not use this file except in compliance with the License.
neilt6 0:b876cf091464 6 * You may obtain a copy of the License at
neilt6 0:b876cf091464 7 *
neilt6 0:b876cf091464 8 * http://www.apache.org/licenses/LICENSE-2.0
neilt6 0:b876cf091464 9 *
neilt6 0:b876cf091464 10 * Unless required by applicable law or agreed to in writing, software
neilt6 0:b876cf091464 11 * distributed under the License is distributed on an "AS IS" BASIS,
neilt6 0:b876cf091464 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
neilt6 0:b876cf091464 13 * See the License for the specific language governing permissions and
neilt6 0:b876cf091464 14 * limitations under the License.
neilt6 0:b876cf091464 15 */
neilt6 0:b876cf091464 16
neilt6 0:b876cf091464 17 #ifndef BITMAP_IMAGE_H
neilt6 0:b876cf091464 18 #define BITMAP_IMAGE_H
neilt6 0:b876cf091464 19
neilt6 0:b876cf091464 20 #include "mbed.h"
neilt6 0:b876cf091464 21 #include "Image.h"
neilt6 0:b876cf091464 22
neilt6 0:b876cf091464 23 /** BitmapImage class.
neilt6 0:b876cf091464 24 * Used to access a monochrome bitmap stored in an external table.
neilt6 0:b876cf091464 25 */
neilt6 0:b876cf091464 26 class BitmapImage : public Image
neilt6 0:b876cf091464 27 {
neilt6 0:b876cf091464 28 public:
neilt6 0:b876cf091464 29 /** Create a BitmapImage object from the specified image table with a white foreground, and an alpha background
neilt6 0:b876cf091464 30 *
neilt6 0:b876cf091464 31 * @param table Pointer to the image table.
neilt6 0:b876cf091464 32 */
neilt6 1:f7003ec66a51 33 BitmapImage(const char* table);
neilt6 0:b876cf091464 34
neilt6 0:b876cf091464 35 /** Create a BitmapImage object from the specified image table with the specified foreground, and an alpha background
neilt6 0:b876cf091464 36 *
neilt6 0:b876cf091464 37 * @param table Pointer to the image table.
neilt6 0:b876cf091464 38 * @param fg_color The foreground color as a 32-bit ARGB value.
neilt6 0:b876cf091464 39 */
neilt6 1:f7003ec66a51 40 BitmapImage(const char* table, unsigned int fg_color);
neilt6 0:b876cf091464 41
neilt6 0:b876cf091464 42 /** Create a BitmapImage object from the specified image table with the specified foreground and background colors
neilt6 0:b876cf091464 43 *
neilt6 0:b876cf091464 44 * @param table Pointer to the image table.
neilt6 0:b876cf091464 45 * @param fg_color The foreground color as a 32-bit ARGB value.
neilt6 0:b876cf091464 46 * @param bg_color The background color as a 32-bit ARGB value.
neilt6 0:b876cf091464 47 */
neilt6 1:f7003ec66a51 48 BitmapImage(const char* table, unsigned int fg_color, unsigned int bg_color);
neilt6 0:b876cf091464 49
neilt6 0:b876cf091464 50 /** Get the pixel at the specified coordinates
neilt6 0:b876cf091464 51 *
neilt6 0:b876cf091464 52 * @param x The X coordinate.
neilt6 0:b876cf091464 53 * @param y The Y coordinate.
neilt6 0:b876cf091464 54 *
neilt6 0:b876cf091464 55 * @returns The color of the pixel as a 32-bit ARGB value.
neilt6 0:b876cf091464 56 */
neilt6 0:b876cf091464 57 virtual unsigned int pixel(int x, int y);
neilt6 0:b876cf091464 58
neilt6 0:b876cf091464 59 /** Get the foreground color
neilt6 0:b876cf091464 60 *
neilt6 0:b876cf091464 61 * @returns The foreground color as a 32-bit ARGB value.
neilt6 0:b876cf091464 62 */
neilt6 1:f7003ec66a51 63 unsigned int foreground();
neilt6 0:b876cf091464 64
neilt6 0:b876cf091464 65 /** Set the foreground color
neilt6 0:b876cf091464 66 *
neilt6 0:b876cf091464 67 * @param c The new foreground color as a 32-bit ARGB value.
neilt6 0:b876cf091464 68 */
neilt6 0:b876cf091464 69 void foreground(unsigned int c);
neilt6 0:b876cf091464 70
neilt6 0:b876cf091464 71 /** Get the background color
neilt6 0:b876cf091464 72 *
neilt6 0:b876cf091464 73 * @returns The background color as a 32-bit ARGB value.
neilt6 0:b876cf091464 74 */
neilt6 1:f7003ec66a51 75 unsigned int background();
neilt6 0:b876cf091464 76
neilt6 0:b876cf091464 77 /** Set the background color
neilt6 0:b876cf091464 78 *
neilt6 0:b876cf091464 79 * @param c The new background color as a 32-bit ARGB value.
neilt6 0:b876cf091464 80 */
neilt6 0:b876cf091464 81 void background(unsigned int c);
neilt6 0:b876cf091464 82
neilt6 0:b876cf091464 83 protected:
neilt6 0:b876cf091464 84 //Pointer to the image table
neilt6 1:f7003ec66a51 85 const char* m_ImageTable;
neilt6 0:b876cf091464 86
neilt6 0:b876cf091464 87 //The foreground and background colors
neilt6 0:b876cf091464 88 unsigned int m_FgColor, m_BgColor;
neilt6 0:b876cf091464 89
neilt6 1:f7003ec66a51 90 int bytesPerLine();
neilt6 0:b876cf091464 91 };
neilt6 0:b876cf091464 92
neilt6 0:b876cf091464 93 #endif