A basic graphics package for the LPC4088 Display Module.

Dependents:   lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI lpc4088_displaymodule_fs_aid ... more

Fork of DMBasicGUI by EmbeddedArtists AB

Committer:
embeddedartists
Date:
Tue Feb 17 10:34:13 2015 +0100
Revision:
11:265884fa7fdd
Parent:
10:651861441108
Child:
17:6e2abf107800
- Replaced wait_ms with Thread::wait in SlideShow
- Fixed fade transition in SlideShow
- Added repeat/end buttons to AppSlideShow
- Added very basic transparent image rendering to SWIM
- Fixed errors in lpc_colors.h
- Added support for button captions to the ImageButton
- Added back buffering to the AppColorPicker
- Added basic_image_data.h/c with the ok/cancel/repeat buttons
- Moved the slideshow parameters to the constructor of AppSlideShow

Who changed what in which revision?

UserRevisionLine numberNew contents of line
embeddedartists 2:efae611de184 1 /*
embeddedartists 2:efae611de184 2 * Copyright 2014 Embedded Artists AB
embeddedartists 2:efae611de184 3 *
embeddedartists 2:efae611de184 4 * Licensed under the Apache License, Version 2.0 (the "License");
embeddedartists 2:efae611de184 5 * you may not use this file except in compliance with the License.
embeddedartists 2:efae611de184 6 * You may obtain a copy of the License at
embeddedartists 2:efae611de184 7 *
embeddedartists 2:efae611de184 8 * http://www.apache.org/licenses/LICENSE-2.0
embeddedartists 2:efae611de184 9 *
embeddedartists 2:efae611de184 10 * Unless required by applicable law or agreed to in writing, software
embeddedartists 2:efae611de184 11 * distributed under the License is distributed on an "AS IS" BASIS,
embeddedartists 2:efae611de184 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
embeddedartists 2:efae611de184 13 * See the License for the specific language governing permissions and
embeddedartists 2:efae611de184 14 * limitations under the License.
embeddedartists 2:efae611de184 15 */
embeddedartists 2:efae611de184 16
embeddedartists 3:3fabfe3339b8 17 #ifndef IMAGEBUTTON_H
embeddedartists 3:3fabfe3339b8 18 #define IMAGEBUTTON_H
embeddedartists 2:efae611de184 19
embeddedartists 2:efae611de184 20 #include "Clickable.h"
embeddedartists 2:efae611de184 21 #include "Image.h"
embeddedartists 2:efae611de184 22
embeddedartists 2:efae611de184 23 /**
embeddedartists 2:efae611de184 24 * The ImageButton is used in the same way as the Button so see it for an example
embeddedartists 2:efae611de184 25 */
embeddedartists 2:efae611de184 26 class ImageButton : public Clickable {
embeddedartists 2:efae611de184 27 public:
embeddedartists 2:efae611de184 28
embeddedartists 2:efae611de184 29 /** Creates a new button
embeddedartists 2:efae611de184 30 *
embeddedartists 2:efae611de184 31 * This button will use a SWIM window to draw on. That window will use
embeddedartists 2:efae611de184 32 * part of the full size frame buffer to draw on.
embeddedartists 2:efae611de184 33 *
embeddedartists 2:efae611de184 34 * @param fb the frame buffer
embeddedartists 2:efae611de184 35 * @param x the upper left corner of the button
embeddedartists 2:efae611de184 36 * @param y the upper left corner of the button
embeddedartists 2:efae611de184 37 * @param width the width of the button
embeddedartists 2:efae611de184 38 * @param height the height of the button
embeddedartists 11:265884fa7fdd 39 * @param caption optional text to put below the image
embeddedartists 11:265884fa7fdd 40 * @param color text color
embeddedartists 3:3fabfe3339b8 41 */
embeddedartists 11:265884fa7fdd 42 ImageButton(COLOR_T* fb, uint16_t x, uint16_t y, uint16_t width, uint16_t height,
embeddedartists 11:265884fa7fdd 43 const char* caption=NULL, COLOR_T color=BLACK);
embeddedartists 10:651861441108 44 virtual ~ImageButton();
embeddedartists 3:3fabfe3339b8 45
embeddedartists 3:3fabfe3339b8 46 /** Loads the mandatory "normal" state image and the optional "pressed" state image
embeddedartists 3:3fabfe3339b8 47 *
embeddedartists 4:a73760d09423 48 * @param imgUp the file with the image for the normal state
embeddedartists 4:a73760d09423 49 * @param imgDown the file with the image for the pressed state (or NULL to use the same)
embeddedartists 4:a73760d09423 50 *
embeddedartists 4:a73760d09423 51 * @returns
embeddedartists 4:a73760d09423 52 * true on success
embeddedartists 4:a73760d09423 53 * false on failure
embeddedartists 4:a73760d09423 54 */
embeddedartists 4:a73760d09423 55 bool loadImages(const char* imgUp, const char* imgDown = 0);
embeddedartists 4:a73760d09423 56
embeddedartists 4:a73760d09423 57 /** Loads the mandatory "normal" state image and the optional "pressed" state image
embeddedartists 4:a73760d09423 58 *
embeddedartists 2:efae611de184 59 * @param imgUp the image for the normal state
embeddedartists 2:efae611de184 60 * @param imgDown the image for the pressed state (or NULL to use the same)
embeddedartists 3:3fabfe3339b8 61 *
embeddedartists 3:3fabfe3339b8 62 * @returns
embeddedartists 3:3fabfe3339b8 63 * true on success
embeddedartists 3:3fabfe3339b8 64 * false on failure
embeddedartists 2:efae611de184 65 */
embeddedartists 4:a73760d09423 66 bool loadImages(const unsigned char* imgUp, unsigned int imgUpSize,
embeddedartists 4:a73760d09423 67 const unsigned char* imgDown = 0, unsigned int imgDownSize = 0);
embeddedartists 3:3fabfe3339b8 68
embeddedartists 11:265884fa7fdd 69 /** Specifys a color that will be considered transparent (i.e. will not be drawn)
embeddedartists 11:265884fa7fdd 70 * @param tColor the transparent color
embeddedartists 11:265884fa7fdd 71 */
embeddedartists 11:265884fa7fdd 72 void setTransparency(COLOR_T tColor);
embeddedartists 11:265884fa7fdd 73
embeddedartists 6:7917b0894655 74 /** Draws the button (on a new framebuffer if one is specified)
embeddedartists 6:7917b0894655 75 * @param fb the frame buffer
embeddedartists 2:efae611de184 76 */
embeddedartists 6:7917b0894655 77 virtual void draw(COLOR_T* fb = 0);
embeddedartists 2:efae611de184 78
embeddedartists 2:efae611de184 79 private:
embeddedartists 2:efae611de184 80 Image::ImageData_t _imgUp;
embeddedartists 2:efae611de184 81 Image::ImageData_t _imgDown;
embeddedartists 11:265884fa7fdd 82 char* _caption;
embeddedartists 11:265884fa7fdd 83 COLOR_T _captionColor;
embeddedartists 11:265884fa7fdd 84 bool _transparent;
embeddedartists 11:265884fa7fdd 85 COLOR_T _transparentColor;
embeddedartists 2:efae611de184 86 };
embeddedartists 2:efae611de184 87
embeddedartists 3:3fabfe3339b8 88 #endif /* IMAGEBUTTON_H */