public ImageTransformer(final GraphicsState current_graphics_state,final BufferedImage new_image){
  this.current_image=new_image;
  final int w=current_image.getWidth();
  final int h=current_image.getHeight();
  CTM=current_graphics_state.CTM;
  Trm=new float[3][3];
  Trm[0][0]=(CTM[0][0] / w);
  Trm[0][1]=-(CTM[0][1] / w);
  Trm[0][2]=0;
  Trm[1][0]=-(CTM[1][0] / h);
  Trm[1][1]=(CTM[1][1] / h);
  Trm[1][2]=0;
  Trm[2][0]=CTM[2][0];
  Trm[2][1]=CTM[2][1];
  Trm[2][2]=1;
  for (int y=0; y < 3; y++) {
    for (int x=0; x < 3; x++) {
      if ((Trm[x][y] > .99) & (Trm[x][y] < 1)) {
        Trm[x][y]=1;
      }
    }
  }
  scale(w,h);
  calcCoordinates();
}

public ImageTransformer ( final GraphicsState current_graphics_state , final BufferedImage new_image ) { this . current_image = new_image ; final int w = current_image . getWidth ( ) ; final int h = current_image . getHeight ( ) ; CTM = current_graphics_state . CTM ; Trm = new float [ 3 ] [ 3 ] ; Trm [ 0 ] [ 0 ] = ( CTM [ 0 ] [ 0 ] / w ) ; Trm [ 0 ] [ 1 ] = - ( CTM [ 0 ] [ 1 ] / w ) ; Trm [ 0 ] [ 2 ] = 0 ; Trm [ 1 ] [ 0 ] = - ( CTM [ 1 ] [ 0 ] / h ) ; Trm [ 1 ] [ 1 ] = ( CTM [ 1 ] [ 1 ] / h ) ; Trm [ 1 ] [ 2 ] = 0 ; Trm [ 2 ] [ 0 ] = CTM [ 2 ] [ 0 ] ; Trm [ 2 ] [ 1 ] = CTM [ 2 ] [ 1 ] ; Trm [ 2 ] [ 2 ] = 1 ; for ( int y = 0 ; y < 3 ; y ++ ) { for ( int x = 0 ; x < 3 ; x ++ ) { if ( ( Trm [ x ] [ y ] > .99 ) & ( Trm [ x ] [ y ] < 1 ) ) { Trm [ x ] [ y ] = 1 ; } } } scale ( w , h ) ; calcCoordinates ( ) ; }
pass in image information and apply transformation matrix to image
