cvs: gd /libgd/tests bug00002_3.c

[email protected] ("Pierre-Alain Joye")
Newsgroups php.gd.cvs
Message-ID <cvspajoye1167964873@cvsserver>
pajoye		Fri Jan  5 02:41:13 2007 UTC

  Added files:                 
    /gd/libgd/tests	bug00002_3.c 
  Log:
  - add a test to conver the case described in issue #32
    when a tile is a truecolor image, background of tiled region is painted 
    black rather than transparent 
  
  

http://cvs.php.net/viewvc.cgi/gd/libgd/tests/bug00002_3.c?view=markup&rev=1.1
Index: gd/libgd/tests/bug00002_3.c
+++ gd/libgd/tests/bug00002_3.c
/* $Id: bug00002_3.c,v 1.1 2007/01/05 02:41:13 pajoye Exp $ */
#include <gd.h>
#include <stdio.h>

int main()
{
	gdImagePtr im, tile;
	int im_white, im_black, tile_white, tile_black;
	int x,y;
	FILE *fp;

	fputs("flag 0\n", stdout);
	im = gdImageCreate(150, 150);
	tile = gdImageCreateTrueColor(36, 36);
	tile_white = gdImageColorAllocate(tile,255,255,255);
	tile_black = gdImageColorAllocate(tile,0,0,0);
	im_white = gdImageColorAllocate(im,255,255,255);
	im_black = gdImageColorAllocate(im,0,0,0);

	gdImageFill(tile, 0,0, tile_white);


	/* create the dots pattern */
	for (x=0;x<36;x+=2) {
		for (y=0;y<36;y+=2) {
			gdImageSetPixel(tile,x,y,tile_black);
		}
	}
	
	gdImageSetTile(im,tile);
	gdImageRectangle(im, 9,9,139,139, im_black);
	gdImageLine(im, 9,9,139,139, im_black);
	gdImageFill(im, 11,12, gdTiled);

	
	fputs("flag 1\n", stdout);
	gdImageFill(im, 0, 0, 0xffffff);
	fputs("flag 2\n", stdout);
	gdImageFill(im, 0, 0, 0xffffff);
	fputs("flag 3\n", stdout);

	fp = fopen("a.png", "wb");
 	/* Write img to stdout */
 	gdImagePng(im,fp);
	fclose(fp);

 	/* Destroy it */
 	gdImageDestroy(im);
	return 0;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.