question: private static Shape leftEdge ( BufferedImage image , GeneralPath path ) { int lastj = 0 ; Point2D p1 = null ; Point2D p2 = null ; Line2D line = new Line2D . Float ( ) ; for ( int i = 0 ; i < image . getHeight ( ) ; i += sample ) { boolean aPointExistsOnThisLine = false ; for ( int j = 0 ; j < image . getWidth ( ) ; j += sample ) { if ( ( image . getRGB ( j , i ) & 0xff000000 ) != 0 ) { Point2D p = new Point2D . Float ( j , i ) ; aPointExistsOnThisLine = true ; if ( path . getCurrentPoint ( ) != null ) { p2 = detectLine ( p1 , p2 , p , line , path ) ; } else { path . moveTo ( j , i ) ; firstx = j ; p1 = p ; } lastj = j ; break ; } } if ( aPointExistsOnThisLine == false ) { break ; } } return bottomEdge ( image , path , lastj ) ; }
target:  trace the left side of the image