use of java.awt.image.PackedColorModel in project Lucee by lucee.
the class Image method info.
public Struct info() throws PageException {
if (sctInfo != null)
return sctInfo;
Struct sctInfo = new StructImpl(), sct;
ImageMetaDrew.addInfo(format, source, sctInfo);
sctInfo = ImageGetEXIFMetadata.flatten(sctInfo);
sctInfo.setEL(KeyConstants._height, new Double(getHeight()));
sctInfo.setEL(KeyConstants._width, new Double(getWidth()));
sctInfo.setEL(KeyConstants._source, source == null ? "" : source.getAbsolutePath());
// sct.setEL("mime_type",getMimeType());
ColorModel cm = image().getColorModel();
sct = new StructImpl();
sctInfo.setEL("colormodel", sct);
sct.setEL("alpha_channel_support", Caster.toBoolean(cm.hasAlpha()));
sct.setEL("alpha_premultiplied", Caster.toBoolean(cm.isAlphaPremultiplied()));
sct.setEL("transparency", toStringTransparency(cm.getTransparency()));
sct.setEL("pixel_size", Caster.toDouble(cm.getPixelSize()));
sct.setEL("num_components", Caster.toDouble(cm.getNumComponents()));
sct.setEL("num_color_components", Caster.toDouble(cm.getNumColorComponents()));
sct.setEL("colorspace", toStringColorSpace(cm.getColorSpace()));
// bits_component
int[] bitspercomponent = cm.getComponentSize();
Array arr = new ArrayImpl();
Double value;
for (int i = 0; i < bitspercomponent.length; i++) {
sct.setEL("bits_component_" + (i + 1), value = new Double(bitspercomponent[i]));
arr.appendEL(value);
}
sct.setEL("bits_component", arr);
// colormodel_type
if (cm instanceof ComponentColorModel)
sct.setEL("colormodel_type", "ComponentColorModel");
else if (cm instanceof IndexColorModel)
sct.setEL("colormodel_type", "IndexColorModel");
else if (cm instanceof PackedColorModel)
sct.setEL("colormodel_type", "PackedColorModel");
else
sct.setEL("colormodel_type", ListUtil.last(cm.getClass().getName(), '.'));
getMetaData(sctInfo);
// Metadata.addInfo(format,source,sctInfo);
Metadata.addExifInfo(format, source, sctInfo);
this.sctInfo = sctInfo;
return sctInfo;
}
Aggregations