1 USING: accessors alien.c-types alien.data assocs destructors fry
2 kernel math sequences specialized-arrays ui.backend ;
20 TUPLE: pixel-format-attribute { value integer } ;
22 TUPLE: color-bits < pixel-format-attribute ;
23 TUPLE: red-bits < pixel-format-attribute ;
24 TUPLE: green-bits < pixel-format-attribute ;
25 TUPLE: blue-bits < pixel-format-attribute ;
26 TUPLE: alpha-bits < pixel-format-attribute ;
28 TUPLE: accum-bits < pixel-format-attribute ;
29 TUPLE: accum-red-bits < pixel-format-attribute ;
30 TUPLE: accum-green-bits < pixel-format-attribute ;
31 TUPLE: accum-blue-bits < pixel-format-attribute ;
32 TUPLE: accum-alpha-bits < pixel-format-attribute ;
34 TUPLE: depth-bits < pixel-format-attribute ;
36 TUPLE: stencil-bits < pixel-format-attribute ;
38 TUPLE: aux-buffers < pixel-format-attribute ;
40 TUPLE: sample-buffers < pixel-format-attribute ;
41 TUPLE: samples < pixel-format-attribute ;
43 HOOK: (make-pixel-format) ui-backend ( world attributes --
45 HOOK: (free-pixel-format) ui-backend ( pixel-format -- )
47 ERROR: invalid-pixel-format-attributes world attributes ;
49 TUPLE: pixel-format < disposable world handle ;
51 : <pixel-format> ( world attributes -- pixel-format )
52 2dup (make-pixel-format)
53 [ pixel-format new-disposable swap >>handle swap >>world ]
54 [ invalid-pixel-format-attributes ]
57 M: pixel-format dispose*
58 [ (free-pixel-format) ] [ f >>handle drop ] bi ;
60 : pixel-format-attributes>int-array ( attrs perm table -- arr )
61 swapd '[ _ at ] map sift concat append
62 ! 0 happens to work as a sentinel value for all ui backends.
63 0 suffix int >c-array ;
65 GENERIC: world-pixel-format-attributes ( world -- attributes )
67 GENERIC# check-world-pixel-format 1 ( world pixel-format -- )