1 ! Copyright (C) 2009 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: combinators kernel accessors ;
6 SINGLETONS: L LA BGR RGB BGRA RGBA ABGR ARGB RGBX XRGB BGRX XBGR
7 R16G16B16 R32G32B32 R16G16B16A16 R32G32B32A32 ;
9 UNION: alpha-channel BGRA RGBA ABGR ARGB R16G16B16A16 R32G32B32A32 ;
11 : bytes-per-pixel ( component-order -- n )
27 { R16G16B16A16 [ 8 ] }
28 { R32G32B32A32 [ 16 ] }
31 TUPLE: image dim component-order upside-down? bitmap ;
33 : <image> ( -- image ) image new ; inline
35 : has-alpha? ( image -- ? ) component-order>> alpha-channel? ;
37 GENERIC: load-image* ( path tuple -- image )