From dbd4bd72007e382bea3a123cc2d86fefd962cf37 Mon Sep 17 00:00:00 2001 From: mrwastl Date: Thu, 7 Jun 2012 16:47:13 +0200 Subject: Image/GraphicsMagick: use much more relieable sample() instead of scale() for scaling images; monochrome images: fix monochrome bug in imagefile.c; explicitly prepend namespace Magick:: instead of using 'using namespace Magick;' (easier when debugging); some code / var-names beautifyings --- glcdgraphics/imagefile.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'glcdgraphics/imagefile.c') diff --git a/glcdgraphics/imagefile.c b/glcdgraphics/imagefile.c index d6baf24..b8c6a42 100644 --- a/glcdgraphics/imagefile.c +++ b/glcdgraphics/imagefile.c @@ -6,7 +6,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2006 Andreas Regel + * (c) 2006 Andreas Regel + * (c) 2010-2012 Wolfgang Astleitner */ #include "image.h" @@ -96,6 +97,8 @@ bool cImageFile::Scale(cImage & image, uint16_t scalew, uint16_t scaleh, bool An cBitmap *b = new cBitmap(scalew, scaleh, GRAPHLCD_Transparent); cBitmap *currFrame = image.GetBitmap(frame); + + b->SetMonochrome(currFrame->IsMonochrome()); if (downscale) { // Downscaling - no anti-aliasing: @@ -140,8 +143,13 @@ bool cImageFile::Scale(cImage & image, uint16_t scalew, uint16_t scaleh, bool An image.SetWidth(scalew); image.SetHeight(scaleh); // re-add bitmaps from scaled image container + cBitmap * b; + cBitmap * tempb; for (unsigned int frame = 0; frame < tempImg.Count(); frame ++) { - image.AddBitmap(new cBitmap(scalew, scaleh, (uint32_t*)tempImg.GetBitmap(frame)->Data())); + tempb = tempImg.GetBitmap(frame); + b = new cBitmap(scalew, scaleh, (uint32_t*)tempb->Data()); + b->SetMonochrome(tempb->IsMonochrome()); + image.AddBitmap(b); } return true; } -- cgit v1.2.3