Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ccl.swing
Class GraphicsUtil

    java.lang.Object
      |
      +--ccl.swing.GraphicsUtil

public class GraphicsUtil
extends java.lang.Object

Support class for graphics stuff, like for example saving jpeg images.

Method Summary
`static java.awt.image.BufferedImage` | `componentToImage(java.awt.Component component, java.awt.Container container)` Creates an image of the component.
`static java.awt.image.BufferedImage` | `createBufferedImage(java.awt.Image image)` Creates a buffered image out of the given image.
`static java.awt.image.BufferedImage` | `crop(java.awt.image.BufferedImage bufferedImage, int x, int y, int width, int height)` Creates a new buffer image by cropping out a part of the given image.
`static java.awt.image.BufferedImage` | `crop(java.awt.Image image, int x, int y, int width, int height)` Creates a new buffer image by cropping out a part of the given image.
`static boolean` | `equals(java.awt.image.BufferedImage imageA, java.awt.image.BufferedImage imageB)` Compares two images pixel by pixel.
`static boolean` | `equals(javax.swing.ImageIcon iconA, javax.swing.ImageIcon iconB)` Compares two images pixel by pixel.
`static boolean` | `equals(java.awt.Image imageA, java.awt.Image imageB)` Compares two images pixel by pixel.
`static void` | `saveComponentAsJpeg(java.lang.String filename, java.awt.Component component, java.awt.Container container)` Deprecated. #saveComponentAsJPEG
`static void` | `saveComponentAsJPEG(java.lang.String filename, java.awt.Component component, java.awt.Container container)` Creates an image of the component and saves it in jpeg format.
`static void` | `saveImageAsGIF(java.lang.String filename, java.awt.image.BufferedImage image)` Saves a buffered image as a gif file.
`static void` | `saveImageAsGIF(java.lang.String filename, java.awt.Image image)` Saves image object as gif file.
`static void` | `saveImageAsJpeg(java.lang.String filename, java.awt.image.BufferedImage bufferedImage)` Deprecated. #saveImageAsJPEG
`static void` | `saveImageAsJPEG(java.lang.String filename, java.awt.image.BufferedImage bufferedImage)` Saves image object as jpeg file.
`static void` | `saveImageAsJpeg(java.lang.String filename, java.awt.Image image)` Deprecated. #saveImageAsJPEG
`static void` | `saveImageAsJPEG(java.lang.String filename, java.awt.Image image)` Saves image object as jpeg file.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### saveImageAsJpeg

    public static void saveImageAsJpeg(java.lang.String filename,
                                       java.awt.Image image)
                                throws java.io.IOException

  Deprecated. #saveImageAsJPEG

  Saves image object as jpeg file.

  Thanks to Marco Schmidt for his example code.

    `java.io.IOException`

### saveImageAsJPEG

    public static void saveImageAsJPEG(java.lang.String filename,
                                       java.awt.Image image)
                                throws java.io.IOException

  Saves image object as jpeg file.

  Thanks to Marco Schmidt for his example code.

    `java.io.IOException`

### saveImageAsJpeg

    public static void saveImageAsJpeg(java.lang.String filename,
                                       java.awt.image.BufferedImage bufferedImage)
                                throws java.io.IOException

  Deprecated. #saveImageAsJPEG

  Saves image object as jpeg file.

  Thanks to Marco Schmidt for his example code.

    `java.io.IOException`

### saveImageAsJPEG

    public static void saveImageAsJPEG(java.lang.String filename,
                                       java.awt.image.BufferedImage bufferedImage)
                                throws java.io.IOException

  Saves image object as jpeg file.

  Thanks to Marco Schmidt for his example code.

    `java.io.IOException`

### saveComponentAsJpeg

    public static void saveComponentAsJpeg(java.lang.String filename,
                                           java.awt.Component component,
                                           java.awt.Container container)
                                    throws java.io.IOException

  Deprecated. #saveComponentAsJPEG

  Creates an image of the component and saves it in jpeg format.

  Taken from Lawrence H. Rodrigues: Building Imaging Applications with Java Technology.

    `java.io.IOException`

### saveComponentAsJPEG

    public static void saveComponentAsJPEG(java.lang.String filename,
                                           java.awt.Component component,
                                           java.awt.Container container)
                                    throws java.io.IOException

  Creates an image of the component and saves it in jpeg format.

  Taken from Lawrence H. Rodrigues: Building Imaging Applications with Java Technology.

    `java.io.IOException`

### componentToImage

    public static java.awt.image.BufferedImage componentToImage(java.awt.Component component,
                                                                java.awt.Container container)
                                                         throws java.io.IOException

  Creates an image of the component.

  Parameters:
    `container` - e.g. jframe.getContentPane().
    `java.io.IOException`

### crop

    public static java.awt.image.BufferedImage crop(java.awt.Image image,
                                                    int x,
                                                    int y,
                                                    int width,
                                                    int height)

  Creates a new buffer image by cropping out a part of the given image.

### crop

    public static java.awt.image.BufferedImage crop(java.awt.image.BufferedImage bufferedImage,
                                                    int x,
                                                    int y,
                                                    int width,
                                                    int height)

  Creates a new buffer image by cropping out a part of the given image.

### saveImageAsGIF

    public static void saveImageAsGIF(java.lang.String filename,
                                      java.awt.image.BufferedImage image)
                               throws java.io.IOException

  Saves a buffered image as a gif file.

  Parameters:
    `filename` - the file name will be normalized, which means the current user dir will be taken into account if necessary.
  Throws:
    `java.io.IOException` - if writing the file fails.

### saveImageAsGIF

    public static void saveImageAsGIF(java.lang.String filename,
                                      java.awt.Image image)
                               throws java.io.IOException

  Saves image object as gif file.

  Parameters:
    `filename` - the file name will be normalized, which means the current user dir will be taken into account if necessary. Thanks to Marco Schmidt for his example code.
    `java.io.IOException`

### createBufferedImage

    public static java.awt.image.BufferedImage createBufferedImage(java.awt.Image image)

  Creates a buffered image out of the given image.

  Returns:
    returns always a new buffered image.

### equals

    public static boolean equals(javax.swing.ImageIcon iconA,
                                 javax.swing.ImageIcon iconB)

  Compares two images pixel by pixel. At the current state, no special consideration for transparency is taken into account.

  Returns:
    true if all pixels equal each other in both images.

### equals

    public static boolean equals(java.awt.Image imageA,
                                 java.awt.Image imageB)

  Compares two images pixel by pixel. At the current state, no special consideration for transparency is taken into account.

  Returns:
    true if all pixels equal each other in both images.

### equals

    public static boolean equals(java.awt.image.BufferedImage imageA,
                                 java.awt.image.BufferedImage imageB)

  Compares two images pixel by pixel. At the current state, no special consideration for transparency is taken into account. Be aware that transient images might show black pixels where you don't expect them.

  Returns:
    true if all pixels equal each other in both images.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD