From: Matthew Willis Date: Sat, 10 May 2008 21:31:02 +0000 (-0700) Subject: removed old cairo.png vocab. The png words are now in cairo.gadgets X-Git-Tag: 0.94~3265 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=8442e82cda9bdc9512a95f56e0532eb1433be738 removed old cairo.png vocab. The png words are now in cairo.gadgets --- diff --git a/extra/cairo/png/png.factor b/extra/cairo/png/png.factor deleted file mode 100755 index a3b13c9691..0000000000 --- a/extra/cairo/png/png.factor +++ /dev/null @@ -1,65 +0,0 @@ -! Copyright (C) 2008 Doug Coleman. -! See http://factorcode.org/license.txt for BSD license. -USING: arrays kernel accessors math ui.gadgets ui.render -opengl.gl byte-arrays namespaces opengl cairo.ffi cairo.lib -inspector sequences combinators io.backend ; -IN: cairo.png - -TUPLE: png surface width height cairo-t array ; -TUPLE: png-gadget png ; - -ERROR: cairo-error string ; - -: check-zero ( n -- n ) - dup zero? [ - "PNG dimension is 0" cairo-error - ] when ; - -: cairo-png-error ( n -- ) - { - { CAIRO_STATUS_NO_MEMORY [ "Cairo: no memory" cairo-error ] } - { CAIRO_STATUS_FILE_NOT_FOUND [ "Cairo: file not found" cairo-error ] } - { CAIRO_STATUS_READ_ERROR [ "Cairo: read error" cairo-error ] } - [ drop ] - } case ; - -: ( path -- png ) - normalize-path - cairo_image_surface_create_from_png - dup cairo_surface_status cairo-png-error - dup [ cairo_image_surface_get_width check-zero ] - [ cairo_image_surface_get_height check-zero ] [ ] tri - cairo-surface>array png boa ; - -: write-png ( png path -- ) - >r png-surface r> - cairo_surface_write_to_png - zero? [ "write png failed" throw ] unless ; - -: ( path -- gadget ) - png-gadget construct-gadget swap - >>png ; - -M: png-gadget pref-dim* ( gadget -- ) - png>> - [ width>> ] [ height>> ] bi 2array ; - -M: png-gadget draw-gadget* ( gadget -- ) - origin get [ - 0 0 glRasterPos2i - 1.0 -1.0 glPixelZoom - png>> - [ width>> ] - [ height>> GL_RGBA GL_UNSIGNED_BYTE ] - ! [ height>> GL_BGRA GL_UNSIGNED_BYTE ] - [ array>> ] tri - glDrawPixels - ] with-translation ; - -M: png-gadget graft* ( gadget -- ) - drop ; - -M: png-gadget ungraft* ( gadget -- ) - png>> surface>> cairo_destroy ; - -! "resource:misc/icons/Factor_1x16.png" USE: cairo.png gadget.