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

## org.apache.fop.util.bitmap
Class BitmapImageUtil

    java.lang.Object
      org.apache.fop.util.bitmap.BitmapImageUtil

public class BitmapImageUtil
extends java.lang.Object

Utility method for dealing with bitmap images.

Constructor Summary
`BitmapImageUtil()`

Method Summary
`static int` | `convertToGray(int rgb)` Convert an RGB color value to a grayscale from 0 to 100.
`static int` | `convertToGray(int r, int g, int b)` Convert an RGB color value to a grayscale from 0 to 100.
`static java.awt.image.BufferedImage` | `convertToGrayscale(java.awt.image.RenderedImage img, java.awt.Dimension targetDimension)` Converts an image to a grayscale (8 bits) image.
`static java.awt.image.BufferedImage` | `convertToMonochrome(java.awt.image.RenderedImage img, java.awt.Dimension targetDimension)` Converts an image to a monochrome 1-bit image.
`static java.awt.image.RenderedImage` | `convertToMonochrome(java.awt.image.RenderedImage img, java.awt.Dimension targetDimension, float quality)` Converts an image to a monochrome 1-bit image.
`static java.awt.image.BufferedImage` | `convertTosRGB(java.awt.image.RenderedImage img, java.awt.Dimension targetDimension)` Converts an image to sRGB.
`static MonochromeBitmapConverter` | `createDefaultMonochromeBitmapConverter()`
`static int` | `getColorIndexSize(java.awt.image.RenderedImage img)` Returns the size of the color index if the given image has one.
`static boolean` | `isGrayscaleImage(java.awt.image.RenderedImage img)` Indicates whether an image is a grayscale image.
`static boolean` | `isMonochromeImage(java.awt.image.RenderedImage img)` Indicates whether an image is a monochrome (1 bit black and white) image.
`static boolean` | `isZeroBlack(java.awt.image.RenderedImage img)` Indicates whether a zero bit indicates a black/dark pixel for a monochrome image.
`static java.awt.image.BufferedImage` | `toBufferedImage(java.awt.image.RenderedImage img)` Returns a BufferedImage based on the given RenderedImage.

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

Constructor Detail

### BitmapImageUtil

    public BitmapImageUtil()

Method Detail

### isMonochromeImage

    public static final boolean isMonochromeImage(java.awt.image.RenderedImage img)

  Indicates whether an image is a monochrome (1 bit black and white) image.

  Parameters:
    `img` - the image
  Returns:
    true if it's a monochrome image

### isZeroBlack

    public static final boolean isZeroBlack(java.awt.image.RenderedImage img)

  Indicates whether a zero bit indicates a black/dark pixel for a monochrome image.

  Parameters:
    `img` - the image (must be 1 bit monochrome)
  Returns:
    true if a zero bit indicates a black/dark pixel, false for a white/bright pixel

### convertToGray

    public static final int convertToGray(int r,
                                          int g,
                                          int b)

  Convert an RGB color value to a grayscale from 0 to 100.

  Parameters:
    `r` - the red component
    `g` - the green component
    `b` - the blue component
  Returns:
    the gray value

### convertToGray

    public static final int convertToGray(int rgb)

  Convert an RGB color value to a grayscale from 0 to 100.

  Parameters:
    `rgb` - the RGB value
  Returns:
    the gray value

### getColorIndexSize

    public static final int getColorIndexSize(java.awt.image.RenderedImage img)

  Returns the size of the color index if the given image has one.

  Parameters:
    `img` - the image
  Returns:
    the size of the color index or 0 if there's no color index

### isGrayscaleImage

    public static final boolean isGrayscaleImage(java.awt.image.RenderedImage img)

  Indicates whether an image is a grayscale image.

  Parameters:
    `img` - the image
  Returns:
    true if it's a grayscale image

### convertTosRGB

    public static final java.awt.image.BufferedImage convertTosRGB(java.awt.image.RenderedImage img,
                                                                   java.awt.Dimension targetDimension)

  Converts an image to sRGB. Optionally, the image can be scaled.

  Parameters:
    `img` - the image to be converted
    `targetDimension` - the new target dimensions or null if no scaling is necessary
  Returns:
    the sRGB image

### convertToGrayscale

    public static final java.awt.image.BufferedImage convertToGrayscale(java.awt.image.RenderedImage img,
                                                                        java.awt.Dimension targetDimension)

  Converts an image to a grayscale (8 bits) image. Optionally, the image can be scaled.

  Parameters:
    `img` - the image to be converted
    `targetDimension` - the new target dimensions or null if no scaling is necessary
  Returns:
    the grayscale image

### convertToMonochrome

    public static final java.awt.image.BufferedImage convertToMonochrome(java.awt.image.RenderedImage img,
                                                                         java.awt.Dimension targetDimension)

  Converts an image to a monochrome 1-bit image. Optionally, the image can be scaled.

  Parameters:
    `img` - the image to be converted
    `targetDimension` - the new target dimensions or null if no scaling is necessary
  Returns:
    the monochrome image

### convertToMonochrome

    public static final java.awt.image.RenderedImage convertToMonochrome(java.awt.image.RenderedImage img,
                                                                         java.awt.Dimension targetDimension,
                                                                         float quality)

  Converts an image to a monochrome 1-bit image. Optionally, the image can be scaled.

  Parameters:
    `img` - the image to be converted
    `targetDimension` - the new target dimensions or null if no scaling is necessary
    `quality` - Defines the desired quality level for the conversion. Valid values: a value between 0.0f (fastest) and 1.0f (best)
  Returns:
    the monochrome image

### toBufferedImage

    public static java.awt.image.BufferedImage toBufferedImage(java.awt.image.RenderedImage img)

  Returns a BufferedImage based on the given RenderedImage. In the easiest case, this is a simple typecast. Otherwise, the image is converted to a BufferedImage.

  Parameters:
    `img` - the original image
  Returns:
    the buffered image

### createDefaultMonochromeBitmapConverter

    public static MonochromeBitmapConverter createDefaultMonochromeBitmapConverter()

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

Copyright 1999-2010 The Apache Software Foundation. All Rights Reserved.