/ *   
 
   *   P R O J E C T :   N y A R T o o l k i t C S 
 
   *   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
   *   T h i s   w o r k   i s   b a s e d   o n   t h e   o r i g i n a l   A R T o o l K i t   d e v e l o p e d   b y 
 
   *       H i r o k a z u   K a t o 
 
   *       M a r k   B i l l i n g h u r s t 
 
   *       H I T L a b ,   U n i v e r s i t y   o f   W a s h i n g t o n ,   S e a t t l e 
 
   *   h t t p : / / w w w . h i t l . w a s h i n g t o n . e d u / a r t o o l k i t / 
 
   * 
 
   *   T h e   N y A R T o o l k i t C S   i s   J a v a   e d i t i o n   A R T o o l K i t   c l a s s   l i b r a r y . 
 
   *   C o p y r i g h t   ( C ) 2 0 0 8 - 2 0 0 9   R y o   I i z u k a 
 
   * 
 
   *   T h i s   p r o g r a m   i s   f r e e   s o f t w a r e :   y o u   c a n   r e d i s t r i b u t e   i t   a n d / o r   m o d i f y 
 
   *   i t   u n d e r   t h e   t e r m s   o f   t h e   G N U   G e n e r a l   P u b l i c   L i c e n s e   a s   p u b l i s h e d   b y 
 
   *   t h e   F r e e   S o f t w a r e   F o u n d a t i o n ,   e i t h e r   v e r s i o n   3   o f   t h e   L i c e n s e ,   o r 
 
   *   ( a t   y o u r   o p t i o n )   a n y   l a t e r   v e r s i o n . 
 
   *   
 
   *   T h i s   p r o g r a m   i s   d i s t r i b u t e d   i n   t h e   h o p e   t h a t   i t   w i l l   b e   u s e f u l , 
 
   *   b u t   W I T H O U T   A N Y   W A R R A N T Y ;   w i t h o u t   e v e n   t h e   i m p l i e d   w a r r a n t y   o f 
 
   *   M E R C H A N T A B I L I T Y   o r   F I T N E S S   F O R   A   P A R T I C U L A R   P U R P O S E .     S e e   t h e 
 
   *   G N U   G e n e r a l   P u b l i c   L i c e n s e   f o r   m o r e   d e t a i l s . 
 
   * 
 
   *   Y o u   s h o u l d   h a v e   r e c e i v e d   a   c o p y   o f   t h e   G N U   G e n e r a l   P u b l i c   L i c e n s e 
 
   *   a l o n g   w i t h   t h i s   p r o g r a m .     I f   n o t ,   s e e   < h t t p : / / w w w . g n u . o r g / l i c e n s e s / > . 
 
   *   
 
   *   F o r   f u r t h e r   i n f o r m a t i o n   p l e a s e   c o n t a c t . 
 
   * 	 h t t p : / / n y a t l a . j p / n y a t o o l k i t / 
 
   * 	 < a i r m a i l ( a t ) e b o n y . p l a l a . o r . j p >   o r   < n y a t l a ( a t ) n y a t l a . j p > 
 
   *   
 
   * / 
 
 n a m e s p a c e   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 
 
 { 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
         / * * 
 
           *   S0n0000o00{ @ l i n k   N y A R C o l o r P a t t _ B a s e } 0U\W0f0ؚSW0_0000g0Y00
 
           * / 
 
         p u b l i c   c l a s s   N y A R C o l o r P a t t _ O 3   :   N y A R C o l o r P a t t _ B a s e 
 
         { 
 
                 / * * 
 
                   *   0000000g0Y00
 
                   *   P^0c[W0f000000000ubW0~0Y00
 
                   *   @ p a r a m   i _ w i d t h 
 
                   *   000n0000
 
                   *   @ p a r a m   i _ h e i g h t 
 
                   *   000n0000
 
                   *   @   
 
                   * / 
 
                 p u b l i c   N y A R C o l o r P a t t _ O 3 ( i n t   i _ w i d t h ,   i n t   i _ h e i g h t ) 
 
                         :   b a s e ( i _ w i d t h ,   i _ h e i g h t ) 
 
                 { 
 
                 } 
 
                 p r i v a t e   r e a d o n l y   N y A R M a t   w k _ g e t _ c p a r a _ a   =   n e w   N y A R M a t ( 8 ,   8 ) ; 
 
                 p r i v a t e   r e a d o n l y   N y A R M a t   w k _ g e t _ c p a r a _ b   =   n e w   N y A R M a t ( 8 ,   1 ) ; 
 
                 p r i v a t e   r e a d o n l y   N y A R M a t   w k _ p i c k F r o m R a s t e r _ c p a r a   =   n e w   N y A R M a t ( 8 ,   1 ) ; 
 
 
 
                 / * * 
 
                   *   @ p a r a m   w o r l d 
 
                   *   @ p a r a m   v e r t e x 
 
                   *   @ p a r a m   o _ p a r a 
 
                   *   @ 
 
                   * / 
 
                 p r i v a t e   b o o l   g e t _ c p a r a ( N y A R I n t P o i n t 2 d [ ]   i _ v e r t e x ,   N y A R M a t   o _ p a r a ) 
 
                 { 
 
                         d o u b l e [ ] [ ]   w o r l d   =   C P A R A M _ W O R L D ; 
 
                         N y A R M a t   a   =   w k _ g e t _ c p a r a _ a ; / /   !kQtg0$P0-[Y00n0g00RgS
N/ /   n e w   N y A R M a t (   8 ,   8   ) ; 
 
                         d o u b l e [ ] [ ]   a _ a r r a y   =   a . g e t A r r a y ( ) ; 
 
                         N y A R M a t   b   =   w k _ g e t _ c p a r a _ b ; / /   !kQtg0$P0-[Y00n0g00RgS
N/ /   n e w   N y A R M a t (   8 ,   1   ) ; 
 
                         d o u b l e [ ] [ ]   b _ a r r a y   =   b . g e t A r r a y ( ) ; 
 
                         d o u b l e [ ]   a _ p t 0 ,   a _ p t 1 ; 
 
                         d o u b l e [ ]   w o r l d _ p t i ; 
 
 
 
                         f o r   ( i n t   i   =   0 ;   i   <   4 ;   i + + ) 
 
                         { 
 
                                 a _ p t 0   =   a _ a r r a y [ i   *   2 ] ; 
 
                                 a _ p t 1   =   a _ a r r a y [ i   *   2   +   1 ] ; 
 
                                 w o r l d _ p t i   =   w o r l d [ i ] ; 
 
 
 
                                 a _ p t 0 [ 0 ]   =   ( d o u b l e ) w o r l d _ p t i [ 0 ] ; / /   a - > m [ i * 1 6 + 0 ]   =   w o r l d [ i ] [ 0 ] ; 
 
                                 a _ p t 0 [ 1 ]   =   ( d o u b l e ) w o r l d _ p t i [ 1 ] ; / /   a - > m [ i * 1 6 + 1 ]   =   w o r l d [ i ] [ 1 ] ; 
 
                                 a _ p t 0 [ 2 ]   =   1 . 0 ; / /   a - > m [ i * 1 6 + 2 ]   =   1 . 0 ; 
 
                                 a _ p t 0 [ 3 ]   =   0 . 0 ; / /   a - > m [ i * 1 6 + 3 ]   =   0 . 0 ; 
 
                                 a _ p t 0 [ 4 ]   =   0 . 0 ; / /   a - > m [ i * 1 6 + 4 ]   =   0 . 0 ; 
 
                                 a _ p t 0 [ 5 ]   =   0 . 0 ; / /   a - > m [ i * 1 6 + 5 ]   =   0 . 0 ; 
 
                                 a _ p t 0 [ 6 ]   =   ( d o u b l e ) ( - w o r l d _ p t i [ 0 ]   *   i _ v e r t e x [ i ] . x ) ; / /   a - > m [ i * 1 6 + 6 ] =   - w o r l d [ i ] [ 0 ] * v e r t e x [ i ] [ 0 ] ; 
 
                                 a _ p t 0 [ 7 ]   =   ( d o u b l e ) ( - w o r l d _ p t i [ 1 ]   *   i _ v e r t e x [ i ] . x ) ; / /   a - > m [ i * 1 6 + 7 ] = - w o r l d [ i ] [ 1 ] * v e r t e x [ i ] [ 0 ] ; 
 
                                 a _ p t 1 [ 0 ]   =   0 . 0 ; / /   a - > m [ i * 1 6 + 8 ]   =   0 . 0 ; 
 
                                 a _ p t 1 [ 1 ]   =   0 . 0 ; / /   a - > m [ i * 1 6 + 9 ]   =   0 . 0 ; 
 
                                 a _ p t 1 [ 2 ]   =   0 . 0 ; / /   a - > m [ i * 1 6 + 1 0 ]   =   0 . 0 ; 
 
                                 a _ p t 1 [ 3 ]   =   ( d o u b l e ) w o r l d _ p t i [ 0 ] ; / /   a - > m [ i * 1 6 + 1 1 ]   =   w o r l d [ i ] [ 0 ] ; 
 
                                 a _ p t 1 [ 4 ]   =   ( d o u b l e ) w o r l d _ p t i [ 1 ] ; / /   a - > m [ i * 1 6 + 1 2 ]   =   w o r l d [ i ] [ 1 ] ; 
 
                                 a _ p t 1 [ 5 ]   =   1 . 0 ; / /   a - > m [ i * 1 6 + 1 3 ]   =   1 . 0 ; 
 
                                 a _ p t 1 [ 6 ]   =   ( d o u b l e ) ( - w o r l d _ p t i [ 0 ]   *   i _ v e r t e x [ i ] . y ) ; / /   a - > m [ i * 1 6 + 1 4 ] = - w o r l d [ i ] [ 0 ] * v e r t e x [ i ] [ 1 ] ; 
 
                                 a _ p t 1 [ 7 ]   =   ( d o u b l e ) ( - w o r l d _ p t i [ 1 ]   *   i _ v e r t e x [ i ] . y ) ; / /   a - > m [ i * 1 6 + 1 5 ] = - w o r l d [ i ] [ 1 ] * v e r t e x [ i ] [ 1 ] ; 
 
                                 b _ a r r a y [ i   *   2   +   0 ] [ 0 ]   =   ( d o u b l e ) i _ v e r t e x [ i ] . x ; / /   b - > m [ i * 2 + 0 ]   = v e r t e x [ i ] [ 0 ] ; 
 
                                 b _ a r r a y [ i   *   2   +   1 ] [ 0 ]   =   ( d o u b l e ) i _ v e r t e x [ i ] . y ; / /   b - > m [ i * 2 + 1 ]   = v e r t e x [ i ] [ 1 ] ; 
 
                         } 
 
                         i f   ( ! a . i n v e r s e ( ) ) 
 
                         { 
 
                                 r e t u r n   f a l s e ; 
 
                         } 
 
 
 
                         o _ p a r a . m u l ( a ,   b ) ; 
 
                         r e t u r n   t r u e ; 
 
                 } 
 
                 / * * 
 
                   *   S0n0peo00000n0i _ v e r t e x s g0[U000V҉b_K0000000S_W0f00000000k0<h
}W0~0Y00
 
                   * / 
 
                 p u b l i c   o v e r r i d e   b o o l   p i c k F r o m R a s t e r ( I N y A R R g b R a s t e r   i m a g e ,   N y A R I n t P o i n t 2 d [ ]   i _ v e r t e x s ) 
 
                 { 
 
                         N y A R M a t   c p a r a   =   t h i s . w k _ p i c k F r o m R a s t e r _ c p a r a ; 
 
                         / /   x d i v 2 , y d i v 2 n0{
 
                         i n t   x d i v 2 ,   y d i v 2 ; 
 
                         i n t   l 1 ,   l 2 ; 
 
                         i n t   w 1 ,   w 2 ; 
 
                         / /   x {
 
                         w 1   =   i _ v e r t e x s [ 0 ] . x   -   i _ v e r t e x s [ 1 ] . x ; 
 
                         w 2   =   i _ v e r t e x s [ 0 ] . y   -   i _ v e r t e x s [ 1 ] . y ; 
 
                         l 1   =   ( w 1   *   w 1   +   w 2   *   w 2 ) ; 
 
                         w 1   =   i _ v e r t e x s [ 2 ] . x   -   i _ v e r t e x s [ 3 ] . x ; 
 
                         w 2   =   i _ v e r t e x s [ 2 ] . y   -   i _ v e r t e x s [ 3 ] . y ; 
 
                         l 2   =   ( w 1   *   w 1   +   w 2   *   w 2 ) ; 
 
                         i f   ( l 2   >   l 1 ) 
 
                         { 
 
                                 l 1   =   l 2 ; 
 
                         } 
 
                         l 1   =   l 1   /   4 ; 
 
                         x d i v 2   =   t h i s . _ s i z e . w ; 
 
                         w h i l e   ( x d i v 2   *   x d i v 2   <   l 1 ) 
 
                         { 
 
                                 x d i v 2   * =   2 ; 
 
                         } 
 
                         i f   ( x d i v 2   >   A R _ P A T T _ S A M P L E _ N U M ) 
 
                         { 
 
                                 x d i v 2   =   A R _ P A T T _ S A M P L E _ N U M ; 
 
                         } 
 
 
 
                         / /   y {
 
                         w 1   =   i _ v e r t e x s [ 1 ] . x   -   i _ v e r t e x s [ 2 ] . x ; 
 
                         w 2   =   i _ v e r t e x s [ 1 ] . y   -   i _ v e r t e x s [ 2 ] . y ; 
 
                         l 1   =   ( w 1   *   w 1   +   w 2   *   w 2 ) ; 
 
                         w 1   =   i _ v e r t e x s [ 3 ] . x   -   i _ v e r t e x s [ 0 ] . x ; 
 
                         w 2   =   i _ v e r t e x s [ 3 ] . y   -   i _ v e r t e x s [ 0 ] . y ; 
 
                         l 2   =   ( w 1   *   w 1   +   w 2   *   w 2 ) ; 
 
                         i f   ( l 2   >   l 1 ) 
 
                         { 
 
                                 l 1   =   l 2 ; 
 
                         } 
 
                         y d i v 2   =   t h i s . _ s i z e . h ; 
 
                         l 1   =   l 1   /   4 ; 
 
                         w h i l e   ( y d i v 2   *   y d i v 2   <   l 1 ) 
 
                         { 
 
                                 y d i v 2   * =   2 ; 
 
                         } 
 
                         i f   ( y d i v 2   >   A R _ P A T T _ S A M P L E _ N U M ) 
 
                         { 
 
                                 y d i v 2   =   A R _ P A T T _ S A M P L E _ N U M ; 
 
                         } 
 
 
 
                         / /   c p a r a n0{
 
                         i f   ( ! g e t _ c p a r a ( i _ v e r t e x s ,   c p a r a ) ) 
 
                         { 
 
                                 r e t u r n   f a l s e ; 
 
                         } 
 
                         u p d a t e E x t p a t ( i m a g e ,   c p a r a ,   x d i v 2 ,   y d i v 2 ) ; 
 
 
 
                         r e t u r n   t r u e ; 
 
                 } 
 
                 p r i v a t e   i n t [ ]   _ _ u p d a t e E x t p a t _ r g b s e t ; 
 
                 p r i v a t e   i n t [ ]   _ _ u p d a t e E x t p a t _ x c ; 
 
                 p r i v a t e   i n t [ ]   _ _ u p d a t e E x t p a t _ y c ; 
 
                 p r i v a t e   d o u b l e [ ]   _ _ u p d a t e E x t p a t _ x w ; 
 
                 p r i v a t e   d o u b l e [ ]   _ _ u p d a t e E x t p a t _ y w ; 
 
                 p r i v a t e   i n t   _ l a s t _ p i x _ r e s o l u t i o n _ x   =   0 ; 
 
                 p r i v a t e   i n t   _ l a s t _ p i x _ r e s o l u t i o n _ y   =   0 ; 
 
                 p r i v a t e   v o i d   r e s e r v W o r k B u f f e r s ( i n t   i _ x d i v ,   i n t   i _ y d i v ) 
 
                 { 
 
                         i f   ( t h i s . _ l a s t _ p i x _ r e s o l u t i o n _ x   <   i _ x d i v   | |   t h i s . _ l a s t _ p i x _ r e s o l u t i o n _ y   <   i _ y d i v ) 
 
                         { 
 
                                 t h i s . _ _ u p d a t e E x t p a t _ x c   =   n e w   i n t [ i _ x d i v   *   i _ y d i v ] ; 
 
                                 t h i s . _ _ u p d a t e E x t p a t _ y c   =   n e w   i n t [ i _ x d i v   *   i _ y d i v ] ; 
 
                                 t h i s . _ _ u p d a t e E x t p a t _ x w   =   n e w   d o u b l e [ i _ x d i v ] ; 
 
                                 t h i s . _ _ u p d a t e E x t p a t _ y w   =   n e w   d o u b l e [ i _ y d i v ] ; 
 
                                 t h i s . _ _ u p d a t e E x t p a t _ r g b s e t   =   n e w   i n t [ i _ x d i v   *   i _ y d i v   *   3 ] ; 
 
                                 t h i s . _ l a s t _ p i x _ r e s o l u t i o n _ x   =   i _ x d i v ; 
 
                                 t h i s . _ l a s t _ p i x _ r e s o l u t i o n _ y   =   i _ y d i v ; 
 
                         } 
 
                         r e t u r n ; 
 
                 } 
 
                 p r i v a t e   s t a t i c   d o u b l e   L T _ P O S   =   1 0 2 . 5 ; 
 
                 p r i v a t e   s t a t i c   d o u b l e   S Q _ S I Z E   =   5 . 0 ; 
 
 
 
                 / / RrRpe1 6 *gnk0j00h0\W0EO0j00K000
 
                 p r i v a t e   v o i d   u p d a t e E x t p a t ( I N y A R R g b R a s t e r   i m a g e ,   N y A R M a t   i _ c p a r a ,   i n t   i _ x d i v 2 ,   i n t   i _ y d i v 2 ) 
 
                 { 
 
 
 
                         i n t   i ,   j ; 
 
                         i n t   r ,   g ,   b ; 
 
                         / / 000000000S_
 
                         i n t   p a t _ s i z e _ w   =   t h i s . _ s i z e . w ; 
 
                         i n t   x d i v   =   i _ x d i v 2   /   p a t _ s i z e _ w ; / /   x d i v   =   x d i v 2 / C o n f i g . A R _ P A T T _ S I Z E _ X ; 
 
                         i n t   y d i v   =   i _ y d i v 2   /   t h i s . _ s i z e . h ; / /   y d i v   =   y d i v 2 / C o n f i g . A R _ P A T T _ S I Z E _ Y ; 
 
                         i n t   x d i v _ x _ y d i v   =   x d i v   *   y d i v ; 
 
                         d o u b l e   r e c i p r o c a l ; 
 
                         d o u b l e [ ] [ ]   p a r a   =   i _ c p a r a . g e t A r r a y ( ) ; 
 
                         d o u b l e   p a r a 0 0   =   p a r a [ 0   *   3   +   0 ] [ 0 ] ; 
 
                         d o u b l e   p a r a 0 1   =   p a r a [ 0   *   3   +   1 ] [ 0 ] ; 
 
                         d o u b l e   p a r a 0 2   =   p a r a [ 0   *   3   +   2 ] [ 0 ] ; 
 
                         d o u b l e   p a r a 1 0   =   p a r a [ 1   *   3   +   0 ] [ 0 ] ; 
 
                         d o u b l e   p a r a 1 1   =   p a r a [ 1   *   3   +   1 ] [ 0 ] ; 
 
                         d o u b l e   p a r a 1 2   =   p a r a [ 1   *   3   +   2 ] [ 0 ] ; 
 
                         d o u b l e   p a r a 2 0   =   p a r a [ 2   *   3   +   0 ] [ 0 ] ; 
 
                         d o u b l e   p a r a 2 1   =   p a r a [ 2   *   3   +   1 ] [ 0 ] ; 
 
 
 
                         I N y A R R g b P i x e l D r i v e r   r e a d e r   =   i m a g e . g e t R g b P i x e l D r i v e r ( ) ; 
 
                         i n t   i m g _ w i d t h   =   i m a g e . g e t W i d t h ( ) ; 
 
                         i n t   i m g _ h e i g h t   =   i m a g e . g e t H e i g h t ( ) ; 
 
 
 
                         / / 0000000n0nP
 
                         r e s e r v W o r k B u f f e r s ( x d i v ,   y d i v ) ; 
 
                         d o u b l e [ ]   x w   =   t h i s . _ _ u p d a t e E x t p a t _ x w ; 
 
                         d o u b l e [ ]   y w   =   t h i s . _ _ u p d a t e E x t p a t _ y w ; 
 
                         i n t [ ]   x c   =   t h i s . _ _ u p d a t e E x t p a t _ x c ; 
 
                         i n t [ ]   y c   =   t h i s . _ _ u p d a t e E x t p a t _ y c ; 
 
                         i n t [ ]   r g b _ s e t   =   t h i s . _ _ u p d a t e E x t p a t _ r g b s e t ; 
 
 
 
 
 
                         f o r   ( i n t   i y   =   t h i s . _ s i z e . h   -   1 ;   i y   > =   0 ;   i y - - ) 
 
                         { 
 
                                 f o r   ( i n t   i x   =   p a t _ s i z e _ w   -   1 ;   i x   > =   0 ;   i x - - ) 
 
                                 { 
 
                                         / / x w , y w 0000\Ob
 
                                         r e c i p r o c a l   =   1 . 0   /   i _ x d i v 2 ; 
 
                                         f o r   ( i   =   x d i v   -   1 ;   i   > =   0 ;   i - - ) 
 
                                         { 
 
                                                 x w [ i ]   =   L T _ P O S   +   S Q _ S I Z E   *   ( i x   *   x d i v   +   i   +   0 . 5 )   *   r e c i p r o c a l ; 
 
                                         } 
 
                                         r e c i p r o c a l   =   1 . 0   /   i _ y d i v 2 ; 
 
                                         f o r   ( i   =   y d i v   -   1 ;   i   > =   0 ;   i - - ) 
 
                                         { 
 
                                                 y w [ i ]   =   L T _ P O S   +   S Q _ S I Z E   *   ( i y   *   y d i v   +   i   +   0 . 5 )   *   r e c i p r o c a l ; 
 
                                         } 
 
                                         / / 1 00000ibY000000^jn0ƖT0x c , y c MRk0S_
 
                                         i n t   n u m b e r _ o f _ p i x   =   0 ; 
 
                                         f o r   ( i   =   y d i v   -   1 ;   i   > =   0 ;   i - - ) 
 
                                         { 
 
                                                 d o u b l e   p a r a 0 1 _ x _ y w _ p a r a 0 2   =   p a r a 0 1   *   y w [ i ]   +   p a r a 0 2 ; 
 
                                                 d o u b l e   p a r a 1 1 _ x _ y w _ p a r a 1 2   =   p a r a 1 1   *   y w [ i ]   +   p a r a 1 2 ; 
 
                                                 d o u b l e   p a r a 1 2 _ x _ y w _ p a r a 2 2   =   p a r a 2 1   *   y w [ i ]   +   1 . 0 ; 
 
                                                 f o r   ( j   =   x d i v   -   1 ;   j   > =   0 ;   j - - ) 
 
                                                 { 
 
 
 
                                                         d o u b l e   d   =   p a r a 2 0   *   x w [ j ]   +   p a r a 1 2 _ x _ y w _ p a r a 2 2 ; 
 
                                                         i f   ( d   = =   0 ) 
 
                                                         { 
 
                                                                 t h r o w   n e w   N y A R E x c e p t i o n ( ) ; 
 
                                                         } 
 
                                                         i n t   x c w   =   ( i n t ) ( ( p a r a 0 0   *   x w [ j ]   +   p a r a 0 1 _ x _ y w _ p a r a 0 2 )   /   d ) ; 
 
                                                         i n t   y c w   =   ( i n t ) ( ( p a r a 1 0   *   x w [ j ]   +   p a r a 1 1 _ x _ y w _ p a r a 1 2 )   /   d ) ; 
 
                                                         i f   ( x c w   <   0   | |   x c w   > =   i m g _ w i d t h   | |   y c w   <   0   | |   y c w   > =   i m g _ h e i g h t ) 
 
                                                         { 
 
                                                                 c o n t i n u e ; 
 
                                                         } 
 
                                                         x c [ n u m b e r _ o f _ p i x ]   =   x c w ; 
 
                                                         y c [ n u m b e r _ o f _ p i x ]   =   y c w ; 
 
                                                         n u m b e r _ o f _ p i x + + ; 
 
                                                 } 
 
                                         } 
 
                                         / / 1 0000Rn0MR0S_
 
                                         r e a d e r . g e t P i x e l S e t ( x c ,   y c ,   n u m b e r _ o f _ p i x ,   r g b _ s e t ) ; 
 
                                         r   =   g   =   b   =   0 ; 
 
                                         f o r   ( i   =   n u m b e r _ o f _ p i x   *   3   -   1 ;   i   > =   0 ;   i   - =   3 ) 
 
                                         { 
 
                                                 r   + =   r g b _ s e t [ i   -   2 ] ; / /   R 
 
                                                 g   + =   r g b _ s e t [ i   -   1 ] ; / /   G 
 
                                                 b   + =   r g b _ s e t [ i ] ; / /   B 
 
                                         } 
 
                                         / / 1 0000x[
 
                                         t h i s . _ p a t d a t a [ i y   *   p a t _ s i z e _ w   +   i x ]   =   ( ( ( r   /   x d i v _ x _ y d i v )   &   0 x f f )   < <   1 6 )   |   ( ( ( g   /   x d i v _ x _ y d i v )   &   0 x f f )   < <   8 )   |   ( ( ( b   /   x d i v _ x _ y d i v )   &   0 x f f ) ) ; 
 
                                 } 
 
                         } 
 
                         r e t u r n ; 
 
                 } 
 
         } 
 
 } 