/ *   
 
   *   P R O J E C T :   N y A R T o o l k i t C S ( E x t e n s i o n ) 
 
   *   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
   *   T h e   N y A R T o o l k i t C S   i s   C #   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 > 
 
   *   
 
   * / 
 
 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   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   j p . n y a t l a . n y a r t o o l k i t . c s . r p f 
 
 { 
 
         / * * 
 
           *   N y A R T r a c k e r S o u r c e n0000000[ňg0Y00
 
           *   hQf0n0;uPQt0Qt|n0000000g0[ňW0~0Y00
 
           * / 
 
         p u b l i c   c l a s s   N y A R T r a c k e r S o u r c e _ R e f e r e n c e   :   N y A R T r a c k e r S o u r c e 
 
         { 
 
 	         / * * 
 
 	           *   SR o b e r t s F i l t e r ;uPn0000000
 
 	           * / 
 
 	         p r i v a t e   L o w R e s o l u t i o n L a b e l i n g S a m p l e r   _ s a m p l e r ; 
 
 	         p r i v a t e   N y A R G r a y s c a l e R a s t e r   _ r b _ s o u r c e ; 
 
 	         p r i v a t e   N e g a t i v e S q R o b e r t s   _ r f i l t e r = n e w   N e g a t i v e S q R o b e r t s ( N y A R B u f f e r T y p e . I N T 1 D _ G R A Y _ 8 ) ; 
 
                 p r i v a t e   I N y A R G s R a s t e r G r a p h i c s   _ g s _ g r a p h i c s ; 
 
 	         / * * 
 
 	           *   @ p a r a m   i _ n u m b e r _ o f _ s a m p l e 
 
 	           *   0000L0iQY00 g'Ype0
 
 	           *  08^1 0 0 ~ 2 0 0 N
N0c[W0~0Y00( Q V G A ;uPB0_0001 0 0 P0Wnk0W0~0Y00) 
 
 	           *   peL0\j0Y0N00h00iQsL0NONW0~0Y00 gNOg000N y A R T r a c k e r k0-[Y0000000pen0T* 2 N
N0c[W0f0O0`0U0D00
 
 	           *   @ p a r a m   i _ r e f _ r a s t e r _ d i s t o r t i o n 
 
 	           *   jk0wckn0pn00000000c[W0~0Y00jk0wckL0_j0D0Bfo00N U L L 0c[W0~0Y00
 
 	           *   @ p a r a m   i _ w i d t h 
 
 	           *   000;uPn0000
 
 	           *   @ p a r a m   i _ h e i g h t 
 
 	           *   000;uPn0000
 
 	           *   @ p a r a m   i _ d e p t h 
 
 	           *   P^n0mU0( 1 / ( 2 ^ n ) ) 
Pn0;uPh0W0f0QtY000
 
 	           *   @ p a r a m   i _ i s _ a l l o c 
 
 	           *   000000n000000Q萺xOYSgqk0Y00K0n0000g0Y00
 
 	           *   t r u e n04XT00000o0Qk0xOU000{ @ l i n k   # w r a p B u f f e r } peL0O(ug0M0j0O0j00~0Y00
 
 	           *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	           * / 
 
                 p u b l i c   N y A R T r a c k e r S o u r c e _ R e f e r e n c e ( i n t   i _ n u m b e r _ o f _ s a m p l e ,   I N y A R C a m e r a D i s t o r t i o n F a c t o r   i _ r e f _ r a s t e r _ d i s t o r t i o n ,   i n t   i _ w i d t h ,   i n t   i _ h e i g h t ,   i n t   i _ d e p t h ,   b o o l   i _ i s _ a l l o c ) 
 
                         :   b a s e ( ( i n t ) M a t h . P o w ( 2 ,   i _ d e p t h ) ) 
 
 	         { 
 
 	 	         D e b u g . A s s e r t ( i _ d e p t h > 0 ) ; 
 
 	 	         i n t   d i v = t h i s . _ r o b _ r e s o l u t i o n ; 
 
 	 	         / / ;NG S 000
 
 	 	         t h i s . _ b a s e _ r a s t e r = n e w   N y A R G r a y s c a l e R a s t e r ( i _ w i d t h , i _ h e i g h t , 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 _ i s _ a l l o c ) ; 
 
                         t h i s . _ g s _ g r a p h i c s   =   N y A R G s R a s t e r G r a p h i c s F a c t o r y . c r e a t e D r i v e r ( t h i s . _ b a s e _ r a s t e r ) ; 
 
                         / / R o b e r t s 	Yc000
 
 	 	         t h i s . _ r b _ s o u r c e = n e w   N y A R G r a y s c a l e R a s t e r ( i _ w i d t h / d i v , i _ h e i g h t / d i v , N y A R B u f f e r T y p e . I N T 1 D _ G R A Y _ 8 ,   t r u e ) ; 
 
 	 	         / / R o b e r t s 000o0 g0P^n0NOD0000h0TX0
 
 	 	         t h i s . _ r b r a s t e r = n e w   N y A R G r a y s c a l e R a s t e r ( i _ w i d t h / d i v , i _ h e i g h t / d i v , N y A R B u f f e r T y p e . I N T 1 D _ G R A Y _ 8 ,   t r u e ) ; 
 
 	 	         t h i s . _ v e c _ r e a d e r = n e w   N y A R V e c t o r R e a d e r _ I N T 1 D _ G R A Y _ 8 ( t h i s . _ b a s e _ r a s t e r , i _ r e f _ r a s t e r _ d i s t o r t i o n , t h i s . _ r b r a s t e r ) ; 
 
 	 	         / / s a m p l e r h0s a m p l e o u t 
 
 	 	         t h i s . _ s a m p l e r = n e w   L o w R e s o l u t i o n L a b e l i n g S a m p l e r ( i _ w i d t h ,   i _ h e i g h t , ( i n t ) M a t h . P o w ( 2 , i _ d e p t h ) ) ; 
 
 	 	         t h i s . _ s a m p l e _ o u t = n e w   L o w R e s o l u t i o n L a b e l i n g S a m p l e r O u t ( i _ n u m b e r _ o f _ s a m p l e ) ; 
 
 	         } 
 
 	         / * * 
 
 	           *   G S ;uP0000W0~0Y00
 
 	           *   S0n0pe0Oc0f0000W0_0;uPo00000000K00SgqU00~0Y00
 
 	           *   @ p a r a m   i _ r e f _ s o u r c e 
 
 	           *   @ t h r o w s   N y A R E x c e p t i o n   
 
 	           * / 
 
 	         p u b l i c   v o i d   w r a p B u f f e r ( N y A R G r a y s c a l e R a s t e r   i _ r e f _ s o u r c e ) 
 
 	         { 
 
 	 	         / / 0000n00000
 
 	 	         t h i s . _ b a s e _ r a s t e r . w r a p B u f f e r ( i _ r e f _ s o u r c e . g e t B u f f e r ( ) ) ; 
 
 	         } 
 
 
 
 
 
 	         p u b l i c   o v e r r i d e   v o i d   s y n c R e s o u r c e ( ) 
 
 	         { 
 
 	 	         / / Q萶rKan0Tg
 
                         t h i s . _ g s _ g r a p h i c s . c o p y T o ( 0 ,   0 ,   t h i s . _ r o b _ r e s o l u t i o n ,   t h i s . _ r b _ s o u r c e ) ; 
 
                         t h i s . _ r f i l t e r . d o F i l t e r ( t h i s . _ r b _ s o u r c e ,   t h i s . _ r b r a s t e r ) ; 
 
 	         } 
 
 	         / * * 
 
 	           *   S a m p l e O u t 0{W0f0ԏW0~0Y00
 
 	           *   S0n0peo00N y A R T r a c k e r L0|Ts0QW0~0Y00
 
 	           *   @ p a r a m   s a m p l e r o u t 
 
 	           *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	           * / 
 
 	         p u b l i c   o v e r r i d e   L o w R e s o l u t i o n L a b e l i n g S a m p l e r O u t   m a k e S a m p l e O u t ( ) 
 
 	         { 
 
 	 	         s y n c R e s o u r c e ( ) ; 
 
 	 	         / / weE\$PRteo0]0n0F0a0m00
 
 	 	         t h i s . _ s a m p l e r . s a m p l i n g ( t h i s . _ r b r a s t e r , 2 2 0 , t h i s . _ s a m p l e _ o u t ) ; 
 
 	 	         r e t u r n   t h i s . _ s a m p l e _ o u t ; 
 
 	         } 
 
         	 
 
 
 
         } 
 
 } 