Search in sources :

Example 1 with PackedColorModel

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;
}
Also used : Array(lucee.runtime.type.Array) PackedColorModel(java.awt.image.PackedColorModel) StructImpl(lucee.runtime.type.StructImpl) IndexColorModel(java.awt.image.IndexColorModel) DirectColorModel(java.awt.image.DirectColorModel) ComponentColorModel(java.awt.image.ComponentColorModel) PackedColorModel(java.awt.image.PackedColorModel) ColorModel(java.awt.image.ColorModel) ComponentColorModel(java.awt.image.ComponentColorModel) ArrayImpl(lucee.runtime.type.ArrayImpl) Point(java.awt.Point) Struct(lucee.runtime.type.Struct) IndexColorModel(java.awt.image.IndexColorModel)

Aggregations

Point (java.awt.Point)1 ColorModel (java.awt.image.ColorModel)1 ComponentColorModel (java.awt.image.ComponentColorModel)1 DirectColorModel (java.awt.image.DirectColorModel)1 IndexColorModel (java.awt.image.IndexColorModel)1 PackedColorModel (java.awt.image.PackedColorModel)1 Array (lucee.runtime.type.Array)1 ArrayImpl (lucee.runtime.type.ArrayImpl)1 Struct (lucee.runtime.type.Struct)1 StructImpl (lucee.runtime.type.StructImpl)1