Diff for /parser3/src/classes/gd/Attic/gif.C between versions 1.24 and 1.30.2.4.2.3

version 1.24, 2002/01/22 09:26:57 version 1.30.2.4.2.3, 2003/03/26 13:46:58
Line 1 Line 1
 /** @file  /** @file
         Parser: image manipulations impl1.          Parser: image manipulations impl1.
   
         Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)          Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com)
         Author: Alexander Petrosyan <paf@design.ru> (http://paf.design.ru)          Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
   
         $Id$  
   
         based on: gd          based on: gd
   
         Written by Tom Boutell, 5/94.          Written by Tom Boutell, 5/94.
Line 17 Line 14
         can incorporate them into new versions.           can incorporate them into new versions. 
 */  */
   
   static const char* IDENT_GIF_C="$Date$";
   
 #include "gif.h"  #include "gif.h"
   
 #include "mtables.h"  #include "mtables.h"
 #include "pa_common.h"  //#include "pa_common.h"
   
 //static void BrushApply(int x, int y);  //static void BrushApply(int x, int y);
 //static void TileApply(int x, int y);  //static void TileApply(int x, int y);
Line 33  void gdImage::Create(int asx, int asy) { Line 32  void gdImage::Create(int asx, int asy) {
         pixels = (unsigned char **) malloc(sizeof(unsigned char *) * sx);          pixels = (unsigned char **) malloc(sizeof(unsigned char *) * sx);
         polyInts = 0;          polyInts = 0;
         polyAllocated = 0;          polyAllocated = 0;
         lineWidth = 1;  lineStyle=0;          lineWidth = 1;
         for (i=0; (i<asx); i++)          for (i=0; (i<asx); i++)
                 pixels[i] = (unsigned char *) calloc(asy);                  pixels[i] = (unsigned char *) malloc_atomic(asy);
         colorsTotal = 0;          colorsTotal = 0;
         transparent = (-1);          transparent = (-1);
         interlace = 0;          interlace = 0;
Line 658  void gdImage::CopyResampled(gdImage& dst Line 657  void gdImage::CopyResampled(gdImage& dst
 {  {
         gdImage& src=*this;          gdImage& src=*this;
         int x, y;          int x, y;
           int srcTransparent=src.GetTransparent();
           int dstTransparent=dst.GetTransparent();
         for (y = dstY; (y < dstY + dstH); y++) {          for (y = dstY; (y < dstY + dstH); y++) {
                 for (x = dstX; (x < dstX + dstW); x++) {                  for (x = dstX; (x < dstX + dstW); x++) {
                         int pd = dst.GetPixel (x, y);                          int pd = dst.GetPixel (x, y);
                         /* Added 7/24/95: support transparent copies */                          /* Added 7/24/95: support transparent copies */
                         if (src.GetTransparent() == pd)                          /* fixed by paf 20030116, another fix below */
                           if (pd == dstTransparent)
                                 continue;                                  continue;
                                                   
                         double sy1, sy2, sx1, sx2;                          double sy1, sy2, sx1, sx2;
                         double sx, sy;                          double sx, sy;
                         double spixels = 0;                          double spixels = 0;
                         double red = 0.0, green = 0.0, blue = 0.0;                          double red = 0.0, green = 0.0, blue = 0.0;
                           bool transparent=true;
                         sy1 = ((double) y - (double) dstY) * (double) srcH /                          sy1 = ((double) y - (double) dstY) * (double) srcH /
                                 (double) dstH;                                  (double) dstH;
                         sy2 = ((double) (y + 1) - (double) dstY) * (double) srcH /                          sy2 = ((double) (y + 1) - (double) dstY) * (double) srcH /
Line 725  void gdImage::CopyResampled(gdImage& dst Line 728  void gdImage::CopyResampled(gdImage& dst
                                         p = src.GetPixel (                                          p = src.GetPixel (
                                                 (int) sx,                                                  (int) sx,
                                                 (int) sy);                                                  (int) sy);
                                         red += Red (p) * pcontribution;                                          // fix added 20020116 by paf to support transparent src
                                         green += Green (p) * pcontribution;                                          if (p!=srcTransparent) {
                                         blue += Blue (p) * pcontribution;                                                  transparent = false;
                                                   red += Red (p) * pcontribution;
                                                   green += Green (p) * pcontribution;
                                                   blue += Blue (p) * pcontribution;
                                           }
                                         spixels += xportion * yportion;                                          spixels += xportion * yportion;
                                         sx += 1.0;                                          sx += 1.0;
                                 } while (sx < sx2);                                  } while (sx < sx2);
                                 sy += 1.0;                                  sy += 1.0;
                         } while (sy < sy2);                          } while (sy < sy2);
   
                           if(transparent)
                                   continue;
   
                         if (spixels != 0.0) {                          if (spixels != 0.0) {
                                 red /= spixels;                                  red /= spixels;
                                 green /= spixels;                                  green /= spixels;
Line 1078  void gdImage::SetLineWidth(int width) Line 1089  void gdImage::SetLineWidth(int width)
         lineWidth=width;          lineWidth=width;
 }  }
   
 void gdImage::SetLineStyle(const char *alineStyle)  void gdImage::SetLineStyle(const char* alineStyle)
 {  {
         lineStyle=alineStyle;          lineStyle=alineStyle;
 }  }

Removed from v.1.24  
changed lines
  Added in v.1.30.2.4.2.3


E-mail: