diff --git a/.gitattributes b/.gitattributes index 13be0a6c8a6e8565a0fa19286c835ad554a47a9b..2bce27d2944865be8b482400e322641ca24abbbe 100644 --- a/.gitattributes +++ b/.gitattributes @@ -78,7 +78,6 @@ testfont binary /src/modules/Image/dct.c foreign_ident /src/modules/Image/doc/Image.html foreign_ident /src/modules/Image/encodings/gif.c foreign_ident -/src/modules/Image/encodings/gif.h foreign_ident /src/modules/Image/encodings/gif_lzw.c foreign_ident /src/modules/Image/encodings/gif_lzw.h foreign_ident /src/modules/Image/encodings/pnm.c foreign_ident diff --git a/src/modules/Image/colortable.h b/src/modules/Image/colortable.h index 6da5048f7b343b96fde7c9a924d97b44514e6782..8cdf0bf38904fa16f1b5add16956f2ed29bfa111 100644 --- a/src/modules/Image/colortable.h +++ b/src/modules/Image/colortable.h @@ -1,16 +1,22 @@ /* **! module Image **! note -**! $Id: colortable.h,v 1.9 1997/11/11 03:31:59 grubba Exp $ +**! $Id: colortable.h,v 1.10 1997/11/11 22:17:47 mirar Exp $ */ -#ifndef PIKE_IMAGE_COLORTABLE_H +#ifdef PIKE_IMAGE_COLORTABLE_H +#error colortable.h included twice +#endif + #define PIKE_IMAGE_COLORTABLE_H #ifndef PIKE_IMAGE_IMAGE_H -#include "image.h" +#error colortable.h needs image.h #endif /* !PIKE_IMAGE_IMAGE_H */ + + + #define COLORLOOKUPCACHEHASHSIZE 207 typedef unsigned long nct_weight_t; @@ -203,4 +209,4 @@ int image_colortable_map_image(struct neo_colortable *nct, void image_colortable_cast_to_array(struct neo_colortable *nct); -#endif /* PIKE_IMAGE_COLORTABLE_H */ + diff --git a/src/modules/Image/doc-header b/src/modules/Image/doc-header index 3c123cfa4571e155878d7e4e6333ca57c15529a3..9e9a581fd0c3ab6b93450c811608d3c7aeb27164 100644 --- a/src/modules/Image/doc-header +++ b/src/modules/Image/doc-header @@ -1,5 +1,4 @@ **! module Image -**! **! This module adds image-drawing and -manipulating **! capabilities to pike. **! @@ -20,6 +19,10 @@ **! <td align=left valign=top><ref>Image.GIF</ref></td> **! <td align=left valign=top>GIF encoding/decoding capabilities</td> **! </tr> +**! <tr> +**! <td align=left valign=top><ref>Image.PNM</ref></td> +**! <td align=left valign=top>PNM (PBM/PGM/PPM) encoding/decoding capabilities</td> +**! </tr> **! </table> **! note **! <font size=-1><pre>Image module documentation is based on these file versions: diff --git a/src/modules/Image/encodings/gif.c b/src/modules/Image/encodings/gif.c index 0bcc834fe8cfa1424392d2da6fd4f4650ec77094..72576ee9829689ae73ebd79d72a3eaf275e75090 100644 --- a/src/modules/Image/encodings/gif.c +++ b/src/modules/Image/encodings/gif.c @@ -1,9 +1,9 @@ -/* $Id: gif.c,v 1.17 1997/11/11 03:45:31 grubba Exp $ */ +/* $Id: gif.c,v 1.18 1997/11/11 22:17:53 mirar Exp $ */ /* **! module Image **! note -**! $Id: gif.c,v 1.17 1997/11/11 03:45:31 grubba Exp $ +**! $Id: gif.c,v 1.18 1997/11/11 22:17:53 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.17 1997/11/11 03:45:31 grubba Exp $"); +RCSID("$Id: gif.c,v 1.18 1997/11/11 22:17:53 mirar Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -46,7 +46,6 @@ RCSID("$Id: gif.c,v 1.17 1997/11/11 03:45:31 grubba Exp $"); #include "colortable.h" #include "builtin_functions.h" -#include "gif.h" #include "gif_lzw.h" extern struct program *image_colortable_program; @@ -576,6 +575,48 @@ CHRONO("gif _render_block end"); **! // voila! A GIF animation on stdout. **! </pre> **! +**! <illustration type=image/gif> +**! object nct=colortable(lena(),32,({({0,0,0})})); +**! string s=GIF.header_block(lena()->xsize(),lena()->ysize(),nct); +**! foreach ( ({lena()->xsize(), +**! (int)(lena()->xsize()*0.75), +**! (int)(lena()->xsize()*0.5), +**! (int)(lena()->xsize()*0.25), +**! (int)(1), +**! (int)(lena()->xsize()*0.25), +**! (int)(lena()->xsize()*0.5), +**! (int)(lena()->xsize()*0.75)}),int xsize) +**! { +**! object o=lena()->scale(xsize,lena()->ysize()); +**! object p=lena()->clear(0,0,0); +**! p->paste(o,(lena()->xsize()-o->xsize())/2,0); +**! s+=GIF.render_block(p,nct,0,0,0,25); +**! } +**! s+=GIF.netscape_loop_block(200); +**! s+=GIF.end_block(); +**! return s; +**! </illustration>The above animation is thus created: +**! <pre> +**! object nct=colortable(lena,32,({({0,0,0})})); +**! string s=GIF.header_block(lena->xsize(),lena->ysize(),nct); +**! foreach ( ({lena->xsize(), +**! (int)(lena->xsize()*0.75), +**! (int)(lena->xsize()*0.5), +**! (int)(lena->xsize()*0.25), +**! (int)(1), +**! (int)(lena->xsize()*0.25), +**! (int)(lena->xsize()*0.5), +**! (int)(lena->xsize()*0.75)}),int xsize) +**! { +**! object o=lena->scale(xsize,lena->ysize()); +**! object p=lena->clear(0,0,0); +**! p->paste(o,(lena->xsize()-o->xsize())/2,0); +**! s+=GIF.render_block(p,nct,0,0,0,25); +**! } +**! s+=GIF.netscape_loop_block(200); +**! s+=GIF.end_block(); +**! write(s); +**! </pre> **! **! arg object img **! The image. diff --git a/src/modules/Image/encodings/gif.h b/src/modules/Image/encodings/gif.h deleted file mode 100644 index 04db40a66fdac6214fac7a44c03ba29a6e07a606..0000000000000000000000000000000000000000 --- a/src/modules/Image/encodings/gif.h +++ /dev/null @@ -1,8 +0,0 @@ -/* $Id: gif.h,v 1.1 1997/11/11 03:41:07 grubba Exp $ */ - -#ifndef PIKE_IMAGE_ENCODINGS_GIF_H -#define PIKE_IMAGE_ENCODINGS_GIF_H - -void image_gif_render_block(INT32 args); - -#endif /* PIKE_IMAGE_ENCODINGS_GIF_H */ diff --git a/src/modules/Image/font.c b/src/modules/Image/font.c index b2692b3110a2e4bc51d56c9dc609af30f1cec4c4..eaeba48fb810504b512d21c02596aa657c600e00 100644 --- a/src/modules/Image/font.c +++ b/src/modules/Image/font.c @@ -1,4 +1,4 @@ -/* $Id: font.c,v 1.20 1997/11/05 03:41:34 mirar Exp $ */ +/* $Id: font.c,v 1.21 1997/11/11 22:17:48 mirar Exp $ */ #include <config.h> #define SPACE_CHAR 'i' @@ -6,7 +6,7 @@ /* **! module Image **! note -**! $Id: font.c,v 1.20 1997/11/05 03:41:34 mirar Exp $ +**! $Id: font.c,v 1.21 1997/11/11 22:17:48 mirar Exp $ **! class font **! **! note @@ -203,7 +203,7 @@ static INLINE int char_width(struct font *this, unsigned char c) return this->charinfo[c].width; } - +#ifndef HAVE_MMAP static INLINE int my_read(int from, char *buf, int towrite) { int res; @@ -221,6 +221,7 @@ static INLINE int my_read(int from, char *buf, int towrite) } return res; } +#endif static INLINE long file_size(int fd) { @@ -320,8 +321,6 @@ void font_load(INT32 args) if (THIS->mem) { - int i; - struct file_head { unsigned INT32 cookie; @@ -560,7 +559,7 @@ void font_height(INT32 args) void font_text_extents(INT32 args) { - INT32 xsize,i,c,maxwidth2,j; + INT32 xsize,i,maxwidth2,j; if (!THIS) error("font->text_extents: no font loaded\n"); diff --git a/src/modules/Image/image.h b/src/modules/Image/image.h index 5d711eb4dec269b475b031da863d76bb984aa3d5..ab81dcf8b50b38daba4874d5cbddf82c5e246a83 100644 --- a/src/modules/Image/image.h +++ b/src/modules/Image/image.h @@ -1,14 +1,16 @@ -/* $Id: image.h,v 1.12 1997/11/09 15:39:40 grubba Exp $ */ - -#ifndef PIKE_IMAGE_IMAGE_H -#define PIKE_IMAGE_IMAGE_H - /* **! module Image **! note -**! $Id: image.h,v 1.12 1997/11/09 15:39:40 grubba Exp $ +**! $Id: image.h,v 1.13 1997/11/11 22:17:50 mirar Exp $ */ +#ifdef PIKE_IMAGE_IMAGE_H +#error IMAGE.h included twice +#endif + +#define PIKE_IMAGE_IMAGE_H + + #define MAX_NUMCOL 32768 #define QUANT_SELECT_CACHE 6 @@ -137,4 +139,4 @@ void image_tobitmap(INT32 args); void image_polygone(INT32 args); -#endif /* PIKE_IMAGE_IMAGE_H */ + diff --git a/src/modules/Image/mkwmml.pike b/src/modules/Image/mkwmml.pike index 00ee38a7fdd50500896099e1ff6f59a5bb483cab..f4e8b5da1bd11a285820ba6602f7e5431e66169c 100644 --- a/src/modules/Image/mkwmml.pike +++ b/src/modules/Image/mkwmml.pike @@ -1,4 +1,4 @@ -/* $Id: mkwmml.pike,v 1.4 1997/11/10 14:19:56 mirar Exp $ */ +/* $Id: mkwmml.pike,v 1.5 1997/11/11 22:17:50 mirar Exp $ */ import Stdio; import Array; @@ -208,7 +208,7 @@ string fixdesc(string s,string prefix,string where) { s=stripws(s); - string t,u,v; + string t,u,v,q; t=s; s=""; while (sscanf(t,"%s<ref>%s</ref>%s",t,u,v)==3) @@ -219,11 +219,11 @@ string fixdesc(string s,string prefix,string where) s+=t; t=s; s=""; - while (sscanf(t,"%s<illustration>%s</illustration>%s",t,u,v)==3) + while (sscanf(t,"%s<illustration%s>%s</illustration>%s",t,q,u,v)==4) { s+=htmlify(replace(t,"\n\n","\n\n<p>")); - s+="<illustration __from__='"+where+"' src=lena.gif>\n" + s+="<illustration __from__='"+where+"' src=lena.gif"+q+">\n" +replace(u,"lena()","src")+"</illustration>"; t=v; diff --git a/src/modules/Image/togif.c b/src/modules/Image/togif.c index cdbd486bef2e0c7c59b158f146dc3cdd69fb8cbb..8b2fee0ca5ffbbcde2a5ef98f6b84e342a526a3d 100644 --- a/src/modules/Image/togif.c +++ b/src/modules/Image/togif.c @@ -2,7 +2,7 @@ togif -$Id: togif.c,v 1.26 1997/11/11 03:46:08 grubba Exp $ +$Id: togif.c,v 1.27 1997/11/11 22:17:52 mirar Exp $ old GIF API compat stuff @@ -11,7 +11,7 @@ old GIF API compat stuff /* **! module Image **! note -**! $Id: togif.c,v 1.26 1997/11/11 03:46:08 grubba Exp $ +**! $Id: togif.c,v 1.27 1997/11/11 22:17:52 mirar Exp $ **! class image */ @@ -35,7 +35,6 @@ old GIF API compat stuff #include "image.h" #include "colortable.h" -#include "encodings/gif.h" #define THIS ((struct image *)(fp->current_storage)) #define THISOBJ (fp->current_object) @@ -91,6 +90,7 @@ extern struct program *image_colortable_program; extern void image_gif_header_block(INT32 args); extern void image_gif_end_block(INT32 args); extern void image_gif_netscape_loop_block(INT32 args); +extern void image_gif_render_block(INT32 args); void image_gif_begin(INT32 args) {