From 65352b16a8d520a6de63c8e57a2db6392982e6c1 Mon Sep 17 00:00:00 2001 From: "Mirar (Pontus Hagland)" <pike@sort.mirar.org> Date: Mon, 12 Apr 1999 13:41:17 +0200 Subject: [PATCH] doc fix Rev: src/modules/Image/encodings/any.c:1.7 Rev: src/modules/Image/encodings/bmp.c:1.3 Rev: src/modules/Image/encodings/xbm.c:1.2 Rev: src/modules/Image/encodings/xcf.c:1.5 Rev: src/modules/Image/encodings/xwd.c:1.9 Rev: src/modules/Image/search.c:1.8 --- src/modules/Image/encodings/any.c | 31 +++++++++++++--- src/modules/Image/encodings/bmp.c | 61 ++++++++++++++++++------------- src/modules/Image/encodings/xbm.c | 4 +- src/modules/Image/encodings/xcf.c | 19 +++++----- src/modules/Image/encodings/xwd.c | 11 ++++-- src/modules/Image/search.c | 3 +- 6 files changed, 85 insertions(+), 44 deletions(-) diff --git a/src/modules/Image/encodings/any.c b/src/modules/Image/encodings/any.c index 6add3ea124..006e3dbf5a 100644 --- a/src/modules/Image/encodings/any.c +++ b/src/modules/Image/encodings/any.c @@ -1,9 +1,9 @@ -/* $Id: any.c,v 1.6 1999/04/09 10:19:51 mirar Exp $ */ +/* $Id: any.c,v 1.7 1999/04/12 11:41:12 mirar Exp $ */ /* **! module Image **! note -**! $Id: any.c,v 1.6 1999/04/09 10:19:51 mirar Exp $ +**! $Id: any.c,v 1.7 1999/04/12 11:41:12 mirar Exp $ **! submodule ANY **! **! This method calls the other decoding methods @@ -23,7 +23,7 @@ #include <ctype.h> #include "stralloc.h" -RCSID("$Id: any.c,v 1.6 1999/04/09 10:19:51 mirar Exp $"); +RCSID("$Id: any.c,v 1.7 1999/04/12 11:41:12 mirar Exp $"); #include "pike_macros.h" #include "operators.h" #include "builtin_functions.h" @@ -36,14 +36,16 @@ RCSID("$Id: any.c,v 1.6 1999/04/09 10:19:51 mirar Exp $"); #include "error.h" #include "threads.h" +#include "image.h" + void image_gif__decode(INT32 args); void image_pnm_decode(INT32 args); void image_xwd__decode(INT32 args); /* **! method mapping _decode(string data) -** method object decode(string data) -** method object decode_alpha(string data) +**! method object decode(string data) +**! method object decode_alpha(string data) **! Tries heuristics to find the correct method **! of decoding the data, then calls that method. **! @@ -148,6 +150,21 @@ simple_image: return; } +void image_any_decode(INT32 args) +{ + image_any__decode(args); + push_text("image"); + f_index(2); +} + +void image_any_decode_alpha(INT32 args) +{ + image_any__decode(args); + push_text("alpha"); + f_index(2); +} + + /** module *******************************************/ void init_image_any(void) @@ -158,6 +175,10 @@ void init_image_any(void) add_function("_decode",image_any__decode, "function(string:mapping)",0); + add_function("decode",image_any_decode, + "function(string:mapping)",0); + add_function("decode_alpha",image_any_decode_alpha, + "function(string:mapping)",0); /** done **/ p=end_program(); diff --git a/src/modules/Image/encodings/bmp.c b/src/modules/Image/encodings/bmp.c index cb494b1b3e..98243d4054 100644 --- a/src/modules/Image/encodings/bmp.c +++ b/src/modules/Image/encodings/bmp.c @@ -1,9 +1,9 @@ -/* $Id: bmp.c,v 1.2 1999/04/11 12:55:13 mirar Exp $ */ +/* $Id: bmp.c,v 1.3 1999/04/12 11:41:13 mirar Exp $ */ /* **! module Image **! note -**! $Id: bmp.c,v 1.2 1999/04/11 12:55:13 mirar Exp $ +**! $Id: bmp.c,v 1.3 1999/04/12 11:41:13 mirar Exp $ **! submodule BMP **! **! This submodule keeps the BMP (Windows Bitmap) @@ -14,14 +14,6 @@ **! Simple encoding:<br> **! <ref>encode</ref> **! -**! Advanced encoding:<br> -**! <ref>encode_P1</ref>, <br> -**! <ref>encode_P2</ref>, <br> -**! <ref>encode_P3</ref>, <br> -**! <ref>encode_P4</ref>, <br> -**! <ref>encode_P5</ref>, <br> -**! <ref>encode_P6</ref> -**! **! see also: Image, Image.image, Image.colortable */ #include "global.h" @@ -30,7 +22,7 @@ #include <ctype.h> #include "stralloc.h" -RCSID("$Id: bmp.c,v 1.2 1999/04/11 12:55:13 mirar Exp $"); +RCSID("$Id: bmp.c,v 1.3 1999/04/12 11:41:13 mirar Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -420,12 +412,15 @@ void i_img_bmp__decode(INT32 args,int header_only) img=(struct image*)get_storage(o,image_program); n++; - if (comp) - error("Image.BMP.decode: can't handle compressed BMP\n"); + if (comp > 2) + error("Image.BMP.decode: illegal compression: %d\n",comp); switch (bpp) { case 24: + if (comp) + error("Image.BMP.decode: can't handle compressed 24bpp BMP\n"); + j=(len)/3; y=img->ysize; while (j && y--) @@ -443,6 +438,9 @@ void i_img_bmp__decode(INT32 args,int header_only) } break; case 8: + if (comp) + error("Image.BMP.decode: can't handle compressed 8bpp BMP\n"); + skip=4-(img->xsize&3); j=len; y=img->ysize; @@ -457,23 +455,36 @@ void i_img_bmp__decode(INT32 args,int header_only) } break; case 4: - skip=3-((img->xsize/2)&3); - j=len; - y=img->ysize; - while (j && y--) + if (comp == 1) + error("Image.BMP.decode: can't handle RLE4 compressed 4bpp BMP\n"); + + if (comp == 2) /* RLE4 */ { - d=img->img+img->xsize*y; - i=img->xsize; - while (i && j--) + + } + else + { + skip=3-((img->xsize/2)&3); + j=len; + y=img->ysize; + while (j && y--) { - if (i) *(d++)=nct->u.flat.entries[(s[0]>>4)&15].color,i--; - if (i) *(d++)=nct->u.flat.entries[s[0]&15].color,i--; - s++; + d=img->img+img->xsize*y; + i=img->xsize; + while (i && j--) + { + if (i) *(d++)=nct->u.flat.entries[(s[0]>>4)&15].color,i--; + if (i) *(d++)=nct->u.flat.entries[s[0]&15].color,i--; + s++; + } + if (j>=skip) { j-=skip; s+=skip; } } - if (j>=skip) { j-=skip; s+=skip; } } break; case 1: + if (comp) + error("Image.BMP.decode: can't handle compressed 1bpp BMP\n"); + skip=3-((img->xsize/8)&3); j=len; y=img->ysize; @@ -535,7 +546,7 @@ void init_image_bmp(void) "function(object,void|object:string)",0); add_function("_decode",img_bmp__decode, "function(string:mapping)",0); - add_function("ddecode",img_bmp_decode, + add_function("decode",img_bmp_decode, "function(string:object)",0); add_function("decode_header",img_bmp_decode_header, "function(string:mapping)",0); diff --git a/src/modules/Image/encodings/xbm.c b/src/modules/Image/encodings/xbm.c index 0a72c0fc56..cad8b7b09c 100644 --- a/src/modules/Image/encodings/xbm.c +++ b/src/modules/Image/encodings/xbm.c @@ -1,5 +1,5 @@ #include "global.h" -RCSID("$Id: xbm.c,v 1.1 1999/04/06 06:23:57 per Exp $"); +RCSID("$Id: xbm.c,v 1.2 1999/04/12 11:41:14 mirar Exp $"); #include "config.h" @@ -238,6 +238,7 @@ static void image_xbm_decode( INT32 args ) **! "bg":({bgcolor}), // Background color. Default white **! "invert":1, // Invert the mask **! ]) +**! </pre> **! **! note **! Throws upon error in data. @@ -377,6 +378,7 @@ static void image_xbm__decode( INT32 args ) **! normal options: **! "name":"xbm_image_name" **! The name of the XBM. Defaults to 'image' +**! </pre> */ static struct pike_string *param_name; diff --git a/src/modules/Image/encodings/xcf.c b/src/modules/Image/encodings/xcf.c index 3688dcfa6f..0e7d2f6058 100644 --- a/src/modules/Image/encodings/xcf.c +++ b/src/modules/Image/encodings/xcf.c @@ -1,5 +1,5 @@ #include "global.h" -RCSID("$Id: xcf.c,v 1.4 1999/04/12 01:53:42 per Exp $"); +RCSID("$Id: xcf.c,v 1.5 1999/04/12 11:41:16 mirar Exp $"); #include "config.h" @@ -898,7 +898,7 @@ void image_xcf_f__rle_decode( INT32 args ) **! **! <pre>Returned structure reference **! -**! class GimpImage +**! !class GimpImage **! { **! int width; **! int height; @@ -921,7 +921,7 @@ void image_xcf_f__rle_decode( INT32 args ) **! Channel selection; **! } **! -**! class Layer +**! !class Layer **! { **! string name; **! int opacity; @@ -936,7 +936,7 @@ void image_xcf_f__rle_decode( INT32 args ) **! Hierarchy image; **! } **! -**! class Channel +**! !class Channel **! { **! string name; **! int width; @@ -950,7 +950,7 @@ void image_xcf_f__rle_decode( INT32 args ) **! array (Parasite) parasites; **! } **! -**! class Hierarchy +**! !class Hierarchy **! { **! Image.image img; **! Image.image alpha; @@ -959,20 +959,21 @@ void image_xcf_f__rle_decode( INT32 args ) **! int bpp; **! } **! -**! class Parasite +**! !class Parasite **! { **! string name; **! int flags; **! string data; **! } **! -**! class Guide +**! +**! !class Guide **! { **! int pos; **! int vertical; **! } **! -**! class Path +**! !class Path **! { **! string name; **! int ptype; @@ -983,7 +984,7 @@ void image_xcf_f__rle_decode( INT32 args ) **! array (PathPoint) points = ({}); **! } **! -**! class PathPoint +**! !class PathPoint **! { **! int type; **! float x; diff --git a/src/modules/Image/encodings/xwd.c b/src/modules/Image/encodings/xwd.c index 030aab725d..f8b33eb2be 100644 --- a/src/modules/Image/encodings/xwd.c +++ b/src/modules/Image/encodings/xwd.c @@ -1,9 +1,9 @@ -/* $Id: xwd.c,v 1.8 1999/02/24 03:18:09 mirar Exp $ */ +/* $Id: xwd.c,v 1.9 1999/04/12 11:41:17 mirar Exp $ */ /* **! module Image **! note -**! $Id: xwd.c,v 1.8 1999/02/24 03:18:09 mirar Exp $ +**! $Id: xwd.c,v 1.9 1999/04/12 11:41:17 mirar Exp $ **! submodule XWD **! **! This submodule keeps the XWD (X Windows Dump) @@ -25,7 +25,7 @@ #include <ctype.h> #include "stralloc.h" -RCSID("$Id: xwd.c,v 1.8 1999/02/24 03:18:09 mirar Exp $"); +RCSID("$Id: xwd.c,v 1.9 1999/04/12 11:41:17 mirar Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -347,6 +347,11 @@ void image_xwd__decode(INT32 args) free_string(s); } +/* +**! method object decode(string data) +**! Simple decodes a XWD image file. +*/ + static void image_xwd_decode(INT32 args) { if (!args) diff --git a/src/modules/Image/search.c b/src/modules/Image/search.c index ad2f1d0375..fbf0748886 100644 --- a/src/modules/Image/search.c +++ b/src/modules/Image/search.c @@ -88,7 +88,7 @@ static void chrono(char *x) **! in the orginal image. **! **! returns the new image object -**! see also: match_phase +** see also: match_phase **! bugs **! 0 should not be set as explained above. **! note @@ -381,6 +381,7 @@ void image_make_ascii(INT32 args) /* **! <pre> | / - \ **! hue= 0 64 128 192 (=red in an hsv image) +**! </pre> */ THREADS_DISALLOW(); -- GitLab