From ab0c3fdcab38d136c2faee4990c56c4da6d5e9bd Mon Sep 17 00:00:00 2001 From: "Mirar (Pontus Hagland)" <pike@sort.mirar.org> Date: Fri, 19 Jun 1998 17:12:45 +0200 Subject: [PATCH] added: decode_header Rev: src/modules/_Image_XFace/image_xface.c:1.5 --- src/modules/_Image_XFace/image_xface.c | 46 +++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/modules/_Image_XFace/image_xface.c b/src/modules/_Image_XFace/image_xface.c index 55c4a8d3c1..afff902a5a 100644 --- a/src/modules/_Image_XFace/image_xface.c +++ b/src/modules/_Image_XFace/image_xface.c @@ -1,5 +1,5 @@ #include "global.h" -RCSID("$Id: image_xface.c,v 1.4 1998/04/09 00:44:08 marcus Exp $"); +RCSID("$Id: image_xface.c,v 1.5 1998/06/19 15:12:45 mirar Exp $"); #include "config.h" @@ -432,6 +432,48 @@ static void image_xface_encode(INT32 args) } } +/* +**! method object decode_header(string data) +**! method object decode_header(string data, mapping options) +**! Decodes an X-Face image header. +**! +**! <pre> +**! "xsize":int +**! "ysize":int +**! size of image +**! "type":"image/x-xface" +**! file type information +**! </pre> +**! +**! The <tt>options</tt> argument may be a mapping +**! containing zero options. +**! +**! note +**! There aint no such thing as a X-Face image header. +**! This stuff tells the characteristics of an X-Face image. +**! +*/ + +static void image_xface_decode_header(INT32 args) +{ + if(args<1 || sp[-args].type!=T_STRING) + error("Image.XFace.decode: Illegal arguments\n"); + + pop_n_elems(args); + + push_text("type"); + push_text("image/x-xface"); + + push_text("xsize"); + push_int(48); + + push_text("ysize"); + push_int(48); + + f_aggregate_mapping(6); +} + + #endif /* HAVE_GMP_H */ /*** module init & exit & stuff *****************************************/ @@ -460,6 +502,8 @@ void pike_module_init(void) { add_function("decode",image_xface_decode, "function(string,void|mapping(string:int):object)",0); + add_function("decode_header",image_xface_decode_header, + "function(string,void|mapping(string:int):object)",0); add_function("encode",image_xface_encode, "function(object,void|mapping(string:int):string)",0); } -- GitLab