diff --git a/src/modules/Image/blit.c b/src/modules/Image/blit.c index 35e0616352062759292294a0984e53e75ba65a77..f0033d76c7c1622ad52ec02dd4e7a6a4841a3ae3 100644 --- a/src/modules/Image/blit.c +++ b/src/modules/Image/blit.c @@ -1,6 +1,11 @@ -/* $Id: blit.c,v 1.6 1997/04/03 07:00:08 mirar Exp $ */ +/* $Id: blit.c,v 1.7 1997/04/09 01:49:42 mirar Exp $ */ #include "global.h" +/* +**! module Image +**! class image +*/ + #include <math.h> #include <ctype.h> diff --git a/src/modules/Image/font.c b/src/modules/Image/font.c index c6ef93948bc7747b728122d6f01186cee6f9b3ad..3fe67f387cf5707ad8bd9b516fe4861295be42d1 100644 --- a/src/modules/Image/font.c +++ b/src/modules/Image/font.c @@ -3,9 +3,27 @@ /* **! module Image **! class font +**! +**! Short technical documentation on a font file: +**! struct file_head +**! { +**! unsigned INT32 cookie; - 0x464f4e54 +**! unsigned INT32 version; - 1 +**! unsigned INT32 chars; - number of chars +**! unsigned INT32 height; - height of font +**! unsigned INT32 baseline; - font baseline +**! unsigned INT32 o[1]; - position of char_head's +**! } *fh; +**! struct char_head +**! { +**! unsigned INT32 width; - width of this character +**! unsigned INT32 spacing; - spacing to next character +**! unsigned char data[1]; - pixmap data (1byte/pixel) +**! } *ch; +**! */ -/* $Id: font.c,v 1.5 1997/04/03 07:00:17 mirar Exp $ */ +/* $Id: font.c,v 1.6 1997/04/09 01:49:47 mirar Exp $ */ #include "global.h" @@ -166,6 +184,15 @@ static inline write_char(struct _char *ci, /***************** methods *************************************/ +/* +**! method object|int load(string filename) +**! Loads a font file to this font object. +**! returns zero upon failure, font object upon success +**! arg string filename +**! Font file +**! see also: write +*/ + void font_load(INT32 args) { @@ -333,6 +360,16 @@ void font_load(INT32 args) return; } +/* +**! method object write(string text,...) +**! Writes some text; thus creating an image object +**! that can be used as mask or as a complete picture. +**! returns an <ref>Image::image</ref> object +**! arg string text, ... +**! One or more lines of text. +**! see also: text_extents, load, image::paste_mask, image::paste_alpha_color +*/ + void font_write(INT32 args) { struct object *o; @@ -414,6 +451,12 @@ void font_write(INT32 args) push_object(o); } +/* +**! method int height() +**! returns font height +**! see also: baseline, text_extents +*/ + void font_height(INT32 args) { pop_n_elems(args); @@ -423,6 +466,17 @@ void font_height(INT32 args) push_int(0); } +/* +**! method text_extents(string text,...) +**! Calculate extents of a text-image, +**! that would be created by calling <ref>write</ref> +**! with the same arguments. +**! returns an array of width and height +**! arg string text, ... +**! One or more lines of text. +**! see also: write, height, baseline +*/ + void font_text_extents(INT32 args) { INT32 xsize,i,maxwidth,c,maxwidth2,j; @@ -454,11 +508,24 @@ void font_text_extents(INT32 args) if (xsize>maxwidth) maxwidth=xsize; if (maxwidth>maxwidth2) maxwidth2=maxwidth; } + pop_n_elems(args); push_int(maxwidth2); push_int(args * THIS->height * THIS->yspacing_scale); + f_aggregate(2); } + +/* +**! method void set_xspacing_scale(float scale) +**! method void set_yspacing_scale(float scale) +**! Set spacing scale to write characters closer +**! or more far away. This does not change scale +**! of character, only the space between them. +**! arg float scale +**! what scale to use +*/ + void font_set_xspacing_scale(INT32 args) { if(!THIS) error("font->set_xspacing_scale(FLOAT): No font loaded.\n"); @@ -488,6 +555,12 @@ void font_set_yspacing_scale(INT32 args) pop_stack(); } + +/* +**! method int baseline() +**! returns font baseline (pixels from top) +**! see also: height, text_extents +*/ void font_baseline(INT32 args) { pop_n_elems(args); diff --git a/src/modules/Image/image.c b/src/modules/Image/image.c index b73dc25b8f71aa6d3707aa8f0b3bc7ae440f8002..2dd72cff8bb888ac3c5c65061c469c715a8f2873 100644 --- a/src/modules/Image/image.c +++ b/src/modules/Image/image.c @@ -1,4 +1,4 @@ -/* $Id: image.c,v 1.21 1997/04/07 20:36:56 mirar Exp $ */ +/* $Id: image.c,v 1.22 1997/04/09 01:49:51 mirar Exp $ */ /* **! module Image @@ -12,7 +12,7 @@ #include "stralloc.h" #include "global.h" -RCSID("$Id: image.c,v 1.21 1997/04/07 20:36:56 mirar Exp $"); +RCSID("$Id: image.c,v 1.22 1997/04/09 01:49:51 mirar Exp $"); #include "types.h" #include "pike_macros.h" #include "object.h" @@ -697,9 +697,7 @@ static INLINE int try_autocrop_horisontal(INT32 y,INT32 x,INT32 x2, **! which borders to scan and cut the image; **! a typical example is removing the top and bottom unneccesary **! pixels: -**! example -**! img=img->autocrop(0, 0,0,1,1); -**! end example +**! <pre>img=img->autocrop(0, 0,0,1,1);</pre> **! see also: copy */ diff --git a/src/modules/Image/image_autodoc_foo b/src/modules/Image/image_autodoc_foo index 7d59485733c402ccc5ac389b3a60e6cf56bc6d13..d67dcbce7a7fadbdcdb1894f6eedc693c8e87afa 100644 --- a/src/modules/Image/image_autodoc_foo +++ b/src/modules/Image/image_autodoc_foo @@ -13,10 +13,6 @@ pike-object-documentation: **! arg <type> <name> - multiple for a method **! <description>� / **! -**! example -**! <example> -**! end example -**! **! note **! <note> **! diff --git a/src/modules/Image/mkdoc.pike b/src/modules/Image/mkdoc.pike new file mode 100644 index 0000000000000000000000000000000000000000..0ba9f58db754a348e11b199d8b1dd6d2ce09abdc --- /dev/null +++ b/src/modules/Image/mkdoc.pike @@ -0,0 +1,32 @@ +#include <stdio.h> + +mapping parse=([]); + +/* + +module : mapping <- moduleM + "desc" : text + "classes" : mapping <- classM + class : mapping + "desc" : text + "methods" : array of mappings <- methodM + "methods" : list of method names + "decl" : array of textlines of declarations + "desc" : text + "returns" : textline + "see also" : array of references + "note" : text + "args" : mapping + arg : mapping <- argM + "type" : textline + "desc" : text + +*/ + +mapping moduleM, classM, methodM, argM; + +int main() +{ + string doc=stdin->read(10000000); + +}