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
Diff: Application/ImageButton.cpp
- Revision:
- 17:6e2abf107800
- Parent:
- 11:265884fa7fdd
diff -r feb669462368 -r 6e2abf107800 Application/ImageButton.cpp --- a/Application/ImageButton.cpp Mon Mar 09 14:24:54 2015 +0000 +++ b/Application/ImageButton.cpp Fri Mar 20 14:25:46 2015 +0100 @@ -105,6 +105,30 @@ return true; } +bool ImageButton::loadImages(Resource* resImgUp, Resource* resImgDown) +{ + if (_imgUp.pointerToFree != NULL) { + free(_imgUp.pointerToFree); + _imgUp.pointerToFree = NULL; + } + if (_imgDown.pointerToFree != NULL) { + free(_imgDown.pointerToFree); + _imgDown.pointerToFree = NULL; + } + if (Image::decode(resImgUp, Image::RES_16BIT, &_imgUp) != 0) { + DMBoard::instance().logger()->printf("Failed to load \"up\" image\n"); + return false; + } + if (resImgDown != NULL) { + if (Image::decode(resImgDown, Image::RES_16BIT, &_imgDown) == 0) { + DMBoard::instance().logger()->printf("Failed to load \"down\" image\n"); + return false; + } + } + return true; +} + + void ImageButton::setTransparency(COLOR_T tColor) { _transparent = true;