private void calcCoordinates(){
  if ((CTM[1][0] == 0) & ((CTM[0][1] == 0))) {
    i_x=(int)CTM[2][0];
    i_y=(int)CTM[2][1];
    i_w=(int)CTM[0][0];
    i_h=(int)CTM[1][1];
    if (i_w < 0) {
      i_w=-i_w;
    }
    if (i_h < 0) {
      i_h=-i_h;
    }
  }
 else {
    i_w=(int)(Math.sqrt((CTM[0][0] * CTM[0][0]) + (CTM[0][1] * CTM[0][1])));
    i_h=(int)(Math.sqrt((CTM[1][1] * CTM[1][1]) + (CTM[1][0] * CTM[1][0])));
    if ((CTM[1][0] > 0) & (CTM[0][1] < 0)) {
      i_x=(int)(CTM[2][0]);
      i_y=(int)(CTM[2][1] + CTM[0][1]);
    }
 else     if ((CTM[1][0] < 0) & (CTM[0][1] > 0)) {
      i_x=(int)(CTM[2][0] + CTM[1][0]);
      i_y=(int)(CTM[2][1]);
    }
 else     if ((CTM[1][0] > 0) & (CTM[0][1] > 0)) {
      i_x=(int)(CTM[2][0]);
      i_y=(int)(CTM[2][1]);
    }
 else {
      i_x=(int)(CTM[2][0]);
      i_y=(int)(CTM[2][1]);
    }
  }
  if (CTM[1][1] < 0) {
    i_y-=i_h;
  }
  if (CTM[0][0] < 0) {
    i_x-=i_w;
  }
}

private void calcCoordinates ( ) { if ( ( CTM [ 1 ] [ 0 ] == 0 ) & ( ( CTM [ 0 ] [ 1 ] == 0 ) ) ) { i_x = ( int ) CTM [ 2 ] [ 0 ] ; i_y = ( int ) CTM [ 2 ] [ 1 ] ; i_w = ( int ) CTM [ 0 ] [ 0 ] ; i_h = ( int ) CTM [ 1 ] [ 1 ] ; if ( i_w < 0 ) { i_w = - i_w ; } if ( i_h < 0 ) { i_h = - i_h ; } } else { i_w = ( int ) ( Math . sqrt ( ( CTM [ 0 ] [ 0 ] * CTM [ 0 ] [ 0 ] ) + ( CTM [ 0 ] [ 1 ] * CTM [ 0 ] [ 1 ] ) ) ) ; i_h = ( int ) ( Math . sqrt ( ( CTM [ 1 ] [ 1 ] * CTM [ 1 ] [ 1 ] ) + ( CTM [ 1 ] [ 0 ] * CTM [ 1 ] [ 0 ] ) ) ) ; if ( ( CTM [ 1 ] [ 0 ] > 0 ) & ( CTM [ 0 ] [ 1 ] < 0 ) ) { i_x = ( int ) ( CTM [ 2 ] [ 0 ] ) ; i_y = ( int ) ( CTM [ 2 ] [ 1 ] + CTM [ 0 ] [ 1 ] ) ; } else if ( ( CTM [ 1 ] [ 0 ] < 0 ) & ( CTM [ 0 ] [ 1 ] > 0 ) ) { i_x = ( int ) ( CTM [ 2 ] [ 0 ] + CTM [ 1 ] [ 0 ] ) ; i_y = ( int ) ( CTM [ 2 ] [ 1 ] ) ; } else if ( ( CTM [ 1 ] [ 0 ] > 0 ) & ( CTM [ 0 ] [ 1 ] > 0 ) ) { i_x = ( int ) ( CTM [ 2 ] [ 0 ] ) ; i_y = ( int ) ( CTM [ 2 ] [ 1 ] ) ; } else { i_x = ( int ) ( CTM [ 2 ] [ 0 ] ) ; i_y = ( int ) ( CTM [ 2 ] [ 1 ] ) ; } } if ( CTM [ 1 ] [ 1 ] < 0 ) { i_y -= i_h ; } if ( CTM [ 0 ] [ 0 ] < 0 ) { i_x -= i_w ; } }
workout correct screen co - ords allow for rotation
