[q-lang-cvs] q/modules/magick/examples mozilla_48x48.rgba,NONE,1.1 Makefile.am,1.1,1.2 magicktest.q,
Brought to you by:
agraef
From: <ag...@us...> - 2003-12-24 03:05:39
|
Update of /cvsroot/q-lang/q/modules/magick/examples In directory sc8-pr-cvs1:/tmp/cvs-serv15621/examples Modified Files: Makefile.am magicktest.q Added Files: mozilla_48x48.rgba Log Message: working on the magick module --- NEW FILE: mozilla_48x48.rgba --- (This appears to be a binary file; contents omitted.) Index: Makefile.am =================================================================== RCS file: /cvsroot/q-lang/q/modules/magick/examples/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile.am 16 Dec 2003 19:11:16 -0000 1.1 --- Makefile.am 24 Dec 2003 03:05:36 -0000 1.2 *************** *** 4,9 **** if GGI ! examples_DATA = *.q *.png endif ! EXTRA_DIST = *.q *.png --- 4,9 ---- if GGI ! examples_DATA = *.q *.png *.rgba endif ! EXTRA_DIST = *.q *.png *.rgba Index: magicktest.q =================================================================== RCS file: /cvsroot/q-lang/q/modules/magick/examples/magicktest.q,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** magicktest.q 23 Dec 2003 13:14:43 -0000 1.3 --- magicktest.q 24 Dec 2003 03:05:36 -0000 1.4 *************** *** 6,22 **** import ggi, magick; ! /* show NAME INFO: show an image in a GGI visual. Returns the created visual. ! For most purposes, NAME is just the name of an image file, and INFO is ! (). However, using appropriate NAME and INFO values, you can actually do a ! lot more than just displaying an image file, see magick.q and ! ImageMagick(1) for details. */ ! show NAME INFO = display IMG where IMG:Image = read_image NAME INFO; ! /* display IMG: display the given image in a GGI visual. Returns the created ! visual. */ /* The simple case: our image is opaque. In this case we just render it on a ! screen visual. */ display IMG --- 6,64 ---- import ggi, magick; ! /* display IMG: Display the given image in a GGI visual. Returns the created ! visual. Some examples: ! Display an image read from a file, use defaults: ! ==> display (read_image "mozilla.png" ()) ! ! Display raw RGBA file -- must specify the dimensions and depth here: ! ! ==> display (read_image "mozilla_48x48.rgba" (48,48,8)) ! ! Display a white image obtained from create_image: ! ! ==> display (create_image (100,100,8) (magick_pixel "white")) ! ! Same using read_image with the "xc:" source specifier: ! ! ==> display (read_image "xc:white" (100,100,8)) ! ! Now for something a little more interesting. Show some of the builtin ! ImageMagick images: ! ! ==> display (read_image "logo:" ()) ! ! ==> display (read_image "netscape:" ()) ! ! ==> display (read_image "plasma:" (320,240)) ! ! Display a screenshot of an X11 window: ! ! ==> display (read_image "x:" ()) ! ! (When the cross cursor appears, click on the window to capture. You can ! also use a specification like "x:0x1e00002" to denote the target window by ! its id. See ImageMagick(1) for more details.) ! ! As a final example, let's render some inline PostScript code: ! ! ==> def PS = "%!PS-Adobe-3.0 EPSF-3.0\n\ ! %%BoundingBox: 0 0 100 100\n\ ! 50 50 50 0 360 arc stroke showpage\n" ! ! ==> display (blob_to_image (bytestr PS) ()) ! ! Cute, isn't it? By these means, you can employ the full power of PostScript ! to draw complicated stuff in a GGI visual, which would be hard to do using ! only GGI's very basic drawing operations. Of course, we could also employ ! the graphics.q script in the standard library to create the PostScript ! source in a convenient manner. This is left as an exercise to the ! interested reader. :) */ ! ! /* Implementation. */ /* The simple case: our image is opaque. In this case we just render it on a ! screen visual: */ display IMG *************** *** 32,36 **** /* The complicated case: our image has transparency. In this case we clad the ! visual with an alpha buffer and draw the image over a background. */ def BACK = magick_pixel "gray"; --- 74,79 ---- /* The complicated case: our image has transparency. In this case we clad the ! visual with an alpha buffer and draw the image over a background. Actually, ! it's not *that* complicated, either: */ def BACK = magick_pixel "gray"; *************** *** 48,52 **** otherwise; ! /* Driver for display visual. */ target = "directx" if pos "mingw" sysinfo >= 0; --- 91,95 ---- otherwise; ! /* Display driver. Assume DirectX on Windows, X11 everywhere else. */ target = "directx" if pos "mingw" sysinfo >= 0; |