diff options
author | mrwastl <mrwastl@users.sourceforge.net> | 2012-06-07 16:47:13 +0200 |
---|---|---|
committer | mrwastl <mrwastl@users.sourceforge.net> | 2012-06-07 16:47:13 +0200 |
commit | dbd4bd72007e382bea3a123cc2d86fefd962cf37 (patch) | |
tree | fd5b5cc48fce459732eececb103e9a84f1f2ee92 /glcdgraphics/imagefile.c | |
parent | a39f265732d0bc28cb66b58b5ecf1964a130d02b (diff) | |
download | graphlcd-base-dbd4bd72007e382bea3a123cc2d86fefd962cf37.tar.gz graphlcd-base-dbd4bd72007e382bea3a123cc2d86fefd962cf37.tar.bz2 |
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
Diffstat (limited to 'glcdgraphics/imagefile.c')
-rw-r--r-- | glcdgraphics/imagefile.c | 12 |
1 files changed, 10 insertions, 2 deletions
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 <andreas.regel AT powarman.de> + * (c) 2006 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2010-2012 Wolfgang Astleitner <mrwastl AT users sourceforge net> */ #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; } |