summaryrefslogtreecommitdiff
path: root/glcdgraphics/imagefile.c
diff options
context:
space:
mode:
Diffstat (limited to 'glcdgraphics/imagefile.c')
-rw-r--r--glcdgraphics/imagefile.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/glcdgraphics/imagefile.c b/glcdgraphics/imagefile.c
index 2f56f4a..0f9ec25 100644
--- a/glcdgraphics/imagefile.c
+++ b/glcdgraphics/imagefile.c
@@ -6,11 +6,13 @@
* This file is released under the GNU General Public License. Refer
* to the COPYING file distributed with this package.
*
- * (c) 2006 Andreas Regel <andreas.regel AT powarman.de>
+ * (c) 2006 Andreas Regel <andreas.regel AT powarman.de>
+ * (c) 2010-2013 Wolfgang Astleitner <mrwastl AT users sourceforge net>
*/
#include "image.h"
#include "imagefile.h"
+#include "bitmap.h"
namespace GLCD
{
@@ -32,4 +34,21 @@ bool cImageFile::Save(cImage & image, const std::string & fileName)
return false;
}
+
+
+bool cImageFile::LoadScaled(cImage & image, const std::string & fileName, uint16_t & scalew, uint16_t & scaleh)
+{
+ if (Load(image, fileName)) {
+ if (scalew || scaleh) {
+ return image.Scale(scalew, scaleh, true);
+ } else {
+ return true;
+ }
+ } else {
+ scalew = 0;
+ scaleh = 0;
+ return false;
+ }
+}
+
} // end of namespace