u s i n g   U n i t y E n g i n e ; 
 u s i n g   S y s t e m . C o l l e c t i o n s ; 
 u s i n g   N y A R U n i t y U t i l s ; 
 u s i n g   j p . n y a t l a . n y a r t o o l k i t . c s . m a r k e r s y s t e m ; 
 u s i n g   j p . n y a t l a . n y a r t o o l k i t . c s . c o r e ; 
 
 n a m e s p a c e   N y A R U n i t y U t i l s 
 { 
 	 / / /   < s u m m a r y > 
 	 / / /   T h i s   c l a s s   h a s   a n   i n t e r n a l   r a s t e r   a n d   h a n d l e s   T e x t u r e 2 D   i m a g e . 
 	 / / /   T h e   c l a s s   i s   u s e f u l   t o   i n p u t   s t a t i c   i m a g e   t o   N y A R M a r k e r S y s t e m . 
 	 / / /   < / s u m m a r y > 
 	 / / /   < e x c e p t i o n   c r e f = ' N y A R E x c e p t i o n ' > 
 	 / / /   I s   t h r o w n   w h e n   t h e   n y   A R   e x c e p t i o n . 
 	 / / /   < / e x c e p t i o n > 
 	 p u b l i c   c l a s s   N y A R U n i t y S e n s o r   : N y A R S e n s o r 
 	 { 
 	         p r i v a t e   N y A R U n i t y R a s t e r   _ r a s t e r ; 
 	 	 / / /   < s u m m a r y > 
 	 	 / / /   T h i s   i s   c o n s t r u c t o r . 
 	 	 / / /   < / s u m m a r y > 
 	 	 / / /   < p a r a m   n a m e = ' i _ w i d t h ' > 
 	 	 / / /   w i d t h   o f   i n t e r n a l   r a s t e r . 
 	 	 / / /   < / p a r a m > 
 	 	 / / /   < p a r a m   n a m e = ' i _ h e i g h t ' > 
 	 	 / / /   h e i g h t   o f   i n t e r n a l   r a s t e r . 
 	 	 / / /   < / p a r a m > 
 	 	 p u b l i c   N y A R U n i t y S e n s o r ( i n t   i _ w i d t h , i n t   i _ h e i g h t ) :   b a s e ( n e w   N y A R I n t S i z e ( i _ w i d t h , i _ h e i g h t ) ) 
 	 	 { 
 	                 / / C r e a t e   i n t e r n a l   r a s t e r   ( T e x t u r e 2 d   d o e s   n o t   r e q u i r e d   v e r t i c a l   f l i p p i n g . ) 
 	                 t h i s . _ r a s t e r   =   n e w   N y A R U n i t y R a s t e r ( i _ w i d t h , i _ h e i g h t , t r u e ) ; 
 	                 / / u p d a t e   b y   i n t e r n a l   r a s t e r 
 	                 b a s e . u p d a t e ( t h i s . _ r a s t e r ) ; 
 	 	 } 
 	 	 / / /   < s u m m a r y > 
 	 	 / / /   U p d a t e   I n t e r n a l   R a s t e r . 
 	 	 / / /   < / s u m m a r y > 
 	 	 / / /   < p a r a m   n a m e = ' i _ i n p u t ' > 
 	 	 / / /   n e w   t e x t u r e   i m a g e .   M u s t   b e   s a m e   s i z e   w i t h   S e n s o r   s i z e . 
 	 	 / / /   < / p a r a m > 
 	 	 p u b l i c   v o i d   u p d a t e ( T e x t u r e 2 D   i _ i n p u t ) 
 	 	 { 
 	 	 	 / / u p d a t e   i n t e r n a l   r a s t e r 
 	 	 	 t h i s . _ r a s t e r . u p d a t e B y T e x t u r e 2 D ( i _ i n p u t ) ; 
 	 	 	 / / n o t   n e c e s s a r y   t o   u p d a t e   r a s t e r   d r i v e r s . 
 	 	 	 / / t i m e   s t a m p   o n l y . 
 	 	 	 b a s e . u p d a t e T i m e S t a m p ( ) ; 
 	 	 } 
 	 	 / / /   < s u m m a r y > 
 	 	 / / /   T h i s   f u n c t i o n   i s   d i s s a b l e d . 
 	 	 / / /   S e e   " v o i d   u p d a t e ( T e x t u r e 2 D   i _ i n p u t ) " 
 	 	 / / /   < / s u m m a r y > 
 	 	 / / /   < p a r a m   n a m e = ' i _ i n p u t ' > 
 	 	 / / /   u n d e f i n e d . 
 	 	 / / /   < / p a r a m > 
 	 	 p u b l i c   o v e r r i d e   v o i d   u p d a t e ( I N y A R R g b R a s t e r   i _ i n p u t ) 
 	 	 { 
 	 	 	 / / M u s t   b e   s a m e   i n s t a n c e   a s   i n t e r n a l   r a s t e r . 
 	 	 	 i f ( i _ i n p u t ! = t h i s . _ r a s t e r ) { 
 	 	 	 	 t h r o w   n e w   N y A R E x c e p t i o n ( ) ; 
 	 	 	 } 
 	 	 	 b a s e . u p d a t e ( i _ i n p u t ) ; 
 	 	 } 
 	 	 p u b l i c   v o i d   d G e t G s T e x ( T e x t u r e 2 D   t x ) 
 	 	 { 
 	 	 	 N y A R I n t S i z e   s z = t h i s . _ r a s t e r . g e t S i z e ( ) ; 
 	 	 	 i n t [ ]   s = ( i n t [ ] ) t h i s . _ g s _ r a s t e r . g e t B u f f e r ( ) ; 
 	 	 	 D e b u g . L o g ( s . L e n g t h ) ; 
 	 	 	 C o l o r 3 2 [ ]   c = n e w   C o l o r 3 2 [ s z . w * s z . h ] ; 
 	 	 	 f o r ( i n t   i = 0 ; i < s z . h ; i + + ) { 
 	 	 	 	 f o r ( i n t   i 2 = 0 ; i 2 < s z . w ; i 2 + + ) { 
 	 	 	 	 	 c [ i * s z . w + i 2 ] . r = c [ i * s z . w + i 2 ] . g = c [ i * s z . w + i 2 ] . b = ( b y t e ) s [ i * s z . w + i 2 ] ; 
 	 	 	 	 	 c [ i * s z . w + i 2 ] . a = 0 x f f ; 
 	 	 	 	 } 
 	 	 	 } 
 	 	 	 t x . S e t P i x e l s 3 2 ( c ) ; 
 	 	 	 t x . A p p l y (   f a l s e   ) ; 
 	 	 } 	 	 
 	 } 
 
 } 
 
 