diff options
author | Jeremias Maerki <jeremias@apache.org> | 2010-08-14 17:17:00 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2010-08-14 17:17:00 +0000 |
commit | 29e8badcec8bd40eca2ef4940133f08eeefdda11 (patch) | |
tree | 7b44a2d058ae8a60ff278f5d26f243eb674e54c6 /src/java/org/apache/fop/util/bitmap | |
parent | c81729764a0692e9f5e31ec28722403b603ee5aa (diff) | |
download | xmlgraphics-fop-29e8badcec8bd40eca2ef4940133f08eeefdda11.tar.gz xmlgraphics-fop-29e8badcec8bd40eca2ef4940133f08eeefdda11.zip |
Bugzilla #49733:
Resolved compilation (safe one), Checkstyle and many Javadoc warnings.
Submitted by: Glenn Adams <glenn.at.skynav.com>
Changes to patch:
- Restored the deprecated Graphics2DAdapter method (to be removed after Barcode4J 2.1 is released).
- Restored Renderer.startPageSequence(LineArea) pending discussion about removal.
- build.xml: set max VM to 1024MB instead of 2048MB to allow for 32-bit JVMs.
- build.xml: restored longer taskdef names.
- Restored Checkstyle 4 file for people running older IDEs.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@985537 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/util/bitmap')
-rw-r--r-- | src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java | 26 | ||||
-rw-r--r-- | src/java/org/apache/fop/util/bitmap/DitherUtil.java | 5 |
2 files changed, 19 insertions, 12 deletions
diff --git a/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java b/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java index c08076316..b2706c5c2 100644 --- a/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java +++ b/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java @@ -32,14 +32,17 @@ import java.awt.image.WritableRaster; /** * Utility method for dealing with bitmap images. */ -public class BitmapImageUtil { +public final class BitmapImageUtil { + + private BitmapImageUtil() { + } /** * Indicates whether an image is a monochrome (1 bit black and white) image. * @param img the image * @return true if it's a monochrome image */ - public static final boolean isMonochromeImage(RenderedImage img) { + public static boolean isMonochromeImage(RenderedImage img) { return (getColorIndexSize(img) == 2); } @@ -48,7 +51,7 @@ public class BitmapImageUtil { * @param img the image (must be 1 bit monochrome) * @return true if a zero bit indicates a black/dark pixel, false for a white/bright pixel */ - public static final boolean isZeroBlack(RenderedImage img) { + public static boolean isZeroBlack(RenderedImage img) { if (!isMonochromeImage(img)) { throw new IllegalArgumentException("Image is not a monochrome image!"); } @@ -65,7 +68,7 @@ public class BitmapImageUtil { * @param b the blue component * @return the gray value */ - public static final int convertToGray(int r, int g, int b) { + public static int convertToGray(int r, int g, int b) { return (r * 30 + g * 59 + b * 11) / 100; } @@ -74,7 +77,7 @@ public class BitmapImageUtil { * @param rgb the RGB value * @return the gray value */ - public static final int convertToGray(int rgb) { + public static int convertToGray(int rgb) { int r = (rgb & 0xFF0000) >> 16; int g = (rgb & 0xFF00) >> 8; int b = rgb & 0xFF; @@ -86,7 +89,7 @@ public class BitmapImageUtil { * @param img the image * @return the size of the color index or 0 if there's no color index */ - public static final int getColorIndexSize(RenderedImage img) { + public static int getColorIndexSize(RenderedImage img) { ColorModel cm = img.getColorModel(); if (cm instanceof IndexColorModel) { IndexColorModel icm = (IndexColorModel)cm; @@ -101,7 +104,7 @@ public class BitmapImageUtil { * @param img the image * @return true if it's a grayscale image */ - public static final boolean isGrayscaleImage(RenderedImage img) { + public static boolean isGrayscaleImage(RenderedImage img) { return (img.getColorModel().getColorSpace().getNumComponents() == 1); } @@ -111,7 +114,7 @@ public class BitmapImageUtil { * @param targetDimension the new target dimensions or null if no scaling is necessary * @return the sRGB image */ - public static final BufferedImage convertTosRGB(RenderedImage img, + public static BufferedImage convertTosRGB(RenderedImage img, Dimension targetDimension) { return convertAndScaleImage(img, targetDimension, BufferedImage.TYPE_INT_RGB); } @@ -122,7 +125,7 @@ public class BitmapImageUtil { * @param targetDimension the new target dimensions or null if no scaling is necessary * @return the grayscale image */ - public static final BufferedImage convertToGrayscale(RenderedImage img, + public static BufferedImage convertToGrayscale(RenderedImage img, Dimension targetDimension) { return convertAndScaleImage(img, targetDimension, BufferedImage.TYPE_BYTE_GRAY); } @@ -133,7 +136,7 @@ public class BitmapImageUtil { * @param targetDimension the new target dimensions or null if no scaling is necessary * @return the monochrome image */ - public static final BufferedImage convertToMonochrome(RenderedImage img, + public static BufferedImage convertToMonochrome(RenderedImage img, Dimension targetDimension) { return toBufferedImage(convertToMonochrome(img, targetDimension, 0.0f)); } @@ -146,7 +149,7 @@ public class BitmapImageUtil { * Valid values: a value between 0.0f (fastest) and 1.0f (best) * @return the monochrome image */ - public static final RenderedImage convertToMonochrome(RenderedImage img, + public static RenderedImage convertToMonochrome(RenderedImage img, Dimension targetDimension, float quality) { if (!isMonochromeImage(img)) { if (quality >= 0.5f) { @@ -234,6 +237,7 @@ public class BitmapImageUtil { } } + /** @return the bitmap converter */ public static MonochromeBitmapConverter createDefaultMonochromeBitmapConverter() { MonochromeBitmapConverter converter = null; try { diff --git a/src/java/org/apache/fop/util/bitmap/DitherUtil.java b/src/java/org/apache/fop/util/bitmap/DitherUtil.java index c61befc9c..2fa2e9402 100644 --- a/src/java/org/apache/fop/util/bitmap/DitherUtil.java +++ b/src/java/org/apache/fop/util/bitmap/DitherUtil.java @@ -24,7 +24,10 @@ import java.awt.Color; /** * Utility methods for dithering. */ -public class DitherUtil { +public final class DitherUtil { + + private DitherUtil() { + } /** Selects a 2x2 Bayer dither matrix (5 grayscales) */ public static final int DITHER_MATRIX_2X2 = 2; |