[q-lang-cvs] q/modules/magick magick.c,1.19,1.20 magick.q,1.17,1.18
Brought to you by:
agraef
From: <ag...@us...> - 2003-12-29 04:20:51
|
Update of /cvsroot/q-lang/q/modules/magick In directory sc8-pr-cvs1:/tmp/cvs-serv5358 Modified Files: magick.c magick.q Log Message: added decoration ops Index: magick.c =================================================================== RCS file: /cvsroot/q-lang/q/modules/magick/magick.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** magick.c 29 Dec 2003 03:35:53 -0000 1.19 --- magick.c 29 Dec 2003 04:20:47 -0000 1.20 *************** *** 1905,1906 **** --- 1905,1975 ---- return __FAIL; } + + FUNCTION(magick,border,argc,argv) + { + Image *img; + int n; + expr *xv; + unsigned long w, h; + if (argc == 2 && isobj(argv[0], type(Image), (void**)&img) && + istuple(argv[1], &n, &xv) && n == 2 && + isuint(xv[0], &w) && isuint(xv[1], &h)) { + RectangleInfo rect; + rect.x = rect.y = 0; rect.width = w; rect.height = h; + img = BorderImage(img, &rect, &exception); + if (check_exception(&exception)) + return mkapp(mksym(sym(magick_error)), mkstr(strdup(msg))); + else if (!img) + return __FAIL; + else + return mkobj(type(Image), img); + } else + return __FAIL; + } + + FUNCTION(magick,frame,argc,argv) + { + Image *img; + int n; + expr *xv; + unsigned long w, h; + long inner, outer; + if (argc == 3 && isobj(argv[0], type(Image), (void**)&img) && + istuple(argv[1], &n, &xv) && n == 2 && + isuint(xv[0], &w) && isuint(xv[1], &h) && + istuple(argv[2], &n, &xv) && n == 2 && + isint(xv[0], &inner) && isint(xv[1], &outer)) { + FrameInfo frame; + frame.x = frame.y = 0; frame.width = w; frame.height = h; + frame.inner_bevel = inner; frame.outer_bevel = outer; + img = FrameImage(img, &frame, &exception); + if (check_exception(&exception)) + return mkapp(mksym(sym(magick_error)), mkstr(strdup(msg))); + else if (!img) + return __FAIL; + else + return mkobj(type(Image), img); + } else + return __FAIL; + } + + FUNCTION(magick,button,argc,argv) + { + Image *img; + int n; + expr *xv; + unsigned long w, h; + int raise; + if (argc == 3 && isobj(argv[0], type(Image), (void**)&img) && + istuple(argv[1], &n, &xv) && n == 2 && + isuint(xv[0], &w) && isuint(xv[1], &h) && + isbool(argv[2], &raise)) { + RectangleInfo rect; + rect.x = rect.y = 0; rect.width = w; rect.height = h; + if (RaiseImage(img, &rect, raise)) + return mkvoid; + else + return __FAIL; + } else + return __FAIL; + } Index: magick.q =================================================================== RCS file: /cvsroot/q-lang/q/modules/magick/magick.q,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** magick.q 29 Dec 2003 03:35:53 -0000 1.17 --- magick.q 29 Dec 2003 04:20:47 -0000 1.18 *************** *** 238,242 **** // TODO: We need some operations here to retrieve and change various other ! // image parameters, such as default background color and page geometry. /* Retrieve various other useful information about an image. The count_image_ --- 238,242 ---- // TODO: We need some operations here to retrieve and change various other ! // image parameters, such as background/border/matte color and page geometry. /* Retrieve various other useful information about an image. The count_image_ *************** *** 358,365 **** /* Decorations. */ ! // TODO ! // public extern border IMG DIM PIXEL; ! // public extern frame IMG DIM INNER OUTER PIXEL; ! // public extern button IMG DIM; // BANG! /* Annotations. */ --- 358,364 ---- /* Decorations. */ ! public extern border IMG DIM; ! public extern frame IMG DIM BEVEL; ! public extern button IMG DIM RAISE; // BANG! /* Annotations. */ |