[q-lang-cvs] q/modules/magick magick.c,1.5,1.6 magick.q,1.6,1.7
Brought to you by:
agraef
From: <ag...@us...> - 2003-12-26 11:11:13
|
Update of /cvsroot/q-lang/q/modules/magick In directory sc8-pr-cvs1:/tmp/cvs-serv31836 Modified Files: magick.c magick.q Log Message: new magick_info function Index: magick.c =================================================================== RCS file: /cvsroot/q-lang/q/modules/magick/magick.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** magick.c 26 Dec 2003 03:10:48 -0000 1.5 --- magick.c 26 Dec 2003 11:11:09 -0000 1.6 *************** *** 168,171 **** --- 168,201 ---- #endif + FUNCTION(magick,magick_info,argc,argv) + { + const MagickInfo *info; + expr x; + if (argc != 0) return __FAIL; + info = GetMagickInfo("*", &exception); + if (check_exception(&exception)) + return mkapp(mksym(sym(magick_error)), mkstr(strdup(msg))); + else if (!info) + return __FAIL; + while (info->next) info = info->next; + /* we're at the last info record now */ + x = mknil; + while (x && info) { + char mode[10]; + sprintf(mode, "%c%c%c%c", + info->blob_support?'*':'-', + info->decoder?'r':'-', + info->encoder?'w':'-', + info->adjoin?'+':'-'); + x = mkcons(mktuplel(4, mkstr(strdup(info->name?info->name:"")), + mkstr(strdup(mode)), + mkstr(strdup(info->description?info->description:"")), + mkstr(strdup(info->version?info->version:""))), + x); + info = info->previous; + } + return x; + } + /* image type */ Index: magick.q =================================================================== RCS file: /cvsroot/q-lang/q/modules/magick/magick.q,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** magick.q 26 Dec 2003 03:21:38 -0000 1.6 --- magick.q 26 Dec 2003 11:11:09 -0000 1.7 *************** *** 46,49 **** --- 46,74 ---- public magick_error MSG; + /* ImageMagick file formats. The following operation retrieves general + information about the supported image file formats. It returns a list of + string tuples of the form (NAME, MODE, DESCRIPTION, VERSION) with the + following fields: + + - NAME: The name of the format under which it is known to ImageMagick, + which is also used as a format prefix in filenames and the value of the + MAGICK field in the image_info structure (see below). + + - MODE: A four-character string of the form "*rw+" specifying whether the + format supports native blobs, reading, writing, and multi-image files, + respectively. Unsupported capabilities will be represented by a '-' + character in the corresponding position. + + - DESCRIPTION: A more verbose description of the file format. + + - VERSION: Any additional version information about the format. + + E.g., to quickly list all supported formats, try something like + `do (printf "%9s %4s %s %s\n") magick_info'. We remark that some of the + listed formats (such as MPEG) require third-party software to make them + work, see ImageMagick(1) for details. */ + + public extern magick_info; + /* ENCODING OF COLOR VALUES. Regardless of the internal representation of an image, pixel data is always encoded as a byte string of 16 bit RGBA |