Received: from mailgate002.isp.belgacom.be (mailgate002.isp.belgacom.be [195.238.6.87])
	by maildelivery005.isp.belgacom.be (Postfix) with ESMTP id C15FA16401F
	for <joris.at.lebbeke@skynet.be>; Wed, 23 Apr 2008 16:28:11 +0200 (CEST)
Authentication-Results: in.mx.skynet.be; dkim=neutral (message not signed) header.i=none
Received: from r153.dmsolutions.ca (HELO duke.maptools.org) ([209.217.116.153])
  by in.mx.skynet.be with ESMTP; 23 Apr 2008 16:28:10 +0200
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id m3NDw50u019028;
	Wed, 23 Apr 2008 09:59:46 -0400
Received: from mcgi73.rambler.ru (mcgi73.rambler.ru [81.19.67.210])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id m3NDw2Rw019025
	for <tiff@lists.maptools.org>; Wed, 23 Apr 2008 09:58:03 -0400
Received: from [195.201.53.226] by mcgi73.rambler.ru with HTTP (mailimap);
	Wed, 23 Apr 2008 17:58:00 +0400
From: Roman Kazmin <kata@rambler.ru>
To: <tiff@lists.maptools.org>
Date: Wed, 23 Apr 2008 17:58:00 +0400
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain; charset="windows-1251"; format="flowed"
Message-Id: <1103169938.1208959080.98061448.23348@mcgi73.rambler.ru>
X-Mailer: Ramail 3u, (untone)
Subject: [Tiff] transparent tiff
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
Content-Transfer-Encoding: quoted-printable
X-UIDL: 000000000023ceae.00002c2b
X-MSP-STORE: Wed, 23 Apr 2008 16:27:01 +0200
Status:   

Hi everybody. I'm trying to create transparent tiff file. But I receive=20
usual tiff file. Where is my mistake? I'm trying to make following - red=20
screen with transparent green rectange at the center. Below is my code:

int main(int argc, char **argv)
{
	 TIFF *tif;
	 char    buffer[4*1024];
	 int     width =3D 1024, height =3D 768, row;
	 uint32 temp =3D EXTRASAMPLE_ASSOCALPHA;
	 tif =3D TIFFOpen("3d.tif", "w");

	 TIFFSetField (tif, TIFFTAG_IMAGEWIDTH, width);
	 TIFFSetField (tif, TIFFTAG_IMAGELENGTH, height);
	 TIFFSetField (tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
	 TIFFSetField (tif, TIFFTAG_SAMPLESPERPIXEL,  4);
	 TIFFSetField (tif, TIFFTAG_BITSPERSAMPLE,    8);
	 TIFFSetField (tif, TIFFTAG_EXTRASAMPLES,     1, &temp);
	 TIFFSetField (tif, TIFFTAG_ORIENTATION,=20
ORIENTATION_TOPLEFT);
	 TIFFSetField (tif, TIFFTAG_PHOTOMETRIC,      PHOTOMETRIC_RGB);
	 TIFFSetField (tif, TIFFTAG_IMAGEDESCRIPTION, "3D Simulation");
	 TIFFSetField (tif, TIFFTAG_COMPRESSION,=20
COMPRESSION_PACKBITS);
	 TIFFSetField (tif, TIFFTAG_ROWSPERSTRIP,     16);

	 for (row =3D 0; row < 768; row++)
	 {
		 for (int i =3D 0; i < 1024; i++)
		 {
			 if(row > 234 && row < 530 && i > 350 && i <=20
700)
			 {   // Here I'm trying to draw transparent=20
green rectangle
				 buffer[4*i]   =3D 0;
				 buffer[4*i+1] =3D 200;
				 buffer[4*i+2] =3D 0;
				 buffer[4*i+3] =3D 200; // transparency
			 }
			 else
			 {
				 buffer[4*i]   =3D 200;
				 buffer[4*i+1] =3D 0;
				 buffer[4*i+2] =3D 0;
				 buffer[4*i+3] =3D 0;
			 }
		 }
		 TIFFWriteScanline(tif, buffer, row, 0);
	 }
	 TIFFClose(tif); tif =3D NULL;
	 return 0;
}
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
