diff --git a/src/modules/Image/encodings/gif.c b/src/modules/Image/encodings/gif.c index 00a2f2411424e29fe131c704a03f3241394444d6..dc73cd4bbbbe730dc1a15a3d5c2a98452718c5d8 100644 --- a/src/modules/Image/encodings/gif.c +++ b/src/modules/Image/encodings/gif.c @@ -1,9 +1,9 @@ -/* $Id: gif.c,v 1.22 1998/01/11 21:55:47 mirar Exp $ */ +/* $Id: gif.c,v 1.23 1998/01/14 16:11:55 mirar Exp $ */ /* **! module Image **! note -**! $Id: gif.c,v 1.22 1998/01/11 21:55:47 mirar Exp $ +**! $Id: gif.c,v 1.23 1998/01/14 16:11:55 mirar Exp $ **! submodule GIF **! **! This submodule keep the GIF encode/decode capabilities @@ -31,7 +31,7 @@ #include "stralloc.h" #include "global.h" -RCSID("$Id: gif.c,v 1.22 1998/01/11 21:55:47 mirar Exp $"); +RCSID("$Id: gif.c,v 1.23 1998/01/14 16:11:55 mirar Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -353,7 +353,7 @@ void image_gif_end_block(INT32 args) **! **! note **! This is in the very advanced sector of the GIF support; -**! please read about how GIFs file works. +**! please read about how GIF files works. **! **! Most decoders just ignore some or all of these parameters. */ @@ -416,7 +416,7 @@ static void image_gif__gce_block(INT32 args) **! **! note **! This is in the very advanced sector of the GIF support; -**! please read about how GIFs file works. +**! please read about how GIF files works. */ static void image_gif__render_block(INT32 args) @@ -1236,25 +1236,25 @@ void image_gif_netscape_loop_block(INT32 args) **! returns an array containing the GIF structure; **! **! <pre> -**! ({int xsize,int ysize, // 0: size of image drawing area -**! int numcol, // 2: suggested number of colors -**! void|string colortable, // 3: opt. global colortable -**! ({ int aspx, int aspy, // 4,0: aspect ratio or 0, 0 if not set -**! int background }), // 1: index of background color +**! ({int xsize,int ysize, // 0: size of image drawing area +**! int numcol, // 2: suggested number of colors +**! void|string colortable, // 3: opt. global colortable +**! ({ int aspx, int aspy, // 4,0: aspect ratio or 0, 0 if not set +**! int background }), // 1: index of background color **! </pre> **! followed by any number these blocks in any order: **! <pre> -**! ({ GIF.EXTENSION, // 0: block identifier -**! int extension, // 1: extension number -**! string data }) // 2: extension data -**! -**! ({ GIF.RENDER, // 0: block identifier -**! int x, int y, // 1: position of render -**! int xsize, int ysize,// 3: size of render -**! int interlace, // 5: interlace flag -**! void|string colortbl,// 6: opt. local colortable -**! int lzwsize, // 7: lzw code size -**! string lzwdata }) // 8: packed lzw data +**! ({ GIF.EXTENSION, // 0: block identifier +**! int extension, // 1: extension number +**! string data }) // 2: extension data +**! +**! ({ GIF.RENDER, // 0: block identifier +**! int x, int y, // 1: position of render +**! int xsize, int ysize, // 3: size of render +**! int interlace, // 5: interlace flag +**! void|string colortbl, // 6: opt. local colortable +**! int lzwsize, // 7: lzw code size +**! string lzwdata }) // 8: packed lzw data **! </pre> **! and possibly ended with one of these: **! <pre> @@ -1273,7 +1273,7 @@ void image_gif_netscape_loop_block(INT32 args) **! May throw errors if the GIF header is incomplete or illegal. **! **! This is in the very advanced sector of the GIF support; -**! please read about how GIFs file works. +**! please read about how GIF files works. */ static void _decode_get_extension(unsigned char **s, @@ -1544,8 +1544,8 @@ static void image_gif___decode(INT32 args) **! <pre> **! ({int xsize,int ysize, // 0: size of image drawing area **! void|string colortable, // 2: opt. global colortable -**! ({ int aspx, int aspy, // 3,0: aspect ratio or 0, 0 if not set -**! int background }), // 3: index of background color +**! ({ int aspx, int aspy, // 3 0: aspect ratio or 0, 0 if not set +**! int background }), // 2: index of background color **! </pre> **! followed by any number these blocks in any order (gce chunks **! are decoded and incorporated in the render chunks): @@ -1578,6 +1578,25 @@ static void image_gif___decode(INT32 args) **! string data }) // (rest of file) **! </pre> **! +**! The <ref>decode</ref> method uses this data in a way similar +**! to this program: +**! +**! <pre> +**! import Image; +**! +**! object my_decode_gif(string data) +**! { +**! array a=GIF._decode(data); +**! object img=image(a[0],a[1]); +**! foreach (a[4..],array b) +**! if (b[0]==GIF.RENDER) +**! if (b[4]) img->paste_alpha(b[3],b[4],b[1],b[2]); +**! else img->paste(b[3],b[1],b[2]); +**! return img; +**! } +**! </pre> +**! +**! **! arg string gifdata **! GIF data (with header and all) **! arg array __decoded @@ -1589,7 +1608,7 @@ static void image_gif___decode(INT32 args) **! May throw errors if the GIF header is incomplete or illegal. **! **! This is in the very advanced sector of the GIF support; -**! please read about how GIFs file works. +**! please read about how GIF files works. */ static void _gif_decode_lzw(unsigned char *s, diff --git a/src/modules/Image/encodings/pnm.c b/src/modules/Image/encodings/pnm.c index 59114f2c4e3c148e1d37f1f40f2970ddbb2c86a7..1f7ca751b98b0132701fb0f44f3e2f0dc2ab6c99 100644 --- a/src/modules/Image/encodings/pnm.c +++ b/src/modules/Image/encodings/pnm.c @@ -1,9 +1,9 @@ -/* $Id: pnm.c,v 1.9 1998/01/13 01:35:28 mirar Exp $ */ +/* $Id: pnm.c,v 1.10 1998/01/14 16:11:56 mirar Exp $ */ /* **! module Image **! note -**! $Id: pnm.c,v 1.9 1998/01/13 01:35:28 mirar Exp $ +**! $Id: pnm.c,v 1.10 1998/01/14 16:11:56 mirar Exp $ **! submodule PNM **! **! This submodule keeps the PNM encode/decode capabilities @@ -49,7 +49,7 @@ #include "stralloc.h" #include "global.h" -RCSID("$Id: pnm.c,v 1.9 1998/01/13 01:35:28 mirar Exp $"); +RCSID("$Id: pnm.c,v 1.10 1998/01/14 16:11:56 mirar Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -244,12 +244,12 @@ void img_pnm_decode(INT32 args) **! uses the most optimized encoding for this image (bitmap, grey **! or truecolor) - P4, P5 or P6 respective P1, P2 or P3. **! -**! P1/P4 assumes the image is black and white. Use +**! <ref>P1</ref>/<ref>P4</ref> assumes the image is black and white. Use **! <ref>Image.image->threshold</ref>() or something like **! <tt><ref>Image.colortable</ref>( ({({0,0,0}),({255,255,255})}) )->floyd_steinberg()->map(my_image)</ref></tt> **! to get a black and white image. **! -**! P2/P5 assumes the image is greyscale. Use +**! <ref>P2</ref>/<ref>P5</ref> assumes the image is greyscale. Use **! <ref>Image.image->grey</ref>() to get a greyscale image. **! **! see also: decode