protected void findBounds(int w,int h)
   {
     // top line
     for ( int y=0;y<h;y++ ) {
       if ( !hLineClear(y) ) {
         downSampleTop=y;
         break;
       }

     }
     // bottom line
     for ( int y=h-1;y>=0;y-- ) {
       if ( !hLineClear(y) ) {
         downSampleBottom=y;
         break;
       }
     }
     // left line
     for ( int x=0;x<w;x++ ) {
       if ( !vLineClear(x) ) {
         downSampleLeft = x;
         break;
       }
     }

     // right line
     for ( int x=w-1;x>=0;x-- ) {
       if ( !vLineClear(x) ) {
         downSampleRight = x;
         break;
       }
     }
   }