Exemplo n.º 1
0
 /**
  * Replaces the inner image with a new one with the specified size.
  *
  * @param width The width of the new image
  * @param height The height of the new image.
  */
 public void resizeImage(int width, int height) {
   int oldWidth = getWidth();
   int oldHeight = getHeight();
   // image = new BufferedImage(width, height,
   // BufferedImage.TYPE_INT_ARGB);
   GraphicsConfiguration configuration =
       GraphicsEnvironment.getLocalGraphicsEnvironment()
           .getDefaultScreenDevice()
           .getDefaultConfiguration();
   image = configuration.createCompatibleImage(width, height, BufferedImage.TYPE_INT_ARGB);
   calculateAffineTransform();
   for (TransformListener listener : listeners) {
     listener.imageSizeChanged(oldWidth, oldHeight, this);
   }
 }
Exemplo n.º 2
0
 /**
  * Sets the extent of the transformation. This extent is not used directly to calculate the
  * transformation but is adjusted to obtain an extent with the same ratio than the image
  *
  * @param newExtent The new base extent.
  */
 public void setExtent(Envelope newExtent) {
   if ((newExtent != null) && ((newExtent.getWidth() == 0) || (newExtent.getHeight() == 0))) {
     newExtent.expandBy(10);
   }
   Envelope oldExtent = this.extent;
   boolean modified = true;
   /* Set extent when Envelope is modified */
   if (extent != null) {
     if (extent.equals(newExtent)) {
       modified = false;
     }
   }
   if (modified) {
     this.extent = newExtent;
     calculateAffineTransform();
     for (TransformListener listener : listeners) {
       listener.extentChanged(oldExtent, this);
     }
   }
 }
Exemplo n.º 3
0
 public void redraw() {
   for (TransformListener listener : listeners) {
     listener.extentChanged(this.adjustedExtent, this);
   }
 }