mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2026-05-24 00:00:01 -04:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| caaececa06 | |||
| ffd4731334 | |||
| 7c53c5b7b5 | |||
| c9cfe04dc9 | |||
| 9da25168ee | |||
| b0c928d278 | |||
| e221c7374b |
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys</groupId>
|
<groupId>com.twelvemonkeys</groupId>
|
||||||
<artifactId>twelvemonkeys</artifactId>
|
<artifactId>twelvemonkeys</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>com.twelvemonkeys.bom</groupId>
|
<groupId>com.twelvemonkeys.bom</groupId>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.common</groupId>
|
<groupId>com.twelvemonkeys.common</groupId>
|
||||||
<artifactId>common</artifactId>
|
<artifactId>common</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>common-image</artifactId>
|
<artifactId>common-image</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.common</groupId>
|
<groupId>com.twelvemonkeys.common</groupId>
|
||||||
<artifactId>common</artifactId>
|
<artifactId>common</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>common-io</artifactId>
|
<artifactId>common-io</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.common</groupId>
|
<groupId>com.twelvemonkeys.common</groupId>
|
||||||
<artifactId>common</artifactId>
|
<artifactId>common</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>common-lang</artifactId>
|
<artifactId>common-lang</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys</groupId>
|
<groupId>com.twelvemonkeys</groupId>
|
||||||
<artifactId>twelvemonkeys</artifactId>
|
<artifactId>twelvemonkeys</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.twelvemonkeys.common</groupId>
|
<groupId>com.twelvemonkeys.common</groupId>
|
||||||
<artifactId>common</artifactId>
|
<artifactId>common</artifactId>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-batik</artifactId>
|
<artifactId>imageio-batik</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: Batik Plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: Batik Plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-bmp</artifactId>
|
<artifactId>imageio-bmp</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: BMP plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: BMP plugin</name>
|
||||||
|
|||||||
+14
@@ -43,6 +43,7 @@ abstract class BitmapDescriptor {
|
|||||||
protected final DIBHeader header;
|
protected final DIBHeader header;
|
||||||
|
|
||||||
protected BufferedImage image;
|
protected BufferedImage image;
|
||||||
|
protected BitmapMask mask;
|
||||||
|
|
||||||
public BitmapDescriptor(final DirectoryEntry pEntry, final DIBHeader pHeader) {
|
public BitmapDescriptor(final DirectoryEntry pEntry, final DIBHeader pHeader) {
|
||||||
Validate.notNull(pEntry, "entry");
|
Validate.notNull(pEntry, "entry");
|
||||||
@@ -69,4 +70,17 @@ abstract class BitmapDescriptor {
|
|||||||
protected final int getBitCount() {
|
protected final int getBitCount() {
|
||||||
return entry.getBitCount() != 0 ? entry.getBitCount() : header.getBitCount();
|
return entry.getBitCount() != 0 ? entry.getBitCount() : header.getBitCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return getClass().getSimpleName() + "[" + entry + ", " + header + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void setMask(final BitmapMask mask) {
|
||||||
|
this.mask = mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean hasMask() {
|
||||||
|
return header.getHeight() == getHeight() * 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+24
-33
@@ -28,8 +28,6 @@
|
|||||||
|
|
||||||
package com.twelvemonkeys.imageio.plugins.bmp;
|
package com.twelvemonkeys.imageio.plugins.bmp;
|
||||||
|
|
||||||
import com.twelvemonkeys.image.InverseColorMapIndexColorModel;
|
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.image.DataBuffer;
|
import java.awt.image.DataBuffer;
|
||||||
import java.awt.image.IndexColorModel;
|
import java.awt.image.IndexColorModel;
|
||||||
@@ -46,8 +44,6 @@ class BitmapIndexed extends BitmapDescriptor {
|
|||||||
protected final int[] bits;
|
protected final int[] bits;
|
||||||
protected final int[] colors;
|
protected final int[] colors;
|
||||||
|
|
||||||
private BitmapMask mask;
|
|
||||||
|
|
||||||
public BitmapIndexed(final DirectoryEntry pEntry, final DIBHeader pHeader) {
|
public BitmapIndexed(final DirectoryEntry pEntry, final DIBHeader pHeader) {
|
||||||
super(pEntry, pHeader);
|
super(pEntry, pHeader);
|
||||||
bits = new int[getWidth() * getHeight()];
|
bits = new int[getWidth() * getHeight()];
|
||||||
@@ -65,7 +61,7 @@ class BitmapIndexed extends BitmapDescriptor {
|
|||||||
// This is slightly obscure, and should probably be moved..
|
// This is slightly obscure, and should probably be moved..
|
||||||
Hashtable<String, Object> properties = null;
|
Hashtable<String, Object> properties = null;
|
||||||
if (entry instanceof DirectoryEntry.CUREntry) {
|
if (entry instanceof DirectoryEntry.CUREntry) {
|
||||||
properties = new Hashtable<String, Object>(1);
|
properties = new Hashtable<>(1);
|
||||||
properties.put("cursor_hotspot", ((DirectoryEntry.CUREntry) this.entry).getHotspot());
|
properties.put("cursor_hotspot", ((DirectoryEntry.CUREntry) this.entry).getHotspot());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,8 +85,6 @@ class BitmapIndexed extends BitmapDescriptor {
|
|||||||
|
|
||||||
raster.setSamples(0, 0, getWidth(), getHeight(), 0, bits);
|
raster.setSamples(0, 0, getWidth(), getHeight(), 0, bits);
|
||||||
|
|
||||||
//System.out.println("Image: " + image);
|
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,38 +96,38 @@ class BitmapIndexed extends BitmapDescriptor {
|
|||||||
int bits = getBitCount();
|
int bits = getBitCount();
|
||||||
|
|
||||||
int colors = this.colors.length;
|
int colors = this.colors.length;
|
||||||
int trans = -1;
|
int transparent = -1;
|
||||||
|
|
||||||
// Try to avoid USHORT transfertype, as it results in BufferedImage TYPE_CUSTOM
|
// Try to avoid USHORT transfertype, as it results in BufferedImage TYPE_CUSTOM
|
||||||
// NOTE: This code assumes icons are small, and is NOT optimized for performance...
|
// NOTE: This code assumes icons are small, and is NOT optimized for performance...
|
||||||
if (colors > (1 << getBitCount())) {
|
if (colors > (1 << getBitCount())) {
|
||||||
int index = findTransIndexMaybeRemap(this.colors, this.bits);
|
int index = findTransparentIndexMaybeRemap(this.colors, this.bits);
|
||||||
|
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
// No duplicate found, increase bitcount
|
// No duplicate found, increase bitcount
|
||||||
bits++;
|
bits++;
|
||||||
trans = this.colors.length - 1;
|
transparent = this.colors.length - 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Found a duplicate, use it as trans
|
// Found a duplicate, use it as transparent
|
||||||
trans = index;
|
transparent = index;
|
||||||
colors--;
|
colors--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Setting hasAlpha to true, makes things work on 1.2
|
// NOTE: Setting hasAlpha to true, makes things work on 1.2
|
||||||
return new InverseColorMapIndexColorModel(
|
return new IndexColorModel(
|
||||||
bits, colors, this.colors, 0, true, trans,
|
bits, colors, this.colors, 0, true, transparent,
|
||||||
bits <= 8 ? DataBuffer.TYPE_BYTE : DataBuffer.TYPE_USHORT
|
bits <= 8 ? DataBuffer.TYPE_BYTE : DataBuffer.TYPE_USHORT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int findTransIndexMaybeRemap(final int[] pColors, final int[] pBits) {
|
private static int findTransparentIndexMaybeRemap(final int[] colors, final int[] bits) {
|
||||||
// Look for unused colors, to use as transparent
|
// Look for unused colors, to use as transparent
|
||||||
final boolean[] used = new boolean[pColors.length - 1];
|
boolean[] used = new boolean[colors.length - 1];
|
||||||
for (int pBit : pBits) {
|
for (int bit : bits) {
|
||||||
if (!used[pBit]) {
|
if (!used[bit]) {
|
||||||
used[pBit] = true;
|
used[bit] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,38 +138,35 @@ class BitmapIndexed extends BitmapDescriptor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to find duplicates in colormap, and remap
|
// Try to find duplicates in colormap, and remap
|
||||||
int trans = -1;
|
int transparent = -1;
|
||||||
int duplicate = -1;
|
int duplicate = -1;
|
||||||
for (int i = 0; trans == -1 && i < pColors.length - 1; i++) {
|
for (int i = 0; transparent == -1 && i < colors.length - 1; i++) {
|
||||||
for (int j = i + 1; j < pColors.length - 1; j++) {
|
for (int j = i + 1; j < colors.length - 1; j++) {
|
||||||
if (pColors[i] == pColors[j]) {
|
if (colors[i] == colors[j]) {
|
||||||
trans = j;
|
transparent = j;
|
||||||
duplicate = i;
|
duplicate = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trans != -1) {
|
if (transparent != -1) {
|
||||||
// Remap duplicate
|
// Remap duplicate
|
||||||
for (int i = 0; i < pBits.length; i++) {
|
for (int i = 0; i < bits.length; i++) {
|
||||||
if (pBits[i] == trans) {
|
if (bits[i] == transparent) {
|
||||||
pBits[i] = duplicate;
|
bits[i] = duplicate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return trans;
|
return transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BufferedImage getImage() {
|
public BufferedImage getImage() {
|
||||||
if (image == null) {
|
if (image == null) {
|
||||||
image = createImageIndexed();
|
image = createImageIndexed();
|
||||||
}
|
}
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMask(final BitmapMask pMask) {
|
|
||||||
mask = pMask;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -38,19 +38,19 @@ import java.awt.image.BufferedImage;
|
|||||||
* @version $Id: BitmapMask.java,v 1.0 25.feb.2006 00:29:44 haku Exp$
|
* @version $Id: BitmapMask.java,v 1.0 25.feb.2006 00:29:44 haku Exp$
|
||||||
*/
|
*/
|
||||||
class BitmapMask extends BitmapDescriptor {
|
class BitmapMask extends BitmapDescriptor {
|
||||||
protected final BitmapIndexed mask;
|
protected final BitmapIndexed bitMask;
|
||||||
|
|
||||||
public BitmapMask(final DirectoryEntry pParent, final DIBHeader pHeader) {
|
public BitmapMask(final DirectoryEntry pParent, final DIBHeader pHeader) {
|
||||||
super(pParent, pHeader);
|
super(pParent, pHeader);
|
||||||
mask = new BitmapIndexed(pParent, pHeader);
|
bitMask = new BitmapIndexed(pParent, pHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isTransparent(final int pX, final int pY) {
|
boolean isTransparent(final int pX, final int pY) {
|
||||||
// NOTE: 1: Fully transparent, 0: Opaque...
|
// NOTE: 1: Fully transparent, 0: Opaque...
|
||||||
return mask.bits[pX + pY * getWidth()] != 0;
|
return bitMask.bits[pX + pY * getWidth()] != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BufferedImage getImage() {
|
public BufferedImage getImage() {
|
||||||
return mask.getImage();
|
return bitMask.getImage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+34
@@ -28,7 +28,9 @@
|
|||||||
|
|
||||||
package com.twelvemonkeys.imageio.plugins.bmp;
|
package com.twelvemonkeys.imageio.plugins.bmp;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.awt.image.WritableRaster;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes an RGB/true color bitmap structure (16, 24 and 32 bits per pixel).
|
* Describes an RGB/true color bitmap structure (16, 24 and 32 bits per pixel).
|
||||||
@@ -43,6 +45,38 @@ class BitmapRGB extends BitmapDescriptor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BufferedImage getImage() {
|
public BufferedImage getImage() {
|
||||||
|
// Test is mask != null rather than hasMask(), as 32 bit (w/alpha)
|
||||||
|
// might still have bitmask, but we don't read or use it.
|
||||||
|
if (mask != null) {
|
||||||
|
image = createMaskedImage();
|
||||||
|
mask = null;
|
||||||
|
}
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BufferedImage createMaskedImage() {
|
||||||
|
BufferedImage masked = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
|
||||||
|
|
||||||
|
Graphics2D graphics = masked.createGraphics();
|
||||||
|
try {
|
||||||
|
graphics.drawImage(image, 0, 0, null);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
graphics.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
WritableRaster alphaRaster = masked.getAlphaRaster();
|
||||||
|
|
||||||
|
byte[] trans = {0x0};
|
||||||
|
for (int y = 0; y < getHeight(); y++) {
|
||||||
|
for (int x = 0; x < getWidth(); x++) {
|
||||||
|
if (mask.isTransparent(x, y)) {
|
||||||
|
alphaRaster.setDataElements(x, y, trans);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return masked;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+36
-13
@@ -66,14 +66,15 @@ import java.util.List;
|
|||||||
// TODO: Decide whether DirectoryEntry or DIBHeader should be primary source for color count/bit count
|
// TODO: Decide whether DirectoryEntry or DIBHeader should be primary source for color count/bit count
|
||||||
// TODO: Support loading icons from DLLs, see
|
// TODO: Support loading icons from DLLs, see
|
||||||
// <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwui/html/msdn_icons.asp">MSDN</a>
|
// <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwui/html/msdn_icons.asp">MSDN</a>
|
||||||
// Known issue: 256x256 PNG encoded icons does not have IndexColorModel even if stated in DirectoryEntry (seem impossible as the PNGs are all true color)
|
// Known issue: 256x256 PNG encoded icons does not have IndexColorModel even if stated in DirectoryEntry
|
||||||
|
// (seem impossible as the PNGs are all true color)
|
||||||
abstract class DIBImageReader extends ImageReaderBase {
|
abstract class DIBImageReader extends ImageReaderBase {
|
||||||
// TODO: Consider moving the reading to inner classes (subclasses of BitmapDescriptor)
|
// TODO: Consider moving the reading to inner classes (subclasses of BitmapDescriptor)
|
||||||
private Directory directory;
|
private Directory directory;
|
||||||
|
|
||||||
// TODO: Review these, make sure we don't have a memory leak
|
// TODO: Review these, make sure we don't have a memory leak
|
||||||
private Map<DirectoryEntry, DIBHeader> headers = new WeakHashMap<DirectoryEntry, DIBHeader>();
|
private Map<DirectoryEntry, DIBHeader> headers = new WeakHashMap<>();
|
||||||
private Map<DirectoryEntry, BitmapDescriptor> descriptors = new WeakWeakMap<DirectoryEntry, BitmapDescriptor>();
|
private Map<DirectoryEntry, BitmapDescriptor> descriptors = new WeakWeakMap<>();
|
||||||
|
|
||||||
private ImageReader pngImageReader;
|
private ImageReader pngImageReader;
|
||||||
|
|
||||||
@@ -101,7 +102,7 @@ abstract class DIBImageReader extends ImageReaderBase {
|
|||||||
return getImageTypesPNG(entry);
|
return getImageTypesPNG(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ImageTypeSpecifier> types = new ArrayList<ImageTypeSpecifier>();
|
List<ImageTypeSpecifier> types = new ArrayList<>();
|
||||||
DIBHeader header = getHeader(entry);
|
DIBHeader header = getHeader(entry);
|
||||||
|
|
||||||
// Use data from header to create specifier
|
// Use data from header to create specifier
|
||||||
@@ -121,10 +122,13 @@ abstract class DIBImageReader extends ImageReaderBase {
|
|||||||
specifier = ImageTypeSpecifiers.createFromIndexColorModel(indexed.createColorModel());
|
specifier = ImageTypeSpecifiers.createFromIndexColorModel(indexed.createColorModel());
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
|
// TODO: May have mask?!
|
||||||
specifier = ImageTypeSpecifiers.createFromBufferedImageType(BufferedImage.TYPE_USHORT_555_RGB);
|
specifier = ImageTypeSpecifiers.createFromBufferedImageType(BufferedImage.TYPE_USHORT_555_RGB);
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
specifier = ImageTypeSpecifiers.createFromBufferedImageType(BufferedImage.TYPE_3BYTE_BGR);
|
specifier = new BitmapRGB(entry, header).hasMask()
|
||||||
|
? ImageTypeSpecifiers.createFromBufferedImageType(BufferedImage.TYPE_4BYTE_ABGR)
|
||||||
|
: ImageTypeSpecifiers.createFromBufferedImageType(BufferedImage.TYPE_3BYTE_BGR);
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
specifier = ImageTypeSpecifiers.createFromBufferedImageType(BufferedImage.TYPE_INT_ARGB);
|
specifier = ImageTypeSpecifiers.createFromBufferedImageType(BufferedImage.TYPE_INT_ARGB);
|
||||||
@@ -184,6 +188,7 @@ abstract class DIBImageReader extends ImageReaderBase {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Graphics2D g = destination.createGraphics();
|
Graphics2D g = destination.createGraphics();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
g.setComposite(AlphaComposite.Src);
|
g.setComposite(AlphaComposite.Src);
|
||||||
g.drawImage(image, 0, 0, null);
|
g.drawImage(image, 0, 0, null);
|
||||||
@@ -316,6 +321,8 @@ abstract class DIBImageReader extends ImageReaderBase {
|
|||||||
descriptors.put(pEntry, descriptor);
|
descriptors.put(pEntry, descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.err.println("descriptor: " + descriptor);
|
||||||
|
|
||||||
return descriptor.getImage();
|
return descriptor.getImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,7 +342,7 @@ abstract class DIBImageReader extends ImageReaderBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BitmapMask mask = new BitmapMask(pBitmap.entry, pBitmap.header);
|
BitmapMask mask = new BitmapMask(pBitmap.entry, pBitmap.header);
|
||||||
readBitmapIndexed1(mask.mask, true);
|
readBitmapIndexed1(mask.bitMask, true);
|
||||||
pBitmap.setMask(mask);
|
pBitmap.setMask(mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,7 +377,7 @@ abstract class DIBImageReader extends ImageReaderBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: If we are reading the mask, we don't abort or progress
|
// NOTE: If we are reading the mask, we don't abort or report progress
|
||||||
if (!pAsMask) {
|
if (!pAsMask) {
|
||||||
if (abortRequested()) {
|
if (abortRequested()) {
|
||||||
processReadAborted();
|
processReadAborted();
|
||||||
@@ -455,7 +462,7 @@ abstract class DIBImageReader extends ImageReaderBase {
|
|||||||
short[] pixels = new short[pBitmap.getWidth() * pBitmap.getHeight()];
|
short[] pixels = new short[pBitmap.getWidth() * pBitmap.getHeight()];
|
||||||
|
|
||||||
// TODO: Support TYPE_USHORT_565 and the RGB 444/ARGB 4444 layouts
|
// TODO: Support TYPE_USHORT_565 and the RGB 444/ARGB 4444 layouts
|
||||||
// Will create TYPE_USHORT_555;
|
// Will create TYPE_USHORT_555
|
||||||
DirectColorModel cm = new DirectColorModel(16, 0x7C00, 0x03E0, 0x001F);
|
DirectColorModel cm = new DirectColorModel(16, 0x7C00, 0x03E0, 0x001F);
|
||||||
DataBuffer buffer = new DataBufferShort(pixels, pixels.length);
|
DataBuffer buffer = new DataBufferShort(pixels, pixels.length);
|
||||||
WritableRaster raster = Raster.createPackedRaster(
|
WritableRaster raster = Raster.createPackedRaster(
|
||||||
@@ -480,6 +487,8 @@ abstract class DIBImageReader extends ImageReaderBase {
|
|||||||
|
|
||||||
processImageProgress(100 * y / (float) pBitmap.getHeight());
|
processImageProgress(100 * y / (float) pBitmap.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Might be mask!?
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readBitmap24(final BitmapDescriptor pBitmap) throws IOException {
|
private void readBitmap24(final BitmapDescriptor pBitmap) throws IOException {
|
||||||
@@ -494,16 +503,19 @@ abstract class DIBImageReader extends ImageReaderBase {
|
|||||||
cs, nBits, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE
|
cs, nBits, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
int scanlineStride = pBitmap.getWidth() * 3;
|
||||||
|
// BMP rows are padded to 4 byte boundary
|
||||||
|
int rowSizeBytes = ((8 * scanlineStride + 31) / 32) * 4;
|
||||||
|
|
||||||
WritableRaster raster = Raster.createInterleavedRaster(
|
WritableRaster raster = Raster.createInterleavedRaster(
|
||||||
buffer, pBitmap.getWidth(), pBitmap.getHeight(), pBitmap.getWidth(), 3, bOffs, null
|
buffer, pBitmap.getWidth(), pBitmap.getHeight(), scanlineStride, 3, bOffs, null
|
||||||
);
|
);
|
||||||
pBitmap.image = new BufferedImage(cm, raster, cm.isAlphaPremultiplied(), null);
|
pBitmap.image = new BufferedImage(cm, raster, cm.isAlphaPremultiplied(), null);
|
||||||
|
|
||||||
for (int y = 0; y < pBitmap.getHeight(); y++) {
|
for (int y = 0; y < pBitmap.getHeight(); y++) {
|
||||||
int offset = (pBitmap.getHeight() - y - 1) * pBitmap.getWidth();
|
int offset = (pBitmap.getHeight() - y - 1) * scanlineStride;
|
||||||
imageInput.readFully(pixels, offset, pBitmap.getWidth() * 3);
|
imageInput.readFully(pixels, offset, scanlineStride);
|
||||||
|
imageInput.skipBytes(rowSizeBytes - scanlineStride);
|
||||||
// TODO: Possibly read padding byte here!
|
|
||||||
|
|
||||||
if (abortRequested()) {
|
if (abortRequested()) {
|
||||||
processReadAborted();
|
processReadAborted();
|
||||||
@@ -512,6 +524,14 @@ abstract class DIBImageReader extends ImageReaderBase {
|
|||||||
|
|
||||||
processImageProgress(100 * y / (float) pBitmap.getHeight());
|
processImageProgress(100 * y / (float) pBitmap.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 24 bit icons usually have a bit mask
|
||||||
|
if (pBitmap.hasMask()) {
|
||||||
|
BitmapMask mask = new BitmapMask(pBitmap.entry, pBitmap.header);
|
||||||
|
readBitmapIndexed1(mask.bitMask, true);
|
||||||
|
|
||||||
|
pBitmap.setMask(mask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readBitmap32(final BitmapDescriptor pBitmap) throws IOException {
|
private void readBitmap32(final BitmapDescriptor pBitmap) throws IOException {
|
||||||
@@ -535,6 +555,9 @@ abstract class DIBImageReader extends ImageReaderBase {
|
|||||||
}
|
}
|
||||||
processImageProgress(100 * y / (float) pBitmap.getHeight());
|
processImageProgress(100 * y / (float) pBitmap.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// There might be a mask here as well, but we'll ignore it,
|
||||||
|
// and use the 8 bit alpha channel in the ARGB pixel data
|
||||||
}
|
}
|
||||||
|
|
||||||
private Directory getDirectory() throws IOException {
|
private Directory getDirectory() throws IOException {
|
||||||
|
|||||||
+3
-1
@@ -39,7 +39,9 @@ public class ICOImageReaderTest extends ImageReaderAbstractTest<ICOImageReader>
|
|||||||
new Dimension(16, 16), new Dimension(16, 16), new Dimension(32, 32), new Dimension(32, 32),
|
new Dimension(16, 16), new Dimension(16, 16), new Dimension(32, 32), new Dimension(32, 32),
|
||||||
new Dimension(48, 48), new Dimension(48, 48), new Dimension(256, 256), new Dimension(256, 256),
|
new Dimension(48, 48), new Dimension(48, 48), new Dimension(256, 256), new Dimension(256, 256),
|
||||||
new Dimension(16, 16), new Dimension(32, 32), new Dimension(48, 48), new Dimension(256, 256)
|
new Dimension(16, 16), new Dimension(32, 32), new Dimension(48, 48), new Dimension(256, 256)
|
||||||
)
|
),
|
||||||
|
// Problematic icon that reports 24 bit in the descriptor, but has separate 1 bit ''mask (height 2 x icon height)!
|
||||||
|
new TestData(getClassLoaderResource("/ico/rgb24bitmask.ico"), new Dimension(32, 32))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-clippath</artifactId>
|
<artifactId>imageio-clippath</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: Photoshop Path Support</name>
|
<name>TwelveMonkeys :: ImageIO :: Photoshop Path Support</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-core</artifactId>
|
<artifactId>imageio-core</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: Core</name>
|
<name>TwelveMonkeys :: ImageIO :: Core</name>
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ import java.util.Properties;
|
|||||||
* <p />
|
* <p />
|
||||||
* Color profiles may be configured by placing a property-file
|
* Color profiles may be configured by placing a property-file
|
||||||
* {@code com/twelvemonkeys/imageio/color/icc_profiles.properties}
|
* {@code com/twelvemonkeys/imageio/color/icc_profiles.properties}
|
||||||
* on the classpath, specifying the full path to the profile.
|
* on the classpath, specifying the full path to the profiles.
|
||||||
* ICC color profiles are probably already present on your system, or
|
* ICC color profiles are probably already present on your system, or
|
||||||
* can be downloaded from
|
* can be downloaded from
|
||||||
* <a href="http://www.color.org/profiles2.xalter">ICC</a>,
|
* <a href="http://www.color.org/profiles2.xalter">ICC</a>,
|
||||||
@@ -342,7 +342,7 @@ public final class ColorSpaces {
|
|||||||
try {
|
try {
|
||||||
return ICC_Profile.getInstance(profilePath);
|
return ICC_Profile.getInstance(profilePath);
|
||||||
}
|
}
|
||||||
catch (IOException ignore) {
|
catch (SecurityException | IOException ignore) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
ignore.printStackTrace();
|
ignore.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-icns</artifactId>
|
<artifactId>imageio-icns</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: ICNS plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: ICNS plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-iff</artifactId>
|
<artifactId>imageio-iff</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: IFF plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: IFF plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-jpeg</artifactId>
|
<artifactId>imageio-jpeg</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: JPEG plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: JPEG plugin</name>
|
||||||
|
|||||||
+39
-10
@@ -471,12 +471,11 @@ public class JPEGImageReader extends ImageReaderBase {
|
|||||||
YCbCrConverter.convertYCbCr2RGB(raster);
|
YCbCrConverter.convertYCbCr2RGB(raster);
|
||||||
}
|
}
|
||||||
else if (csType == JPEGColorSpace.YCCK) {
|
else if (csType == JPEGColorSpace.YCCK) {
|
||||||
YCbCrConverter.convertYCCK2CMYK(raster);
|
// TODO: Need to rethink this (non-) inversion, see #147
|
||||||
|
// TODO: Allow param to specify inversion, or possibly the PDF decode array
|
||||||
// flag0 bit 15, blend = 1 see http://graphicdesign.stackexchange.com/questions/12894/cmyk-jpegs-extracted-from-pdf-appear-inverted
|
// flag0 bit 15, blend = 1 see http://graphicdesign.stackexchange.com/questions/12894/cmyk-jpegs-extracted-from-pdf-appear-inverted
|
||||||
if ((getAdobeDCT().flags0 & 0x8000) != 0) {
|
boolean invert = true;// || (adobeDCT.flags0 & 0x8000) == 0;
|
||||||
/// TODO: Better yet would be to not inverting in the first place, add flag to convertYCCK2CMYK
|
YCbCrConverter.convertYCCK2CMYK(raster, invert);
|
||||||
invertCMYK(raster);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (csType == JPEGColorSpace.CMYK) {
|
else if (csType == JPEGColorSpace.CMYK) {
|
||||||
invertCMYK(raster);
|
invertCMYK(raster);
|
||||||
@@ -948,6 +947,11 @@ public class JPEGImageReader extends ImageReaderBase {
|
|||||||
delegate.abort();
|
delegate.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ImageReadParam getDefaultReadParam() {
|
||||||
|
return delegate.getDefaultReadParam();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean readerSupportsThumbnails() {
|
public boolean readerSupportsThumbnails() {
|
||||||
return true; // We support EXIF, JFIF and JFXX style thumbnails
|
return true; // We support EXIF, JFIF and JFXX style thumbnails
|
||||||
@@ -1176,19 +1180,28 @@ public class JPEGImageReader extends ImageReaderBase {
|
|||||||
rgb[offset + 2] = clamp(y + Cb_B_LUT[cb]);
|
rgb[offset + 2] = clamp(y + Cb_B_LUT[cb]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void convertYCCK2CMYK(final Raster raster) {
|
static void convertYCCK2CMYK(final Raster raster, final boolean invert) {
|
||||||
final int height = raster.getHeight();
|
final int height = raster.getHeight();
|
||||||
final int width = raster.getWidth();
|
final int width = raster.getWidth();
|
||||||
final byte[] data = ((DataBufferByte) raster.getDataBuffer()).getData();
|
final byte[] data = ((DataBufferByte) raster.getDataBuffer()).getData();
|
||||||
|
|
||||||
for (int y = 0; y < height; y++) {
|
if (invert) {
|
||||||
for (int x = 0; x < width; x++) {
|
for (int y = 0; y < height; y++) {
|
||||||
convertYCCK2CMYK(data, data, (x + y * width) * 4);
|
for (int x = 0; x < width; x++) {
|
||||||
|
convertYCCK2CMYKInverted(data, data, (x + y * width) * 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (int y = 0; y < height; y++) {
|
||||||
|
for (int x = 0; x < width; x++) {
|
||||||
|
convertYCCK2CMYK(data, data, (x + y * width) * 4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void convertYCCK2CMYK(byte[] ycck, byte[] cmyk, int offset) {
|
private static void convertYCCK2CMYKInverted(byte[] ycck, byte[] cmyk, int offset) {
|
||||||
// Inverted
|
// Inverted
|
||||||
int y = 255 - ycck[offset ] & 0xff;
|
int y = 255 - ycck[offset ] & 0xff;
|
||||||
int cb = 255 - ycck[offset + 1] & 0xff;
|
int cb = 255 - ycck[offset + 1] & 0xff;
|
||||||
@@ -1205,6 +1218,22 @@ public class JPEGImageReader extends ImageReaderBase {
|
|||||||
cmyk[offset + 3] = (byte) k; // K passes through unchanged
|
cmyk[offset + 3] = (byte) k; // K passes through unchanged
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void convertYCCK2CMYK(byte[] ycck, byte[] cmyk, int offset) {
|
||||||
|
int y = ycck[offset ] & 0xff;
|
||||||
|
int cb = ycck[offset + 1] & 0xff;
|
||||||
|
int cr = ycck[offset + 2] & 0xff;
|
||||||
|
int k = ycck[offset + 3] & 0xff;
|
||||||
|
|
||||||
|
int cmykC = MAXJSAMPLE - (y + Cr_R_LUT[cr]);
|
||||||
|
int cmykM = MAXJSAMPLE - (y + (Cb_G_LUT[cb] + Cr_G_LUT[cr] >> SCALEBITS));
|
||||||
|
int cmykY = MAXJSAMPLE - (y + Cb_B_LUT[cb]);
|
||||||
|
|
||||||
|
cmyk[offset ] = clamp(cmykC);
|
||||||
|
cmyk[offset + 1] = clamp(cmykM);
|
||||||
|
cmyk[offset + 2] = clamp(cmykY);
|
||||||
|
cmyk[offset + 3] = (byte) k; // K passes through unchanged
|
||||||
|
}
|
||||||
|
|
||||||
private static byte clamp(int val) {
|
private static byte clamp(int val) {
|
||||||
return (byte) Math.max(0, Math.min(255, val));
|
return (byte) Math.max(0, Math.min(255, val));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>imageio-metadata</artifactId>
|
<artifactId>imageio-metadata</artifactId>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-pcx</artifactId>
|
<artifactId>imageio-pcx</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: PCX plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: PCX plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-pdf</artifactId>
|
<artifactId>imageio-pdf</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: PDF plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: PDF plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-pict</artifactId>
|
<artifactId>imageio-pict</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: PICT plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: PICT plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-pnm</artifactId>
|
<artifactId>imageio-pnm</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: PNM plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: PNM plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-psd</artifactId>
|
<artifactId>imageio-psd</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: PSD plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: PSD plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-reference</artifactId>
|
<artifactId>imageio-reference</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: reference test cases</name>
|
<name>TwelveMonkeys :: ImageIO :: reference test cases</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-sgi</artifactId>
|
<artifactId>imageio-sgi</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: SGI plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: SGI plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-tga</artifactId>
|
<artifactId>imageio-tga</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: TGA plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: TGA plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-thumbsdb</artifactId>
|
<artifactId>imageio-thumbsdb</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: Thumbs.db plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: Thumbs.db plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-tiff</artifactId>
|
<artifactId>imageio-tiff</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: TIFF plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: TIFF plugin</name>
|
||||||
|
|||||||
+5
-4
@@ -145,9 +145,9 @@ public final class TIFFImageWriter extends ImageWriterBase {
|
|||||||
entries.add(new TIFFEntry(TIFF.TAG_IMAGE_HEIGHT, renderedImage.getHeight()));
|
entries.add(new TIFFEntry(TIFF.TAG_IMAGE_HEIGHT, renderedImage.getHeight()));
|
||||||
// entries.add(new TIFFEntry(TIFF.TAG_ORIENTATION, 1)); // (optional)
|
// entries.add(new TIFFEntry(TIFF.TAG_ORIENTATION, 1)); // (optional)
|
||||||
entries.add(new TIFFEntry(TIFF.TAG_BITS_PER_SAMPLE, asShortArray(sampleModel.getSampleSize())));
|
entries.add(new TIFFEntry(TIFF.TAG_BITS_PER_SAMPLE, asShortArray(sampleModel.getSampleSize())));
|
||||||
// If numComponents > 3, write ExtraSamples
|
// If numComponents > numColorComponents, write ExtraSamples
|
||||||
if (numComponents > 3) {
|
if (numComponents > colorModel.getNumColorComponents()) {
|
||||||
// TODO: Write per component > 3
|
// TODO: Write per component > numColorComponents
|
||||||
if (colorModel.hasAlpha()) {
|
if (colorModel.hasAlpha()) {
|
||||||
entries.add(new TIFFEntry(TIFF.TAG_EXTRA_SAMPLES, colorModel.isAlphaPremultiplied() ? TIFFBaseline.EXTRASAMPLE_ASSOCIATED_ALPHA : TIFFBaseline.EXTRASAMPLE_UNASSOCIATED_ALPHA));
|
entries.add(new TIFFEntry(TIFF.TAG_EXTRA_SAMPLES, colorModel.isAlphaPremultiplied() ? TIFFBaseline.EXTRASAMPLE_ASSOCIATED_ALPHA : TIFFBaseline.EXTRASAMPLE_UNASSOCIATED_ALPHA));
|
||||||
}
|
}
|
||||||
@@ -169,6 +169,7 @@ public final class TIFFImageWriter extends ImageWriterBase {
|
|||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: We might want to support CMYK in JPEG as well...
|
||||||
int photometric = compression == TIFFExtension.COMPRESSION_JPEG ?
|
int photometric = compression == TIFFExtension.COMPRESSION_JPEG ?
|
||||||
TIFFExtension.PHOTOMETRIC_YCBCR :
|
TIFFExtension.PHOTOMETRIC_YCBCR :
|
||||||
getPhotometricInterpretation(colorModel);
|
getPhotometricInterpretation(colorModel);
|
||||||
@@ -684,7 +685,7 @@ public final class TIFFImageWriter extends ImageWriterBase {
|
|||||||
// BufferedImage image = new BufferedImage(original.getWidth(), original.getHeight(), BufferedImage.TYPE_INT_BGR);
|
// BufferedImage image = new BufferedImage(original.getWidth(), original.getHeight(), BufferedImage.TYPE_INT_BGR);
|
||||||
// BufferedImage image = new BufferedImage(original.getWidth(), original.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
|
// BufferedImage image = new BufferedImage(original.getWidth(), original.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
|
||||||
BufferedImage image;
|
BufferedImage image;
|
||||||
if (type < 0 || type == original.getType()) {
|
if (type <= 0 || type == original.getType()) {
|
||||||
image = original;
|
image = original;
|
||||||
}
|
}
|
||||||
else if (type == BufferedImage.TYPE_BYTE_INDEXED) {
|
else if (type == BufferedImage.TYPE_BYTE_INDEXED) {
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys</groupId>
|
<groupId>com.twelvemonkeys</groupId>
|
||||||
<artifactId>twelvemonkeys</artifactId>
|
<artifactId>twelvemonkeys</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
<groupId>com.twelvemonkeys</groupId>
|
<groupId>com.twelvemonkeys</groupId>
|
||||||
<artifactId>twelvemonkeys</artifactId>
|
<artifactId>twelvemonkeys</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>Twelvemonkeys</name>
|
<name>Twelvemonkeys</name>
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
<connection>scm:git:https://github.com/haraldk/TwelveMonkeys</connection>
|
<connection>scm:git:https://github.com/haraldk/TwelveMonkeys</connection>
|
||||||
<developerConnection>scm:git:https://github.com/haraldk/TwelveMonkeys</developerConnection>
|
<developerConnection>scm:git:https://github.com/haraldk/TwelveMonkeys</developerConnection>
|
||||||
<url>https://github.com/haraldk/TwelveMonkeys</url>
|
<url>https://github.com/haraldk/TwelveMonkeys</url>
|
||||||
<tag>twelvemonkeys-3.1.1</tag>
|
<tag>twelvemonkeys-3.1.0</tag>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys</groupId>
|
<groupId>com.twelvemonkeys</groupId>
|
||||||
<artifactId>twelvemonkeys</artifactId>
|
<artifactId>twelvemonkeys</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
Reference in New Issue
Block a user