Class Scale

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--Scale

public class Scale
extends java.lang.Thread

Scale is an algorithm to alter the size of an image

See Also:
code.iface.scale

Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Scale()
           
 
Method Summary
 int[] getrect(int[] src, int src_width, int x, int y, int width, int height)
          Give an image of width src_width contained in int array src returns the rectangle with top left corner at x,y and with width width and height height contained in that image as an int array
 int[] grow_interpolate(int[] src, int orig_w, int orig_h, int scalefactor)
          Grows an image by a factor of scalefactor using the interpolate method
 int[] grow_replicate(int[] src, int orig_w, int orig_h, int scalefactor)
          Grows an image by a factor of scalefactor using the replicate method
 int[] shrink_average(int[] src, int orig_w, int orig_h, int scalefactor)
          Reduces an image by a factor of scalefactor using the average method
 int[] shrink_sample(int[] src, int orig_w, int orig_h, int scalefactor)
          Reduces an image by a factor of scalefactor using the sample method
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Scale

public Scale()
Method Detail

getrect

public int[] getrect(int[] src,
                     int src_width,
                     int x,
                     int y,
                     int width,
                     int height)
Give an image of width src_width contained in int array src returns the rectangle with top left corner at x,y and with width width and height height contained in that image as an int array
Parameters:
src - The input image array
src_width - The width of the input image array
x - The x co-ordinate of the top left corner of the rectangle
y - The y co-ordinate of the top left corner of the rectangle
width - The width of the rectangle
height - The height of the rectangle
Returns:
The rectangle taken from the image

shrink_sample

public int[] shrink_sample(int[] src,
                           int orig_w,
                           int orig_h,
                           int scalefactor)
Reduces an image by a factor of scalefactor using the sample method
Parameters:
src - The input image array
orig_w - The width of the input image
orig_h - The height of the input image
scalefactor - The amount the image is to be shrunk
Returns:
The shrunken image array

shrink_average

public int[] shrink_average(int[] src,
                            int orig_w,
                            int orig_h,
                            int scalefactor)
Reduces an image by a factor of scalefactor using the average method
Parameters:
src - The input image array
orig_w - The width of the input image
orig_h - The height of the input image
scalefactor - The amount the image is to be shrunk
Returns:
The shrunken image array

grow_replicate

public int[] grow_replicate(int[] src,
                            int orig_w,
                            int orig_h,
                            int scalefactor)
Grows an image by a factor of scalefactor using the replicate method
Parameters:
src - The input image array
orig_w - The width of the input image
orig_h - The height of the input image
scalefactor - The amount the image is to be grown
Returns:
The grown image array

grow_interpolate

public int[] grow_interpolate(int[] src,
                              int orig_w,
                              int orig_h,
                              int scalefactor)
Grows an image by a factor of scalefactor using the interpolate method
Parameters:
src - The input image array
orig_w - The width of the input image
orig_h - The height of the input image
scalefactor - The amount the image is to be grown
Returns:
The grown image array