Mercurial > hg > digilib-old
changeset 1034:c71795594406
another fix for brgt.
fixes for mac osx 10.6.
author | robcast |
---|---|
date | Sun, 11 Mar 2012 16:35:53 +0100 |
parents | d5e181e3401c |
children | e4eb1209fa78 |
files | common/src/main/java/digilib/image/ImageLoaderDocuImage.java |
diffstat | 1 files changed, 15 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/common/src/main/java/digilib/image/ImageLoaderDocuImage.java Sun Mar 11 14:45:41 2012 +0100 +++ b/common/src/main/java/digilib/image/ImageLoaderDocuImage.java Sun Mar 11 16:35:53 2012 +0100 @@ -65,7 +65,7 @@ public class ImageLoaderDocuImage extends ImageInfoDocuImage { /** DocuImage version */ - public static final String version = "ImageLoaderDocuImage 2.1.2"; + public static final String version = "ImageLoaderDocuImage 2.1.3"; /** image object */ protected BufferedImage img; @@ -82,8 +82,11 @@ /** convolution kernels for blur() */ protected static Kernel[] convolutionKernels = { null, new Kernel(1, 1, new float[] { 1f }), - new Kernel(2, 2, new float[] { 0.25f, 0.25f, 0.25f, 0.25f }), - new Kernel(3, 3, new float[] { 1f / 9f, 1f / 9f, 1f / 9f, 1f / 9f, 1f / 9f, 1f / 9f, 1f / 9f, 1f / 9f, 1f / 9f }) }; + new Kernel(2, 2, new float[] { 0.25f, 0.25f, + 0.25f, 0.25f }), + new Kernel(3, 3, new float[] { 1f / 9f, 1f / 9f, 1f / 9f, + 1f / 9f, 1f / 9f, 1f / 9f, + 1f / 9f, 1f / 9f, 1f / 9f }) }; /* lookup tables for inverting images (byte) */ protected static LookupTable invertSingleByteTable; @@ -129,6 +132,7 @@ } // should(!) work for all color models invertSingleByteTable = new ByteLookupTable(0, invertByte); + invertRgbaByteTable = invertSingleByteTable; // but doesn't work with alpha channel on all platforms String ver = System.getProperty("java.version"); String os = System.getProperty("os.name"); @@ -140,8 +144,8 @@ invertRgbaByteTable = new ByteLookupTable(0, new byte[][] { invertByte, invertByte, orderedByte, invertByte }); needsRescaleRgba = true; needsMapBgr = true; - } else { - invertRgbaByteTable = invertSingleByteTable; + } else if (os.startsWith("Mac OS X") && osver.startsWith("10.6")) { + needsRescaleRgba = true; } // this hopefully works for all mapBgrByteTable = new ByteLookupTable(0, new byte[][] { mapR, mapG, mapB }); @@ -560,7 +564,12 @@ dm[i] = (float) mult; da[i] = (float) add; } - op = new RescaleOp(dm, da, null); + if (img.getColorModel().hasAlpha()) { + // alpha channel should not be scaled + dm[ncol-1] = 1f; + da[ncol-1] = 0f; + } + op = new RescaleOp(dm, da, renderHint); } else { op = new RescaleOp(mult, add, renderHint); }