1. libgd
  2. Untitled project
  3. gd-libgd

Commits

pajoye  committed ee875a2

- fix 32bit read support, inverted vertically

  • Participants
  • Parent commits f2b28b4
  • Branches GD-2.0

Comments (0)

Files changed (1)

File src/gd_tiff.c

View file
  • Ignore whitespace
-
-
 /*
    TIFF - Tagged Image File Format Encapsulation for GD Library
 
 
    ----------------------------------------------------------------------------
  */
+/* $Id$ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
   else
   {
     /* image is not tiled - assume stripped (scanline) format */
-/*    printf("is a 1bit scanline tiff!\n");*/
+    printf("is a 1bit scanline tiff!\n");
     scan=malloc(TIFFScanlineSize(tiff));
     y=0;
     x=0;
 
   if(TIFFIsTiled(tiff))
   {
-/*    printf("is a 8bit tiled tiff! (%d tiles)\n",numberOfTiles);*/
+    printf("is a 8bit tiled tiff! (%d tiles)\n",numberOfTiles);
     TIFFGetField(tiff, TIFFTAG_TILEWIDTH, &tileMaxX);
     TIFFGetField(tiff, TIFFTAG_TILELENGTH, &tileMaxY);
 
   uint32 *scan;
   uint32 rgba;
 
+	printf("32 bits\n");
+
   if(!(im=gdImageCreateTrueColor(width,height)))
   {
     TIFFClose(tiff);
   alphaBlendingFlag=im->alphaBlendingFlag;
   gdImageAlphaBlending(im,0);
 
-  /* Make sure new image begins completely black */
-  gdImageColorAllocateAlpha(im, 0, 0, 0, 0x0);
-
   /* loop through y-coords, and x-coords */
   scan=calloc(sizeof(uint32),width*height);
   TIFFReadRGBAImage(tiff,width,height,scan,0);
       g=TIFFGetG(rgba);
       r=TIFFGetR(rgba);
 
-      colour=gdImageColorResolveAlpha(im,r,g,b,a);
+      colour=gdTrueColorAlpha(r,g,b,a);
 
       /* set pixel colour to this colour */
-      gdImageSetPixel(im,x,y,colour);
+      gdImageSetPixel(im, x, height - y - 1,colour);
     }
   }
   free(scan);