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

Revision:
4:a73760d09423
Parent:
3:3fabfe3339b8
Child:
6:7917b0894655
--- a/Application/ImageButton.cpp	Fri Dec 19 09:12:51 2014 +0100
+++ b/Application/ImageButton.cpp	Fri Dec 19 16:40:30 2014 +0100
@@ -62,6 +62,31 @@
   return true;
 }
 
+bool ImageButton::loadImages(const unsigned char* imgUp, unsigned int imgUpSize, 
+                             const unsigned char* imgDown, unsigned int imgDownSize)
+{
+  if (_imgUp.pixels != NULL) {
+    free(_imgUp.pixels);
+    _imgUp.pixels = NULL;
+  }
+  if (_imgDown.pixels != NULL) {
+    free(_imgDown.pixels);
+    _imgDown.pixels = NULL;
+  }
+  if (Image::decode(imgUp, imgUpSize, Image::RES_16BIT, &_imgUp) != 0) {
+    DMBoard::instance().logger()->printf("Failed to load %s\n", imgUp);
+    return false;
+  }
+  if (imgDown != NULL) {
+    if (Image::decode(imgDown, imgDownSize, Image::RES_16BIT, &_imgDown) == 0) {
+      DMBoard::instance().logger()->printf("Failed to load %s\n", imgDown);
+      return false;
+    }
+  }
+  return true;
+}
+
+
 void ImageButton::draw()
 {
   if (_pressed) {