u s i n g   S y s t e m ; 
 u s i n g   S y s t e m . D i a g n o s t i c s ; 
 u s i n g   U n i t y E n g i n e ; 
 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 > 
 	 / / /   U n i t y 
 	 / / /   
 	 / / /   < / 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 R a s t e r :   N y A R R g b R a s t e r 
         { 
 	 	 p r i v a t e   b o o l   _ i s _ i n v e r s e = f a l s e ; 
 	 	 p u b l i c   b o o l   i s F l i p V i r t i c a l ( ) 
 	 	 { 
 	 	 	 r e t u r n   t h i s . _ i s _ i n v e r s e ; 
 	 	 } 
 	 	 / / /   < s u m m a r y > 
 	 	 / / /   S0n0peo00T e x t u r e 2 D 0SgqY000000000ubW0~0Y00
 	 	 / / /   < / s u m m a r y > 
 	 	 / / /   < p a r a m   n a m e = ' i _ t e x ' > 
 	 	 / / /   I _ t e x . 
 	 	 / / /   < / p a r a m > / 
                 p u b l i c   N y A R U n i t y R a s t e r ( T e x t u r e 2 D   i _ t e x ) 
                         :   b a s e ( i _ t e x . w i d t h ,   i _ t e x . h e i g h t ,   N y A R B u f f e r T y p e . O B J E C T _ C S _ U n i t y , f a l s e ) 
                 { 
 	 	 	 t h i s . u p d a t e B y T e x t u r e 2 D ( i _ t e x ) ; 
 	 	 	 ( ( N y A R R g b P i x e l D r i v e r _ C s U n i t y ) t h i s . _ r g b _ p i x e l _ d r i v e r ) . s e t I n v e r s e ( t r u e ) ; 
                 } 
 	 	 
                 / * * 
                   *   0000000ubW0~0Y00000000o00U n i t y O b j e c t n0Sgq00000ca0~0Y00
                   * / 
                 p u b l i c   N y A R U n i t y R a s t e r ( i n t   i _ w i d t h ,   i n t   i _ h e i g t h , b o o l   i _ i s _ i n v e r s e ) 
                         :   b a s e ( i _ w i d t h ,   i _ h e i g t h ,   N y A R B u f f e r T y p e . O B J E C T _ C S _ U n i t y , t r u e ) 
                 { 
 	 	 	 t h i s . _ i s _ i n v e r s e = i _ i s _ i n v e r s e ; 
 	 	 	 ( ( N y A R R g b P i x e l D r i v e r _ C s U n i t y ) t h i s . _ r g b _ p i x e l _ d r i v e r ) . s e t I n v e r s e ( i _ i s _ i n v e r s e ) ; 
                 } 
                 / * * 
                   *   R e a d e r h0b u f f e r 0RgSY00peg0Y000000000K00|Ts0QW0~0Y00
                   *   }b000g0S0n0pe0b5_Y00S0h0g00[_Y000000000n0.z^0X0[0~0Y00
                   *   @ p a r a m   i _ s i z e 
                   *   000n0000
                   *   @ p a r a m   i _ r a s t e r _ t y p e 
                   *   0000000
                   *   @ p a r a m   i _ i s _ a l l o c 
                   *   YSgq/ Q0000n0000
                   *   @ r e t u r n 
                   *   RgSL0bRY00h00t r u e g0Y00
                   *   @   
                   * / 
                 p r o t e c t e d   o v e r r i d e   v o i d   i n i t I n s t a n c e ( N y A R I n t S i z e   i _ s i z e ,   i n t   i _ r a s t e r _ t y p e ,   b o o l   i _ i s _ a l l o c ) 
                 { 
                         / / 0000n0i{
                         s w i t c h   ( i _ r a s t e r _ t y p e ) 
                         { 
                                 c a s e   N y A R B u f f e r T y p e . O B J E C T _ C S _ U n i t y : 
                                         t h i s . _ b u f   =   i _ i s _ a l l o c ? n e w   C o l o r 3 2 [ i _ s i z e . w * i _ s i z e . h ] : n u l l ; 
                                         t h i s . _ r g b _ p i x e l _ d r i v e r   =   n e w   N y A R R g b P i x e l D r i v e r _ C s U n i t y ( ) ; 
                                         t h i s . _ r g b _ p i x e l _ d r i v e r . s w i t c h R a s t e r ( t h i s ) ; 
                                         t h i s . _ i s _ a t t a c h e d _ b u f f e r   =   i _ i s _ a l l o c ; 
                                         b r e a k ; 
                                 d e f a u l t : 
                                         b a s e . i n i t I n s t a n c e ( i _ s i z e , i _ r a s t e r _ t y p e , i _ i s _ a l l o c ) ; 
 	 	 	 	 	 r e t u r n ; 
                         } 
                         / / r e a d e r n0i{
                         r e t u r n ; 
                 } 
                 / * * 
                   *   S0n0peo00000k0YSgq00000000W0~0Y00
                   *   YSgq0000n0Bfk0`0Q0OH0~0Y00
                   * / 
                 p u b l i c   o v e r r i d e   v o i d   w r a p B u f f e r ( o b j e c t   i _ r e f _ b u f ) 
                 { 
 	 	 	 t h r o w   n e w   N y A R E x c e p t i o n ( ) ; 
                 } 
 	 	 / * * 
 	 	   *   W e b T e x t u r e g0feW0~0Y00
 	 	   * / 
 	 	 p u b l i c   v o i d   u p d a t e B y W e b C a m T e x t u r e ( W e b C a m T e x t u r e   i _ w t x ) 
 	 	 { 
 	 	 	 i _ w t x . G e t P i x e l s 3 2 ( ( C o l o r 3 2 [ ] ) t h i s . _ b u f ) ; 
 	 	 	 / / t h i s . _ r g b _ p i x e l _ d r i v e r . s w i t c h R a s t e r ( t h i s ) ; / / 00000
NfM0Y00K00D00j0D00
 	 	 	 r e t u r n ; 
 	 	 } 
 	 	 p u b l i c   v o i d   u p d a t e B y T e x t u r e 2 D ( T e x t u r e 2 D   i _ w t x ) 
 	 	 { 
 	 	 	 S y s t e m . D i a g n o s t i c s . D e b u g . A s s e r t ( t h i s . _ s i z e . i s E q u a l S i z e ( i _ w t x . w i d t h , i _ w t x . h e i g h t ) ) ; 
 	 	 	 t h i s . _ b u f = i _ w t x . G e t P i x e l s 3 2 ( ) ; 
 	 	 	 t h i s . _ r g b _ p i x e l _ d r i v e r . s w i t c h R a s t e r ( t h i s ) ; 
 	 	 	 r e t u r n ; 
 	 	 } 	 	 
                 p u b l i c   o v e r r i d e   o b j e c t   c r e a t e I n t e r f a c e ( T y p e   i I i d ) 
                 { 
                         i f   ( i I i d   = =   t y p e o f ( I N y A R P e r s p e c t i v e C o p y ) ) 
                         { 
 	 	 	 	 r e t u r n   n e w   P e r s p e c t i v e C o p y _ U n i t y ( t h i s , t h i s . _ i s _ i n v e r s e ) ; 
                         } 
                         i f   ( i I i d   = =   t y p e o f ( N y A R M a t c h P a t t D e v i a t i o n C o l o r D a t a . I R a s t e r D r i v e r ) ) 
                         { 
 	 	 	 	 / / s h o u l d   b e   i m p l e m e n t ! 
                         } 
                         i f   ( i I i d   = =   t y p e o f ( I N y A R R g b 2 G s F i l t e r ) ) 
                         { 
                                 r e t u r n   n e w   N y A R R g b 2 G s F i l t e r R g b A v e _ U n i t y R a s t e r ( t h i s , t h i s . _ i s _ i n v e r s e ) ; 
                         } 
                         e l s e   i f   ( i I i d   = =   t y p e o f ( I N y A R R g b 2 G s F i l t e r R g b A v e ) ) 
                         { 
                                 r e t u r n   n e w   N y A R R g b 2 G s F i l t e r R g b A v e _ U n i t y R a s t e r ( t h i s , t h i s . _ i s _ i n v e r s e ) ; 
                         } 
                         e l s e   i f   ( i I i d   = =   t y p e o f ( I N y A R R g b 2 G s F i l t e r A r t k T h ) ) 
                         { 
 	 	 	 	 / / m a y   b e   i m p l e m e n t ? 
                         } 
 	 	 	 r e t u r n   b a s e . c r e a t e I n t e r f a c e ( i I i d ) ; 
                 } 
         } 
 
         # r e g i o n   p i x e l   d r i v e r s 
         s e a l e d   c l a s s   N y A R R g b 2 G s F i l t e r R g b A v e _ U n i t y R a s t e r   :   I N y A R R g b 2 G s F i l t e r R g b A v e 
         { 
 	 	 p r i v a t e   b o o l   _ i s _ i n v e r s e ; 
                 p r i v a t e   N y A R U n i t y R a s t e r   _ r e f _ r a s t e r ; 
                 p u b l i c   N y A R R g b 2 G s F i l t e r R g b A v e _ U n i t y R a s t e r ( N y A R U n i t y R a s t e r   i _ r e f _ r a s t e r , b o o l   i s _ i n v e r s e ) 
                 { 
                         S y s t e m . D i a g n o s t i c s . D e b u g . A s s e r t ( i _ r e f _ r a s t e r . i s E q u a l B u f f e r T y p e ( N y A R B u f f e r T y p e . O B J E C T _ C S _ U n i t y ) ) ; 
                         t h i s . _ r e f _ r a s t e r   =   i _ r e f _ r a s t e r ; 
 	 	 	 t h i s . _ i s _ i n v e r s e   =   i s _ i n v e r s e ; 
                 } 
                 p u b l i c   v o i d   c o n v e r t ( I N y A R G r a y s c a l e R a s t e r   i _ r a s t e r ) 
                 { 
                         N y A R I n t S i z e   s   =   t h i s . _ r e f _ r a s t e r . g e t S i z e ( ) ; 
                         t h i s . c o n v e r t R e c t ( 0 ,   0 ,   s . w ,   s . h ,   i _ r a s t e r ) ; 
                 } 
                 p u b l i c   v o i d   c o n v e r t R e c t ( i n t   l ,   i n t   t ,   i n t   w ,   i n t   h ,   I N y A R G r a y s c a l e R a s t e r   o _ r a s t e r ) 
                 { 
 	 	 	 C o l o r 3 2 [ ]   c = ( C o l o r 3 2 [ ] ) ( t h i s . _ r e f _ r a s t e r . g e t B u f f e r ( ) ) ; 
                         N y A R I n t S i z e   s i z e   =   t h i s . _ r e f _ r a s t e r . g e t S i z e ( ) ; 
                         i n t   s r c   =   ( l   +   t   *   s i z e . w )   *   4 ; 
                         i n t   b   =   t   +   h ; 
                         i n t   r o w _ p a d d i n g _ d s t   =   ( s i z e . w   -   w ) ; 
                         i n t   r o w _ p a d d i n g _ s r c   =   r o w _ p a d d i n g _ d s t   *   4 ; 
                         i n t   p i x _ c o u n t   =   w ; 
                         i n t   p i x _ m o d _ p a r t   =   p i x _ c o u n t   -   ( p i x _ c o u n t   %   8 ) ; 
                         
                         / /   i n _ b u f   =   ( b y t e [ ] ) t h i s . _ r e f _ r a s t e r . g e t B u f f e r ( ) ; 
                         s w i t c h   ( o _ r a s t e r . g e t B u f f e r T y p e ( ) ) 
                         { 
                                 c a s e   N y A R B u f f e r T y p e . I N T 1 D _ G R A Y _ 8 : 
                                         i n t [ ]   o u t _ b u f   =   ( i n t [ ] ) o _ r a s t e r . g e t B u f f e r ( ) ; 
 	 	 	 	 	 i n t   d s t _ p t r ; 
 	 	 	 	 	 i f ( t h i s . _ i s _ i n v e r s e ) { 
 	 	 	 	 	 	 d s t _ p t r = ( h - 1 - t )   *   s i z e . w   +   l ; 
 	 	 	 	 	 	 r o w _ p a d d i n g _ d s t - = s i z e . w * 2 ; 
 	 	 	 	 	 } e l s e { 
 	 	 	 	 	 	 d s t _ p t r = t   *   s i z e . w   +   l ; 
 	 	 	 	 	 } 
                                         f o r   ( i n t   y   =   t ;   y   <   b ;   y + + ) 
                                         { 	 	 	 	 	 	 
                                                 i n t   x   =   0 ; 
 	 	 	 	 	 	 C o l o r 3 2   p ; 
                                                 f o r   ( x   =   p i x _ c o u n t   -   1 ;   x   > =   p i x _ m o d _ p a r t ;   x - - ) 
                                                 { 
 	 	 	 	 	 	 	 p = c [ s r c + + ] ; 
                                                         o u t _ b u f [ d s t _ p t r + + ]   =   ( p . r + p . g + p . b )   /   3 ; 
                                                 } 
                                                 f o r   ( ;   x   > =   0 ;   x   - =   8 ) 
                                                 { 
 	 	 	 	 	 	 	 p = c [ s r c + + ] ; 
                                                         o u t _ b u f [ d s t _ p t r + + ]   =   ( p . r + p . g + p . b )   /   3 ; 
 	 	 	 	 	 	 	 p = c [ s r c + + ] ; 
                                                         o u t _ b u f [ d s t _ p t r + + ]   =   ( p . r + p . g + p . b )   /   3 ; 
 	 	 	 	 	 	 	 p = c [ s r c + + ] ; 
                                                         o u t _ b u f [ d s t _ p t r + + ]   =   ( p . r + p . g + p . b )   /   3 ; 
 	 	 	 	 	 	 	 p = c [ s r c + + ] ; 
                                                         o u t _ b u f [ d s t _ p t r + + ]   =   ( p . r + p . g + p . b )   /   3 ; 
 	 	 	 	 	 	 	 p = c [ s r c + + ] ; 
                                                         o u t _ b u f [ d s t _ p t r + + ]   =   ( p . r + p . g + p . b )   /   3 ; 
 	 	 	 	 	 	 	 p = c [ s r c + + ] ; 
                                                         o u t _ b u f [ d s t _ p t r + + ]   =   ( p . r + p . g + p . b )   /   3 ; 
 	 	 	 	 	 	 	 p = c [ s r c + + ] ; 
                                                         o u t _ b u f [ d s t _ p t r + + ]   =   ( p . r + p . g + p . b )   /   3 ; 
 	 	 	 	 	 	 	 p = c [ s r c + + ] ; 
                                                         o u t _ b u f [ d s t _ p t r + + ]   =   ( p . r + p . g + p . b )   /   3 ; 
                                                 } 
 	 	 	 	 	 	 d s t _ p t r + = r o w _ p a d d i n g _ d s t ; 
                                                 s r c   + =   r o w _ p a d d i n g _ s r c ; 
                                         } 
                                         r e t u r n ; 
                                 d e f a u l t : 
                                         I N y A R G s P i x e l D r i v e r   o u t _ d r v   =   o _ r a s t e r . g e t G s P i x e l D r i v e r ( ) ; 
                                         f o r   ( i n t   y   =   t ;   y   <   b ;   y + + ) 
                                         { 
                                                 f o r   ( i n t   x   =   0 ;   x   <   p i x _ c o u n t ;   x + + ) 
                                                 { 
                                                         C o l o r 3 2   p   =   c [ s r c + + ] ; 
                                                         o u t _ d r v . s e t P i x e l ( x ,   y , ( p . r + p . g + p . b )   /   3 ) ; 
                                                 } 
                                                 s r c   + =   r o w _ p a d d i n g _ s r c ; 
                                         } 
                                         r e t u r n ; 
                         } 
 
                 } 
         } 
 	 
         s e a l e d   c l a s s   N y A R R g b P i x e l D r i v e r _ C s U n i t y   :   I N y A R R g b P i x e l D r i v e r 
         { 
                 / * *   SgqY00Y0000  * / 
                 p r i v a t e   C o l o r 3 2 [ ]   _ r e f _ b u f ; 
                 p r i v a t e   N y A R I n t S i z e   _ r e f _ s i z e ; 
 	 	 p r i v a t e   b o o l   _ i s _ i n v _ v = t r u e ; 
 	 	 / / /   < s u m m a r y > 
 	 	 / / /   I n i t i a l i z e s   a   n e w   i n s t a n c e   o f   t h e   < s e e   c r e f = " N y A R U n i t y U t i l s . N y A R R g b P i x e l D r i v e r _ C s U n i t y " / >   c l a s s . 
 	 	 / / /   < / s u m m a r y > 
 	 	 / / /   < p a r a m   n a m e = ' i _ i n v _ v ' > 
 	 	 / / /   Y 0SY004XTo0t r u e 
 	 	 / / /   < / p a r a m > 
 	 	 p u b l i c   N y A R R g b P i x e l D r i v e r _ C s U n i t y ( ) 
 	 	 { 
 	 	 } 
                 p u b l i c   N y A R I n t S i z e   g e t S i z e ( ) 
                 { 
                         r e t u r n   t h i s . _ r e f _ s i z e ; 
                 } 
 	 	 p u b l i c   v o i d   s e t I n v e r s e ( b o o l   i _ v a l ) 
 	 	 { 
 	 	 	 t h i s . _ i s _ i n v _ v = i _ v a l ; 
 	 	 } 
                 / * * 
                   *   S0n0peo00c[W0_0^jn01 0000Rn0R G B 00000MRk0<h
}W0f0ԏW0~0Y00
                   * / 
                 p u b l i c   v o i d   g e t P i x e l ( i n t   i _ x ,   i n t   i _ y ,   i n t [ ]   o _ r g b ) 
                 { 
 	 	 	 C o l o r 3 2   p i x ; 
 	 	 	 i f ( t h i s . _ i s _ i n v _ v ) { 
                         / / b y t e ( B G R X ) = i n t ( X R G B ) 
                         	 p i x = t h i s . _ r e f _ b u f [ i _ x + ( t h i s . _ r e f _ s i z e . h - 1 - i _ y ) * t h i s . _ r e f _ s i z e . w ] ; 
 	 	 	 } e l s e { 
                         	 p i x = t h i s . _ r e f _ b u f [ i _ x + i _ y * t h i s . _ r e f _ s i z e . w ] ; 
 	 	 	 } 
                         o _ r g b [ 0 ]   =   p i x . r ; / /   R 
                         o _ r g b [ 1 ]   =   p i x . g ;   / /   G 
                         o _ r g b [ 2 ]   =   p i x . b ;         / /   B 
                         r e t u r n ; 
                 } 
 
                 / * * 
                   *   S0n0peo00^jK0000000T0h0n0R G B 00000MRk0<h
}W0f0ԏW0~0Y00
                   * / 
                 p u b l i c   v o i d   g e t P i x e l S e t ( i n t [ ]   i _ x ,   i n t [ ]   i _ y ,   i n t   i _ n u m ,   i n t [ ]   o _ r g b ) 
                 { 
 	 	 	 i f ( t h i s . _ i s _ i n v _ v ) { 
 	 	 	 	 i n t   h 1 = t h i s . _ r e f _ s i z e . h - 1 ; 
 	                         f o r   ( i n t   i   =   i _ n u m   -   1 ;   i   > =   0 ;   i - - ) 
 	                         { 
 	 	 	 	 	 C o l o r 3 2   p i x = t h i s . _ r e f _ b u f [ i _ x [ i ] + ( h 1 - i _ y [ i ] ) * t h i s . _ r e f _ s i z e . w ] ; 
 	 	                         o _ r g b [ i * 3 + 0 ]   =   p i x . r ; / /   R 
 	 	                         o _ r g b [ i * 3 + 1 ]   =   p i x . g ;   / /   G 
 	 	                         o _ r g b [ i * 3 + 2 ]   =   p i x . b ;         / /   B 
 	                         } 
 	 	 	 } e l s e { 
 	                         f o r   ( i n t   i   =   i _ n u m   -   1 ;   i   > =   0 ;   i - - ) 
 	                         { 
 	 	 	 	 	 C o l o r 3 2   p i x = t h i s . _ r e f _ b u f [ i _ x [ i ] + i _ y [ i ] * t h i s . _ r e f _ s i z e . w ] ; 
 	 	                         o _ r g b [ i * 3 + 0 ]   =   p i x . r ; / /   R 
 	 	                         o _ r g b [ i * 3 + 1 ]   =   p i x . g ;   / /   G 
 	 	                         o _ r g b [ i * 3 + 2 ]   =   p i x . b ;         / /   B 
 	                         } 
 	 	 	 } 
                         r e t u r n ; 
                 } 
 
                 / * * 
                   *   S0n0peo00R G B 0000c[W0_0^jn00000k0000W0~0Y00
                   * / 
                 p u b l i c   v o i d   s e t P i x e l ( i n t   i _ x ,   i n t   i _ y ,   i n t [ ]   i _ r g b ) 
                 { 
 	 	 	 i n t   i d x ; 
 	 	 	 i f ( t h i s . _ i s _ i n v _ v ) { 
 	 	 	 	 i d x = i _ x + ( t h i s . _ r e f _ s i z e . h - 1 - i _ y ) * t h i s . _ r e f _ s i z e . w ; 
 	 	 	 } e l s e { 
 	 	 	 	 i d x = i _ x + i _ y * t h i s . _ r e f _ s i z e . w ; 
 	 	 	 } 
 	 	 	 t h i s . _ r e f _ b u f [ i d x ] . r = ( b y t e ) i _ r g b [ 0 ] ; 
 	 	 	 t h i s . _ r e f _ b u f [ i d x ] . g = ( b y t e ) i _ r g b [ 1 ] ; 
 	 	 	 t h i s . _ r e f _ b u f [ i d x ] . b = ( b y t e ) i _ r g b [ 2 ] ; 
                         r e t u r n ; 
                 } 
 
                 / * * 
                   *   S0n0peo00R G B 0000c[W0_0^jn00000k0000W0~0Y00
                   * / 
                 p u b l i c   v o i d   s e t P i x e l ( i n t   i _ x ,   i n t   i _ y ,   i n t   i _ r ,   i n t   i _ g ,   i n t   i _ b ) 
                 { 
 	 	 	 i n t   i d x ; 
 	 	 	 i f ( t h i s . _ i s _ i n v _ v ) { 
 	 	 	 	 i d x = i _ x + ( t h i s . _ r e f _ s i z e . h - 1 - i _ y ) * t h i s . _ r e f _ s i z e . w ; 
 	 	 	 } e l s e { 
 	 	 	 	 i d x = i _ x + i _ y * t h i s . _ r e f _ s i z e . w ; 
 	 	 	 } 
 	 	 	 t h i s . _ r e f _ b u f [ i d x ] . r = ( b y t e ) i _ r ; 
 	 	 	 t h i s . _ r e f _ b u f [ i d x ] . g = ( b y t e ) i _ g ; 
 	 	 	 t h i s . _ r e f _ b u f [ i d x ] . b = ( b y t e ) i _ b ; 
                         r e t u r n ; 
                 } 
 
                 / * * 
                   *   S0n0peo00_jW0~0[000
                   * / 
                 p u b l i c   v o i d   s e t P i x e l s ( i n t [ ]   i _ x ,   i n t [ ]   i _ y ,   i n t   i _ n u m ,   i n t [ ]   i _ i n t r g b ) 
                 { 
                         N y A R E x c e p t i o n . n o t I m p l e m e n t ( ) ; 
                 } 
 
                 p u b l i c   v o i d   s w i t c h R a s t e r ( I N y A R R g b R a s t e r   i _ r a s t e r ) 
                 { 
                         t h i s . _ r e f _ b u f   = ( C o l o r 3 2 [ ] ) ( ( ( N y A R U n i t y R a s t e r ) i _ r a s t e r ) . g e t B u f f e r ( ) ) ; 
                         t h i s . _ r e f _ s i z e   =   i _ r a s t e r . g e t S i z e ( ) ; 
                 } 
         } 
 
 	 
 	 
         s e a l e d   c l a s s   P e r s p e c t i v e C o p y _ U n i t y   :   N y A R P e r s p e c t i v e C o p y _ B a s e 
         { 
                 p r i v a t e   N y A R U n i t y R a s t e r   _ r e f _ r a s t e r ; 
 	 	 p r i v a t e   b o o l   _ i s _ i n v _ v = f a l s e ; 
                 p u b l i c   P e r s p e c t i v e C o p y _ U n i t y ( N y A R U n i t y R a s t e r   i _ r e f _ r a s t e r , b o o l   i _ i n v _ v ) 
                 { 
                         S y s t e m . D i a g n o s t i c s . D e b u g . A s s e r t ( i _ r e f _ r a s t e r . i s E q u a l B u f f e r T y p e ( N y A R B u f f e r T y p e . O B J E C T _ C S ) ) ; 
 	 	 	 t h i s . _ i s _ i n v _ v = i _ i n v _ v ; 
                         t h i s . _ r e f _ r a s t e r   =   i _ r e f _ r a s t e r ; 
                 } 
 
                 p r o t e c t e d   o v e r r i d e   b o o l   o n e P i x e l ( i n t   p k _ l ,   i n t   p k _ t ,   d o u b l e [ ]   c p a r a ,   I N y A R R a s t e r   o _ o u t ) 
                 { 
                         C o l o r 3 2 [ ]   i n _ p i x s   =   ( C o l o r 3 2 [ ] ) t h i s . _ r e f _ r a s t e r . g e t B u f f e r ( ) ; 
                         i n t   i n _ w   =   t h i s . _ r e f _ r a s t e r . g e t W i d t h ( ) ; 
                         i n t   i n _ h   =   t h i s . _ r e f _ r a s t e r . g e t H e i g h t ( ) ; 
 
                         / / 000000000S_
                         d o u b l e   c p 0   =   c p a r a [ 0 ] ; 
                         d o u b l e   c p 3   =   c p a r a [ 3 ] ; 
                         d o u b l e   c p 6   =   c p a r a [ 6 ] ; 
                         d o u b l e   c p 1   =   c p a r a [ 1 ] ; 
                         d o u b l e   c p 4   =   c p a r a [ 4 ] ; 
                         d o u b l e   c p 7   =   c p a r a [ 7 ] ; 
 
                         i n t   o u t _ w   =   o _ o u t . g e t W i d t h ( ) ; 
                         i n t   o u t _ h   =   o _ o u t . g e t H e i g h t ( ) ; 
                         d o u b l e   c p 7 _ c y _ 1   =   c p 7   *   p k _ t   +   1 . 0   +   c p 6   *   p k _ l ; 
                         d o u b l e   c p 1 _ c y _ c p 2   =   c p 1   *   p k _ t   +   c p a r a [ 2 ]   +   c p 0   *   p k _ l ; 
                         d o u b l e   c p 4 _ c y _ c p 5   =   c p 4   *   p k _ t   +   c p a r a [ 5 ]   +   c p 3   *   p k _ l ; 
                         i n t   p ; 
 	 	 	 
 	 	 	 i n t   s t e p , o f f s e t ; 
 	 	 	 / / f l i p   V i r t i c a l 
                         s w i t c h   ( o _ o u t . g e t B u f f e r T y p e ( ) ) 
                         { 
                         c a s e   N y A R B u f f e r T y p e . I N T 1 D _ X 8 R 8 G 8 B 8 _ 3 2 : 
 	                         i n t [ ]   p a t _ d a t a   =   ( i n t [ ] ) o _ o u t . g e t B u f f e r ( ) ; 
                                 p   =   0 ; 
 	 	 	 	 i f ( t h i s . _ i s _ i n v _ v ) { 
 	 	 	 	 	 o f f s e t = i n _ w * ( i n _ h - 1 ) ; 
 	 	 	 	 	 s t e p = - i n _ w ; 
 	 	 	 	 } e l s e { 
 	 	 	 	 	 o f f s e t = 0 ; 
 	 	 	 	 	 s t e p = i n _ w ; 
 	 	 	 	 } 	 	 	 	 
                                 f o r   ( i n t   i y   =   0 ;   i y   <   o u t _ h ;   i y + + ) 
                                 { 
                                         / / P^Rn0p0S00
                                         d o u b l e   c p 7 _ c y _ 1 _ c p 6 _ c x   =   c p 7 _ c y _ 1 ; 
                                         d o u b l e   c p 1 _ c y _ c p 2 _ c p 0 _ c x   =   c p 1 _ c y _ c p 2 ; 
                                         d o u b l e   c p 4 _ c y _ c p 5 _ c p 3 _ c x   =   c p 4 _ c y _ c p 5 ; 
 
                                         f o r   ( i n t   i x   =   0 ;   i x   <   o u t _ w ;   i x + + ) 
                                         { 
                                                 / / 1 00000\Ob
                                                 d o u b l e   d   =   1   /   ( c p 7 _ c y _ 1 _ c p 6 _ c x ) ; 
                                                 i n t   x   =   ( i n t ) ( ( c p 1 _ c y _ c p 2 _ c p 0 _ c x )   *   d ) ; 
                                                 i n t   y   =   ( i n t ) ( ( c p 4 _ c y _ c p 5 _ c p 3 _ c x )   *   d ) ; 
                                                 i f   ( x   <   0 )   {   x   =   0 ;   }   e l s e   i f   ( x   > =   i n _ w )   {   x   =   i n _ w   -   1 ;   } 
                                                 i f   ( y   <   0 )   {   y   =   0 ;   }   e l s e   i f   ( y   > =   i n _ h )   {   y   =   i n _ h   -   1 ;   } 
 	 	 	 	 	 
 	 	 	 	 	 	 C o l o r 3 2   p i x = i n _ p i x s [ x   +   o f f s e t + s t e p * y ] ; 
                                                 / / 
                                                 p a t _ d a t a [ p ]   =   ( ( p i x . r   < <   1 6 )   &   0 x f f ) | ( ( p i x . g   < <   8 )   &   0 x f f ) |   p i x . b ; 
                                                 c p 7 _ c y _ 1 _ c p 6 _ c x   + =   c p 6 ; 
                                                 c p 1 _ c y _ c p 2 _ c p 0 _ c x   + =   c p 0 ; 
                                                 c p 4 _ c y _ c p 5 _ c p 3 _ c x   + =   c p 3 ; 
                                                 p + + ; 
                                         } 
                                         c p 7 _ c y _ 1   + =   c p 7 ; 
                                         c p 1 _ c y _ c p 2   + =   c p 1 ; 
                                         c p 4 _ c y _ c p 5   + =   c p 4 ; 
                                 } 
                                 r e t u r n   t r u e ; 	 	 
                         c a s e   N y A R B u f f e r T y p e . O B J E C T _ C S _ U n i t y : 
 	 	 	 	 C o l o r 3 2 [ ]   o u t _ b u f   =   ( C o l o r 3 2 [ ] ) ( ( ( I N y A R R g b R a s t e r ) o _ o u t ) . g e t B u f f e r ( ) ) ; 
 	 	 	 	 i f ( t h i s . _ i s _ i n v _ v = = ( ( N y A R U n i t y R a s t e r ) o _ o u t ) . i s F l i p V i r t i c a l ( ) ) { 
 	 	 	 	 	 o f f s e t = i n _ w * ( i n _ h - 1 ) ; 
 	 	 	 	 	 s t e p = - i n _ w ; 
 	 	 	 	 } e l s e { 
 	 	 	 	 	 o f f s e t = 0 ; 
 	 	 	 	 	 s t e p = i n _ w ; 
 	 	 	 	 } 	 	 	 	 
                                 f o r   ( i n t   i y   =   0 ;   i y   <   o u t _ h ;   i y + + ) 
                                 { 
                                         / / P^Rn0p0S00
                                         d o u b l e   c p 7 _ c y _ 1 _ c p 6 _ c x   =   c p 7 _ c y _ 1 ; 
                                         d o u b l e   c p 1 _ c y _ c p 2 _ c p 0 _ c x   =   c p 1 _ c y _ c p 2 ; 
                                         d o u b l e   c p 4 _ c y _ c p 5 _ c p 3 _ c x   =   c p 4 _ c y _ c p 5 ; 
 	 	 	 	 	 i n t   y s = o u t _ h - 1 - i y ; 
                                         f o r   ( i n t   i x   =   0 ;   i x   <   o u t _ w ;   i x + + ) 
                                         { 
                                                 / / 1 00000\Ob
                                                 d o u b l e   d   =   1   /   ( c p 7 _ c y _ 1 _ c p 6 _ c x ) ; 
                                                 i n t   x   =   ( i n t ) ( ( c p 1 _ c y _ c p 2 _ c p 0 _ c x )   *   d ) ; 
                                                 i n t   y   =   ( i n t ) ( ( c p 4 _ c y _ c p 5 _ c p 3 _ c x )   *   d ) ; 
                                                 i f   ( x   <   0 )   {   x   =   0 ;   }   e l s e   i f   ( x   > =   i n _ w )   {   x   =   i n _ w   -   1 ;   } 
                                                 i f   ( y   <   0 )   {   y   =   0 ;   }   e l s e   i f   ( y   > =   i n _ h )   {   y   =   i n _ h   -   1 ;   } 
 	 	 	 	 	 
 	 	 	 	 	 	 o u t _ b u f [ i x + y s * o u t _ w ] = i n _ p i x s [ x   +   o f f s e t + s t e p * y ] ; 
                                                 / / 
                                                 c p 7 _ c y _ 1 _ c p 6 _ c x   + =   c p 6 ; 
                                                 c p 1 _ c y _ c p 2 _ c p 0 _ c x   + =   c p 0 ; 
                                                 c p 4 _ c y _ c p 5 _ c p 3 _ c x   + =   c p 3 ; 
                                         } 
                                         c p 7 _ c y _ 1   + =   c p 7 ; 
                                         c p 1 _ c y _ c p 2   + =   c p 1 ; 
                                         c p 4 _ c y _ c p 5   + =   c p 4 ; 
                                 } 
                                 r e t u r n   t r u e ; 
                         d e f a u l t : 
                                 / / A N Y   t o   R G B x 
                                 i f   ( o _ o u t   i s   I N y A R R g b R a s t e r ) 
                                 { 
                                         I N y A R R g b P i x e l D r i v e r   o u t _ r e a d e r   =   ( ( I N y A R R g b R a s t e r ) o _ o u t ) . g e t R g b P i x e l D r i v e r ( ) ; 
 	 	 	 	 	 i f ( t h i s . _ i s _ i n v _ v ) { 
 	 	 	 	 	 	 o f f s e t = i n _ w * ( i n _ h - 1 ) ; 
 	 	 	 	 	 	 s t e p = - i n _ w ; 
 	 	 	 	 	 } e l s e { 
 	 	 	 	 	 	 o f f s e t = 0 ; 
 	 	 	 	 	 	 s t e p = i n _ w ; 
 	 	 	 	 	 } 
                                         f o r   ( i n t   i y   =   0 ;   i y   <   o u t _ h ;   i y + + ) 
                                         { 
                                                 / / P^Rn0p0S00
                                                 d o u b l e   c p 7 _ c y _ 1 _ c p 6 _ c x   =   c p 7 _ c y _ 1 ; 
                                                 d o u b l e   c p 1 _ c y _ c p 2 _ c p 0 _ c x   =   c p 1 _ c y _ c p 2 ; 
                                                 d o u b l e   c p 4 _ c y _ c p 5 _ c p 3 _ c x   =   c p 4 _ c y _ c p 5 ; 
 
                                                 f o r   ( i n t   i x   =   0 ;   i x   <   o u t _ w ;   i x + + ) 
                                                 { 
                                                         / / 1 00000\Ob
                                                         d o u b l e   d   =   1   /   ( c p 7 _ c y _ 1 _ c p 6 _ c x ) ; 
                                                         i n t   x   =   ( i n t ) ( ( c p 1 _ c y _ c p 2 _ c p 0 _ c x )   *   d ) ; 
                                                         i n t   y   =   ( i n t ) ( ( c p 4 _ c y _ c p 5 _ c p 3 _ c x )   *   d ) ; 
                                                         i f   ( x   <   0 )   {   x   =   0 ;   }   e l s e   i f   ( x   > =   i n _ w )   {   x   =   i n _ w   -   1 ;   } 
                                                         i f   ( y   <   0 )   {   y   =   0 ;   }   e l s e   i f   ( y   > =   i n _ h )   {   y   =   i n _ h   -   1 ;   } 
                                                 	 C o l o r 3 2   p x   =   i n _ p i x s [ x   +   o f f s e t + s t e p * y ] ; 
                                                         c p 7 _ c y _ 1 _ c p 6 _ c x   + =   c p 6 ; 
                                                         c p 1 _ c y _ c p 2 _ c p 0 _ c x   + =   c p 0 ; 
                                                         c p 4 _ c y _ c p 5 _ c p 3 _ c x   + =   c p 3 ; 
                                                         o u t _ r e a d e r . s e t P i x e l ( i x ,   i y , p x . r , p x . g , p x . b ) ; 
                                                 } 
                                                 c p 7 _ c y _ 1   + =   c p 7 ; 
                                                 c p 1 _ c y _ c p 2   + =   c p 1 ; 
                                                 c p 4 _ c y _ c p 5   + =   c p 4 ; 
                                         } 
 	                                 r e t u r n   t r u e ; 
 	 	 	 	 } 
 	 	 	 	 b r e a k ; 
 	 	 	 } 
                         r e t u r n   f a l s e ; 
                 } 
                 p r o t e c t e d   o v e r r i d e   b o o l   m u l t i P i x e l ( i n t   p k _ l ,   i n t   p k _ t ,   d o u b l e [ ]   c p a r a ,   i n t   i _ r e s o l u t i o n ,   I N y A R R a s t e r   o _ o u t ) 
                 { 
                         C o l o r 3 2 [ ]   i n _ p i x s   =   ( C o l o r 3 2 [ ] ) t h i s . _ r e f _ r a s t e r . g e t B u f f e r ( ) ; 
                         i n t   i n _ w   =   t h i s . _ r e f _ r a s t e r . g e t W i d t h ( ) ; 
                         i n t   i n _ h   =   t h i s . _ r e f _ r a s t e r . g e t H e i g h t ( ) ; 
                         i n t   r e s _ p i x   =   i _ r e s o l u t i o n   *   i _ r e s o l u t i o n ; 
 
                         / / 000000000S_
                         d o u b l e   c p 0   =   c p a r a [ 0 ] ; 
                         d o u b l e   c p 3   =   c p a r a [ 3 ] ; 
                         d o u b l e   c p 6   =   c p a r a [ 6 ] ; 
                         d o u b l e   c p 1   =   c p a r a [ 1 ] ; 
                         d o u b l e   c p 4   =   c p a r a [ 4 ] ; 
                         d o u b l e   c p 7   =   c p a r a [ 7 ] ; 
                         d o u b l e   c p 2   =   c p a r a [ 2 ] ; 
                         d o u b l e   c p 5   =   c p a r a [ 5 ] ; 
 
 	 	 	 i n t   s t e p , o f f s e t ; 
                         i n t   o u t _ w   =   o _ o u t . g e t W i d t h ( ) ; 
                         i n t   o u t _ h   =   o _ o u t . g e t H e i g h t ( ) ; 
                         i f   ( o _ o u t   i s   I N y A R R g b R a s t e r ) 
                         { 
                                 I N y A R R g b P i x e l D r i v e r   o u t _ r e a d e r   =   ( ( I N y A R R g b R a s t e r ) o _ o u t ) . g e t R g b P i x e l D r i v e r ( ) ; 
 	 	 	 	 i f ( t h i s . _ i s _ i n v _ v ) { 
 	 	 	 	 	 o f f s e t = i n _ w * ( i n _ h - 1 ) ; 
 	 	 	 	 	 s t e p = - i n _ w ; 
 	 	 	 	 } e l s e { 
 	 	 	 	 	 o f f s e t = 0 ; 
 	 	 	 	 	 s t e p = i n _ w ; 
 	 	 	 	 } 
                                 f o r   ( i n t   i y   =   o u t _ h   -   1 ;   i y   > =   0 ;   i y - - ) 
                                 { 
                                         / / P^Rn0p0S00
                                         f o r   ( i n t   i x   =   o u t _ w   -   1 ;   i x   > =   0 ;   i x - - ) 
                                         { 
                                                 i n t   r ,   g ,   b ; 
                                                 r   =   g   =   b   =   0 ; 
                                                 i n t   c y   =   p k _ t   +   i y   *   i _ r e s o l u t i o n ; 
                                                 i n t   c x   =   p k _ l   +   i x   *   i _ r e s o l u t i o n ; 
                                                 d o u b l e   c p 7 _ c y _ 1 _ c p 6 _ c x _ b   =   c p 7   *   c y   +   1 . 0   +   c p 6   *   c x ; 
                                                 d o u b l e   c p 1 _ c y _ c p 2 _ c p 0 _ c x _ b   =   c p 1   *   c y   +   c p 2   +   c p 0   *   c x ; 
                                                 d o u b l e   c p 4 _ c y _ c p 5 _ c p 3 _ c x _ b   =   c p 4   *   c y   +   c p 5   +   c p 3   *   c x ; 
                                                 f o r   ( i n t   i 2 y   =   i _ r e s o l u t i o n   -   1 ;   i 2 y   > =   0 ;   i 2 y - - ) 
                                                 { 
                                                         d o u b l e   c p 7 _ c y _ 1 _ c p 6 _ c x   =   c p 7 _ c y _ 1 _ c p 6 _ c x _ b ; 
                                                         d o u b l e   c p 1 _ c y _ c p 2 _ c p 0 _ c x   =   c p 1 _ c y _ c p 2 _ c p 0 _ c x _ b ; 
                                                         d o u b l e   c p 4 _ c y _ c p 5 _ c p 3 _ c x   =   c p 4 _ c y _ c p 5 _ c p 3 _ c x _ b ; 
                                                         f o r   ( i n t   i 2 x   =   i _ r e s o l u t i o n   -   1 ;   i 2 x   > =   0 ;   i 2 x - - ) 
                                                         { 
                                                                 / / 1 00000\Ob
                                                                 d o u b l e   d   =   1   /   ( c p 7 _ c y _ 1 _ c p 6 _ c x ) ; 
                                                                 i n t   x   =   ( i n t ) ( ( c p 1 _ c y _ c p 2 _ c p 0 _ c x )   *   d ) ; 
                                                                 i n t   y   =   ( i n t ) ( ( c p 4 _ c y _ c p 5 _ c p 3 _ c x )   *   d ) ; 
                                                                 i f   ( x   <   0 )   {   x   =   0 ;   }   e l s e   i f   ( x   > =   i n _ w )   {   x   =   i n _ w   -   1 ;   } 
                                                                 i f   ( y   <   0 )   {   y   =   0 ;   }   e l s e   i f   ( y   > =   i n _ h )   {   y   =   i n _ h   -   1 ;   } 
                                                         	 C o l o r 3 2   p x   =   i n _ p i x s [ x   +   o f f s e t + s t e p * y ] ; 
                                                                 r + =   p x . r ; / /   R 
                                                                 g + =   p x . g ; / /   G 
                                                                 b + =   p x . b ; / /   B 
                                                                 c p 7 _ c y _ 1 _ c p 6 _ c x   + =   c p 6 ; 
                                                                 c p 1 _ c y _ c p 2 _ c p 0 _ c x   + =   c p 0 ; 
                                                                 c p 4 _ c y _ c p 5 _ c p 3 _ c x   + =   c p 3 ; 
                                                         } 
                                                         c p 7 _ c y _ 1 _ c p 6 _ c x _ b   + =   c p 7 ; 
                                                         c p 1 _ c y _ c p 2 _ c p 0 _ c x _ b   + =   c p 1 ; 
                                                         c p 4 _ c y _ c p 5 _ c p 3 _ c x _ b   + =   c p 4 ; 
                                                 } 
                                                 o u t _ r e a d e r . s e t P i x e l ( i x ,   i y ,   r   /   r e s _ p i x ,   g   /   r e s _ p i x ,   b   /   r e s _ p i x ) ; 
                                         } 
                                 } 
                                 r e t u r n   t r u e ; 
                         } 
                         r e t u r n   f a l s e ; 
                 } 
         } 
         # e n d r e g i o n 
 } 
 
 
 