Paste: useful image words?
Author: | ceninan |
Mode: | factor |
Date: | Thu, 24 Jun 2010 19:33:08 |
Plain Text |
USING: byte-arrays combinator images kernel locals
sequences ;
IN: images
:: crop
loc first2 :>
dim first2 :>
y h y + [a,b) [ x swap w image pixel-row-slice-at ] map
[ >byte-array ] map concat
image clone
swap >>bitmap
dim >>dim ;
USING: cairo cairo.ffi combinators destructors images
images.normalization kernel ;
IN: cairo
: write-png
[
[
clone BGRA reorder-components
[ bitmap>> ] [ dim>> ] bi
<image-surface> &cairo_surface_destroy
] dip
cairo_surface_write_to_png
dup CAIRO_STATUS_SUCCESS = not [ throw ] [ drop ] if
] with-destructors ;
Author: | ceninan |
Mode: | factor |
Date: | Thu, 24 Jun 2010 19:42:36 |
Plain Text |
USING: byte-arrays combinator images kernel locals
sequences ;
IN: images
:: crop
loc first2 :>
dim first2 :>
y h y + [a,b) [ x swap w image pixel-row-slice-at ] map
[ >byte-array ] map concat
image clone
swap >>bitmap
dim >>dim ;
USING: cairo cairo.ffi combinators destructors images
images.normalization kernel ;
IN: cairo
: write-png
[
[
clone BGRA reorder-components
[ bitmap>> ] [ dim>> ] bi
<image-surface> &cairo_surface_destroy
] dip
cairo_surface_write_to_png (check-cairo)
] with-destructors ;
New Annotation