mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-04 12:05:29 -04:00
IFF: Simplified aspect.
This commit is contained in:
parent
2a77558cac
commit
92bc9c73f6
@ -27,8 +27,7 @@ abstract class Form {
|
|||||||
|
|
||||||
abstract int width();
|
abstract int width();
|
||||||
abstract int height();
|
abstract int height();
|
||||||
abstract int xAspect();
|
abstract float aspect();
|
||||||
abstract int yAspect();
|
|
||||||
abstract int bitplanes();
|
abstract int bitplanes();
|
||||||
abstract int compressionType();
|
abstract int compressionType();
|
||||||
|
|
||||||
@ -111,7 +110,7 @@ abstract class Form {
|
|||||||
private final CAMGChunk viewMode;
|
private final CAMGChunk viewMode;
|
||||||
private final CMAPChunk colorMap;
|
private final CMAPChunk colorMap;
|
||||||
private final AbstractMultiPaletteChunk multiPalette;
|
private final AbstractMultiPaletteChunk multiPalette;
|
||||||
private final XS24Chunk thumbnail;
|
private final XS24Chunk thumbnail; // TVPaint puts these into normal IFF ILBM 24 bit files as well as DEEP/TVPP
|
||||||
private final BODYChunk body;
|
private final BODYChunk body;
|
||||||
|
|
||||||
ILBMForm(int formType) {
|
ILBMForm(int formType) {
|
||||||
@ -149,13 +148,8 @@ abstract class Form {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
int xAspect() {
|
float aspect() {
|
||||||
return bitmapHeader.xAspect;
|
return bitmapHeader.yAspect == 0 ? 0 : (bitmapHeader.xAspect / (float) bitmapHeader.yAspect);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
int yAspect() {
|
|
||||||
return bitmapHeader.yAspect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -343,13 +337,8 @@ abstract class Form {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
int xAspect() {
|
float aspect() {
|
||||||
return deepGlobal.xAspect;
|
return deepGlobal.yAspect == 0 ? 0 : deepGlobal.xAspect / (float) deepGlobal.yAspect;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
int yAspect() {
|
|
||||||
return deepGlobal.yAspect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -413,9 +402,10 @@ abstract class Form {
|
|||||||
return new DEEPForm(formType, deepGlobal, deepLocation, deepPixel, (XS24Chunk) chunk, body);
|
return new DEEPForm(formType, deepGlobal, deepLocation, deepPixel, (XS24Chunk) chunk, body);
|
||||||
}
|
}
|
||||||
else if (chunk instanceof BODYChunk) {
|
else if (chunk instanceof BODYChunk) {
|
||||||
if (body != null) {
|
// TODO: Make a better approach!
|
||||||
throw new IIOException("Multiple " + toChunkStr(chunk.chunkId) + " chunks not allowed");
|
// if (body != null) {
|
||||||
}
|
// throw new IIOException("Multiple " + toChunkStr(chunk.chunkId) + " chunks not allowed");
|
||||||
|
// }
|
||||||
|
|
||||||
return new DEEPForm(formType, deepGlobal, deepLocation, deepPixel, thumbnail, (BODYChunk) chunk);
|
return new DEEPForm(formType, deepGlobal, deepLocation, deepPixel, thumbnail, (BODYChunk) chunk);
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ final class IFFImageMetadata extends AbstractMetadata {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IIOMetadataNode getStandardDimensionNode() {
|
protected IIOMetadataNode getStandardDimensionNode() {
|
||||||
if (header.xAspect() == 0 || header.yAspect() == 0) {
|
if (header.aspect() == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ final class IFFImageMetadata extends AbstractMetadata {
|
|||||||
|
|
||||||
// PixelAspectRatio
|
// PixelAspectRatio
|
||||||
IIOMetadataNode pixelAspectRatio = new IIOMetadataNode("PixelAspectRatio");
|
IIOMetadataNode pixelAspectRatio = new IIOMetadataNode("PixelAspectRatio");
|
||||||
pixelAspectRatio.setAttribute("value", String.valueOf(header.xAspect() / (float) header.yAspect()));
|
pixelAspectRatio.setAttribute("value", String.valueOf(header.aspect()));
|
||||||
dimension.appendChild(pixelAspectRatio);
|
dimension.appendChild(pixelAspectRatio);
|
||||||
|
|
||||||
// TODO: HorizontalScreenSize?
|
// TODO: HorizontalScreenSize?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user