Rev 8103 | Rev 8897 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8103 | Rev 8195 | ||
---|---|---|---|
Line 32... | Line 32... | ||
32 | return col; |
32 | return col; |
33 | } |
33 | } |
34 | 34 | ||
35 | void createimage(int xsize, int ysize) |
35 | void createimage(int xsize, int ysize) |
36 | { |
36 | { |
37 | if(xsize<=0 || ysize<=0) |
37 | if(xsize<=0 || ysize<=0) texgif_error("Bad image size."); |
38 | if(xsize*ysize>IMAGE_SIZE_LIMIT) |
38 | if(xsize*ysize>IMAGE_SIZE_LIMIT) texgif_error("Image size too big."); |
39 | image=gdImageCreate(xsize,ysize); |
39 | image=gdImageCreate(xsize,ysize); |
40 | if(image==NULL) |
40 | if(image==NULL) texgif_error("Image creation failure"); |
41 | color_white=gdImageColorAllocate(image,255,255,255); |
41 | color_white=gdImageColorAllocate(image,255,255,255); |
42 | color_black=gdImageColorAllocate(image,0,0,0); |
42 | color_black=gdImageColorAllocate(image,0,0,0); |
43 | color_bounder=gdImageColorAllocate(image,1,2,3); |
43 | color_bounder=gdImageColorAllocate(image,1,2,3); |
44 | gdImageColorTransparent(image,color_white); |
44 | gdImageColorTransparent(image,color_white); |
45 | printf("Created image: %dx%d\n",xsize,ysize); |
45 | printf("Created image: %dx%d\n",xsize,ysize); |
Line 54... | Line 54... | ||
54 | if(image==NULL) return; |
54 | if(image==NULL) return; |
55 | xsize=image->sx; ysize=image->sy; |
55 | xsize=image->sx; ysize=image->sy; |
56 | ff=outfile; while(isspace(*ff)) ff++; |
56 | ff=outfile; while(isspace(*ff)) ff++; |
57 | for(; *outfile && *outfile!='\n';outfile++); |
57 | for(; *outfile && *outfile!='\n';outfile++); |
58 | if(*outfile) *outfile++=0; |
58 | if(*outfile) *outfile++=0; |
59 | outf=fopen(ff,"w"); if(outf==NULL) |
59 | outf=fopen(ff,"w"); if(outf==NULL) texgif_error("unable to create gif output."); |
60 | printf("Output to %s.\n",ff); |
60 | printf("Output to %s.\n",ff); |
61 | if(compressratio==1) gdImageGif(image,outf); |
61 | if(compressratio==1) gdImageGif(image,outf); |
62 | else { |
62 | else { |
63 | gdImagePtr image2; |
63 | gdImagePtr image2; |
64 | int x2, y2; |
64 | int x2, y2; |