Package tools

Class Scale2x

java.lang.Object
tools.Scale2x

public class Scale2x
extends java.lang.Object
Created by IntelliJ IDEA. User: Sergey Karakovskiy, sergey.karakovskiy@gmail.com Date: Oct 6, 2010 Time: 10:27:47 PM Package: ch.idsia.tools
  • Constructor Summary

    Constructors 
    Constructor Description
    Scale2x​(int width, int height)
    Creates a new Scale2x object.
  • Method Summary

    Modifier and Type Method Description
    java.awt.Image scale​(java.awt.Image img)
    Scales an image and returns a twice as large image.
    This assumes the input image is of the dimensions specified in the Scale2x constructor.
    The returned image is a reference to the internal scale target in this Scale2x, so it will get changed if you call this method again, so don't hold on to it for too long.
    In other words:
    Image i0 = scale2x.scale(image0);
    Image i1 = scale2x.scale(image1);
    if (i0 == i1) System.exit(0); // Will always terminate

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Scale2x

      public Scale2x​(int width, int height)
      Creates a new Scale2x object. The new object will scale images of the specified size to images that are twice as large.
      Parameters:
      width - The width of the images to be scaled
      height - The height of the images to be scaled
  • Method Details

    • scale

      public java.awt.Image scale​(java.awt.Image img)
      Scales an image and returns a twice as large image.
      This assumes the input image is of the dimensions specified in the Scale2x constructor.
      The returned image is a reference to the internal scale target in this Scale2x, so it will get changed if you call this method again, so don't hold on to it for too long.
      In other words:
      Image i0 = scale2x.scale(image0);
      Image i1 = scale2x.scale(image1);
      if (i0 == i1) System.exit(0); // Will always terminate

      Parameters:
      img - The image to be scaled