UWECImage - acnelson12/CS-335-Algorithms GitHub Wiki
The UWECImage class was provided by the professor for the assignment; however, I have made modifications to it.
transpose
As suggested by the specifications, a method for image transposition was added to this class. Originally, I had made this method part of the Seam class, but BufferedImage
has a method called getRGB
which makes retrieving color values much more efficient and also faster. It also has a similar method called setRGB
which has similar benefits. Since the BufferedImage
that is wrapped by the UWECImage
class is declared as private, the only way to access its methods is by moving this method into the UWECImage
class. It should be noted that the setRGB
method provided by BufferedImage
differs from the setRGB
method provided by UWECImage
in that it accepts a color as a single int
rather than three separate int
s.
shrinkImage
This method was also originally a part of the Seam class, but it was moved to UWECImage
to take advantage of the speed benefits provided by BufferedImage
’s getRGB
and setRGB
methods. Its purpose is to remove a provided seam from the image.
write
The write
method was rewritten to allow writing images to formats other than PNG. It now can write images in any format that ImageIO
will allow. If an unsupported file type is entered, it will pull up a dialog box allowing the user to select a format of BMP, GIF, JPG, or PNG.