| 
									
										
										
										
											2009-05-01 17:33:49 -04:00
										 |  |  | USING: accessors assocs classes destructors functors kernel | 
					
						
							|  |  |  | lexer math parser sequences specialized-arrays.int ui.backend | 
					
						
							| 
									
										
										
										
											2009-05-10 22:33:13 -04:00
										 |  |  | words ;
 | 
					
						
							| 
									
										
										
										
											2009-04-30 21:31:33 -04:00
										 |  |  | IN: ui.pixel-formats | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-01 10:09:38 -04:00
										 |  |  | SYMBOLS:
 | 
					
						
							| 
									
										
										
										
											2009-04-30 21:31:33 -04:00
										 |  |  |     double-buffered | 
					
						
							|  |  |  |     stereo | 
					
						
							|  |  |  |     offscreen | 
					
						
							|  |  |  |     fullscreen | 
					
						
							|  |  |  |     windowed | 
					
						
							|  |  |  |     accelerated | 
					
						
							|  |  |  |     software-rendered | 
					
						
							|  |  |  |     backing-store | 
					
						
							|  |  |  |     multisampled | 
					
						
							|  |  |  |     supersampled  | 
					
						
							|  |  |  |     sample-alpha | 
					
						
							|  |  |  |     color-float ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TUPLE: pixel-format-attribute { value integer } ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TUPLE: color-bits < pixel-format-attribute ;
 | 
					
						
							|  |  |  | TUPLE: red-bits < pixel-format-attribute ;
 | 
					
						
							|  |  |  | TUPLE: green-bits < pixel-format-attribute ;
 | 
					
						
							|  |  |  | TUPLE: blue-bits < pixel-format-attribute ;
 | 
					
						
							|  |  |  | TUPLE: alpha-bits < pixel-format-attribute ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TUPLE: accum-bits < pixel-format-attribute ;
 | 
					
						
							|  |  |  | TUPLE: accum-red-bits < pixel-format-attribute ;
 | 
					
						
							|  |  |  | TUPLE: accum-green-bits < pixel-format-attribute ;
 | 
					
						
							|  |  |  | TUPLE: accum-blue-bits < pixel-format-attribute ;
 | 
					
						
							|  |  |  | TUPLE: accum-alpha-bits < pixel-format-attribute ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TUPLE: depth-bits < pixel-format-attribute ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TUPLE: stencil-bits < pixel-format-attribute ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TUPLE: aux-buffers < pixel-format-attribute ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TUPLE: sample-buffers < pixel-format-attribute ;
 | 
					
						
							|  |  |  | TUPLE: samples < pixel-format-attribute ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-02 13:31:33 -04:00
										 |  |  | HOOK: (make-pixel-format) ui-backend ( world attributes -- pixel-format-handle )
 | 
					
						
							|  |  |  | HOOK: (free-pixel-format) ui-backend ( pixel-format -- )
 | 
					
						
							|  |  |  | HOOK: (pixel-format-attribute) ui-backend ( pixel-format attribute-name -- value )
 | 
					
						
							| 
									
										
										
										
											2009-04-30 21:31:33 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-02 13:31:33 -04:00
										 |  |  | ERROR: invalid-pixel-format-attributes world attributes ;
 | 
					
						
							| 
									
										
										
										
											2009-05-01 13:56:52 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-24 21:33:27 -04:00
										 |  |  | TUPLE: pixel-format < disposable world handle ;
 | 
					
						
							| 
									
										
										
										
											2009-04-30 21:31:33 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-02 13:31:33 -04:00
										 |  |  | : <pixel-format> ( world attributes -- pixel-format )
 | 
					
						
							|  |  |  |     2dup (make-pixel-format) | 
					
						
							| 
									
										
										
										
											2009-08-24 21:45:19 -04:00
										 |  |  |     [ pixel-format new-disposable swap >>handle swap >>world ] | 
					
						
							| 
									
										
										
										
											2009-08-24 21:33:27 -04:00
										 |  |  |     [ invalid-pixel-format-attributes ] | 
					
						
							|  |  |  |     ?if ;
 | 
					
						
							| 
									
										
										
										
											2009-04-30 21:31:33 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-24 21:33:27 -04:00
										 |  |  | M: pixel-format dispose* | 
					
						
							| 
									
										
										
										
											2009-05-02 13:31:33 -04:00
										 |  |  |     [ (free-pixel-format) ] [ f >>handle drop ] bi ;
 | 
					
						
							| 
									
										
										
										
											2009-04-30 21:31:33 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | : pixel-format-attribute ( pixel-format attribute-name -- value )
 | 
					
						
							| 
									
										
										
										
											2009-05-02 13:31:33 -04:00
										 |  |  |     (pixel-format-attribute) ;
 | 
					
						
							| 
									
										
										
										
											2009-04-30 21:31:33 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-01 17:33:49 -04:00
										 |  |  | <PRIVATE
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-01 21:07:14 -04:00
										 |  |  | FUNCTOR: define-pixel-format-attribute-table ( NAME PERM TABLE -- )
 | 
					
						
							| 
									
										
										
										
											2009-05-01 17:33:49 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | >PFA              DEFINES >${NAME} | 
					
						
							|  |  |  | >PFA-int-array    DEFINES >${NAME}-int-array | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | WHERE | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GENERIC: >PFA ( attribute -- pfas )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | M: object >PFA | 
					
						
							|  |  |  |     drop { } ;
 | 
					
						
							| 
									
										
										
										
											2009-05-10 22:33:13 -04:00
										 |  |  | M: word >PFA | 
					
						
							| 
									
										
										
										
											2009-05-01 17:33:49 -04:00
										 |  |  |     TABLE at [ { } ] unless* ;
 | 
					
						
							|  |  |  | M: pixel-format-attribute >PFA | 
					
						
							|  |  |  |     dup class TABLE at
 | 
					
						
							|  |  |  |     [ swap value>> suffix ] | 
					
						
							|  |  |  |     [ drop { } ] if* ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : >PFA-int-array ( attribute -- int-array )
 | 
					
						
							| 
									
										
										
										
											2009-05-01 21:07:14 -04:00
										 |  |  |     [ >PFA ] map concat PERM prepend 0 suffix >int-array ;
 | 
					
						
							| 
									
										
										
										
											2009-05-01 17:33:49 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | ;FUNCTOR | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | SYNTAX: PIXEL-FORMAT-ATTRIBUTE-TABLE: | 
					
						
							| 
									
										
										
										
											2009-05-01 21:07:14 -04:00
										 |  |  |     scan scan-object scan-object define-pixel-format-attribute-table ;
 | 
					
						
							| 
									
										
										
										
											2009-05-01 17:33:49 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | PRIVATE>
 | 
					
						
							| 
									
										
										
										
											2009-05-02 22:54:25 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | GENERIC: world-pixel-format-attributes ( world -- attributes )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GENERIC# check-world-pixel-format 1 ( world pixel-format -- )
 | 
					
						
							|  |  |  | 
 |