java.awt.color.CMMException Java Examples

The following examples show how to use java.awt.color.CMMException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LCMSTransform.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public byte[] colorConvert(byte[] src, byte[] dst) {
    if (dst == null) {
        dst = new byte [(src.length/getNumInComponents())*getNumOutComponents()];
    }

    try {
        LCMSImageLayout srcIL = new LCMSImageLayout(
                src, src.length/getNumInComponents(),
                LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
                LCMSImageLayout.BYTES_SH(1), getNumInComponents());

        LCMSImageLayout dstIL = new LCMSImageLayout(
                dst, dst.length/getNumOutComponents(),
                LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
                LCMSImageLayout.BYTES_SH(1), getNumOutComponents());

        doTransform(srcIL, dstIL);

        return dst;
    } catch (ImageLayoutException e) {
        throw new CMMException("Unable to convert data");
    }
}
 
Example #2
Source File: LCMS.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
static long createTransform(
    LCMSProfile[] profiles, int renderType,
    int inFormatter, boolean isInIntPacked,
    int outFormatter, boolean isOutIntPacked,
    Object disposerRef)
{
    long[] ptrs = new long[profiles.length];

    for (int i = 0; i < profiles.length; i++) {
        if (profiles[i] == null) throw new CMMException("Unknown profile ID");

        ptrs[i] = profiles[i].getLcmsPtr();
    }

    return createNativeTransform(ptrs, renderType, inFormatter,
            isInIntPacked, outFormatter, isOutIntPacked, disposerRef);
}
 
Example #3
Source File: InvalidRenderIntentTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    ICC_Profile pSRGB = ICC_Profile.getInstance(CS_sRGB);

    byte[] raw_data = pSRGB.getData();

    setRenderingIntent(0x1000000, raw_data);

    ICC_Profile p = ICC_Profile.getInstance(raw_data);

    ICC_ColorSpace cs = new ICC_ColorSpace(p);

    // perfrom test color conversion
    ColorConvertOp op = new ColorConvertOp(cs,
            ColorSpace.getInstance(CS_sRGB), null);
    BufferedImage src = new BufferedImage(1, 1, TYPE_3BYTE_BGR);
    BufferedImage dst = new BufferedImage(1, 1, TYPE_3BYTE_BGR);

    try {
        op.filter(src.getRaster(), dst.getRaster());
    } catch (CMMException e) {
        throw new RuntimeException("Test failed.", e);
    }
    System.out.println("Test passed.");
}
 
Example #4
Source File: LCMS.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
static long createTransform(
    LCMSProfile[] profiles, int renderType,
    int inFormatter, boolean isInIntPacked,
    int outFormatter, boolean isOutIntPacked,
    Object disposerRef)
{
    long[] ptrs = new long[profiles.length];

    for (int i = 0; i < profiles.length; i++) {
        if (profiles[i] == null) throw new CMMException("Unknown profile ID");

        ptrs[i] = profiles[i].getLcmsPtr();
    }

    return createNativeTransform(ptrs, renderType, inFormatter,
            isInIntPacked, outFormatter, isOutIntPacked, disposerRef);
}
 
Example #5
Source File: InvalidRenderIntentTest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    ICC_Profile pSRGB = ICC_Profile.getInstance(CS_sRGB);

    byte[] raw_data = pSRGB.getData();

    setRenderingIntent(0x1000000, raw_data);

    ICC_Profile p = ICC_Profile.getInstance(raw_data);

    ICC_ColorSpace cs = new ICC_ColorSpace(p);

    // perfrom test color conversion
    ColorConvertOp op = new ColorConvertOp(cs,
            ColorSpace.getInstance(CS_sRGB), null);
    BufferedImage src = new BufferedImage(1, 1, TYPE_3BYTE_BGR);
    BufferedImage dst = new BufferedImage(1, 1, TYPE_3BYTE_BGR);

    try {
        op.filter(src.getRaster(), dst.getRaster());
    } catch (CMMException e) {
        throw new RuntimeException("Test failed.", e);
    }
    System.out.println("Test passed.");
}
 
Example #6
Source File: LCMSTransform.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public short[] colorConvert(short[] src, short[] dst) {

        if (dst == null) {
            dst = new short [(src.length/getNumInComponents())*getNumOutComponents()];
        }

        try {
            LCMSImageLayout srcIL = new LCMSImageLayout(
                    src, src.length/getNumInComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2);

            LCMSImageLayout dstIL = new LCMSImageLayout(
                    dst, dst.length/getNumOutComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2);

            doTransform(srcIL, dstIL);

            return dst;
        } catch (ImageLayoutException e) {
            throw new CMMException("Unable to convert data");
        }
    }
 
Example #7
Source File: LCMSTransform.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public short[] colorConvert(short[] src, short[] dst) {

        if (dst == null) {
            dst = new short [(src.length/getNumInComponents())*getNumOutComponents()];
        }

        try {
            LCMSImageLayout srcIL = new LCMSImageLayout(
                    src, src.length/getNumInComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2);

            LCMSImageLayout dstIL = new LCMSImageLayout(
                    dst, dst.length/getNumOutComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2);

            doTransform(srcIL, dstIL);

            return dst;
        } catch (ImageLayoutException e) {
            throw new CMMException("Unable to convert data");
        }
    }
 
Example #8
Source File: LCMSTransform.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public byte[] colorConvert(byte[] src, byte[] dst) {
    if (dst == null) {
        dst = new byte [(src.length/getNumInComponents())*getNumOutComponents()];
    }

    try {
        LCMSImageLayout srcIL = new LCMSImageLayout(
                src, src.length/getNumInComponents(),
                LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
                LCMSImageLayout.BYTES_SH(1), getNumInComponents());

        LCMSImageLayout dstIL = new LCMSImageLayout(
                dst, dst.length/getNumOutComponents(),
                LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
                LCMSImageLayout.BYTES_SH(1), getNumOutComponents());

        doTransform(srcIL, dstIL);

        return dst;
    } catch (ImageLayoutException e) {
        throw new CMMException("Unable to convert data");
    }
}
 
Example #9
Source File: InvalidRenderIntentTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    ICC_Profile pSRGB = ICC_Profile.getInstance(CS_sRGB);

    byte[] raw_data = pSRGB.getData();

    setRenderingIntent(0x1000000, raw_data);

    ICC_Profile p = ICC_Profile.getInstance(raw_data);

    ICC_ColorSpace cs = new ICC_ColorSpace(p);

    // perfrom test color conversion
    ColorConvertOp op = new ColorConvertOp(cs,
            ColorSpace.getInstance(CS_sRGB), null);
    BufferedImage src = new BufferedImage(1, 1, TYPE_3BYTE_BGR);
    BufferedImage dst = new BufferedImage(1, 1, TYPE_3BYTE_BGR);

    try {
        op.filter(src.getRaster(), dst.getRaster());
    } catch (CMMException e) {
        throw new RuntimeException("Test failed.", e);
    }
    System.out.println("Test passed.");
}
 
Example #10
Source File: LCMS.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
static long createTransform(
    LCMSProfile[] profiles, int renderType,
    int inFormatter, boolean isInIntPacked,
    int outFormatter, boolean isOutIntPacked,
    Object disposerRef)
{
    long[] ptrs = new long[profiles.length];

    for (int i = 0; i < profiles.length; i++) {
        if (profiles[i] == null) throw new CMMException("Unknown profile ID");

        ptrs[i] = profiles[i].getLcmsPtr();
    }

    return createNativeTransform(ptrs, renderType, inFormatter,
            isInIntPacked, outFormatter, isOutIntPacked, disposerRef);
}
 
Example #11
Source File: LCMSTransform.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public short[] colorConvert(short[] src, short[] dst) {

        if (dst == null) {
            dst = new short [(src.length/getNumInComponents())*getNumOutComponents()];
        }

        try {
            LCMSImageLayout srcIL = new LCMSImageLayout(
                    src, src.length/getNumInComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2);

            LCMSImageLayout dstIL = new LCMSImageLayout(
                    dst, dst.length/getNumOutComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2);

            doTransform(srcIL, dstIL);

            return dst;
        } catch (ImageLayoutException e) {
            throw new CMMException("Unable to convert data");
        }
    }
 
Example #12
Source File: LCMSTransform.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public byte[] colorConvert(byte[] src, byte[] dst) {
    if (dst == null) {
        dst = new byte [(src.length/getNumInComponents())*getNumOutComponents()];
    }

    try {
        LCMSImageLayout srcIL = new LCMSImageLayout(
                src, src.length/getNumInComponents(),
                LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
                LCMSImageLayout.BYTES_SH(1), getNumInComponents());

        LCMSImageLayout dstIL = new LCMSImageLayout(
                dst, dst.length/getNumOutComponents(),
                LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
                LCMSImageLayout.BYTES_SH(1), getNumOutComponents());

        doTransform(srcIL, dstIL);

        return dst;
    } catch (ImageLayoutException e) {
        throw new CMMException("Unable to convert data");
    }
}
 
Example #13
Source File: InvalidRenderIntentTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    ICC_Profile pSRGB = ICC_Profile.getInstance(CS_sRGB);

    byte[] raw_data = pSRGB.getData();

    setRenderingIntent(0x1000000, raw_data);

    ICC_Profile p = ICC_Profile.getInstance(raw_data);

    ICC_ColorSpace cs = new ICC_ColorSpace(p);

    // perfrom test color conversion
    ColorConvertOp op = new ColorConvertOp(cs,
            ColorSpace.getInstance(CS_sRGB), null);
    BufferedImage src = new BufferedImage(1, 1, TYPE_3BYTE_BGR);
    BufferedImage dst = new BufferedImage(1, 1, TYPE_3BYTE_BGR);

    try {
        op.filter(src.getRaster(), dst.getRaster());
    } catch (CMMException e) {
        throw new RuntimeException("Test failed.", e);
    }
    System.out.println("Test passed.");
}
 
Example #14
Source File: PDICCBased.java    From sambox with Apache License 2.0 6 votes vote down vote up
@Override
public BufferedImage toRGBImage(WritableRaster raster) throws IOException
{
    if (awtColorSpace != null)
    {
        try
        {
            return toRGBImageAWT(raster, awtColorSpace);
        }
        catch (CMMException e)
        {
            LOG.error(
                    "Failure using embedded ICC profile ({}), using alternate color space: {}",
                    e.getMessage(), alternateColorSpace);
        }
    }
    return alternateColorSpace.toRGBImage(raster);
}
 
Example #15
Source File: LCMSTransform.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public short[] colorConvert(short[] src, short[] dst) {

        if (dst == null) {
            dst = new short [(src.length/getNumInComponents())*getNumOutComponents()];
        }

        try {
            LCMSImageLayout srcIL = new LCMSImageLayout(
                    src, src.length/getNumInComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2);

            LCMSImageLayout dstIL = new LCMSImageLayout(
                    dst, dst.length/getNumOutComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2);

            doTransform(srcIL, dstIL);

            return dst;
        } catch (ImageLayoutException e) {
            throw new CMMException("Unable to convert data");
        }
    }
 
Example #16
Source File: LCMS.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
static long createTransform(
    LCMSProfile[] profiles, int renderType,
    int inFormatter, boolean isInIntPacked,
    int outFormatter, boolean isOutIntPacked,
    Object disposerRef)
{
    long[] ptrs = new long[profiles.length];

    for (int i = 0; i < profiles.length; i++) {
        if (profiles[i] == null) throw new CMMException("Unknown profile ID");

        ptrs[i] = profiles[i].getLcmsPtr();
    }

    return createNativeTransform(ptrs, renderType, inFormatter,
            isInIntPacked, outFormatter, isOutIntPacked, disposerRef);
}
 
Example #17
Source File: LCMSTransform.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public short[] colorConvert(short[] src, short[] dst) {

        if (dst == null) {
            dst = new short [(src.length/getNumInComponents())*getNumOutComponents()];
        }

        try {
            LCMSImageLayout srcIL = new LCMSImageLayout(
                    src, src.length/getNumInComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2);

            LCMSImageLayout dstIL = new LCMSImageLayout(
                    dst, dst.length/getNumOutComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2);

            doTransform(srcIL, dstIL);

            return dst;
        } catch (ImageLayoutException e) {
            throw new CMMException("Unable to convert data");
        }
    }
 
Example #18
Source File: LCMS.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
static long createTransform(
    LCMSProfile[] profiles, int renderType,
    int inFormatter, boolean isInIntPacked,
    int outFormatter, boolean isOutIntPacked,
    Object disposerRef)
{
    long[] ptrs = new long[profiles.length];

    for (int i = 0; i < profiles.length; i++) {
        if (profiles[i] == null) throw new CMMException("Unknown profile ID");

        ptrs[i] = profiles[i].getLcmsPtr();
    }

    return createNativeTransform(ptrs, renderType, inFormatter,
            isInIntPacked, outFormatter, isOutIntPacked, disposerRef);
}
 
Example #19
Source File: LCMSTransform.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public byte[] colorConvert(byte[] src, byte[] dst) {
    if (dst == null) {
        dst = new byte [(src.length/getNumInComponents())*getNumOutComponents()];
    }

    try {
        LCMSImageLayout srcIL = new LCMSImageLayout(
                src, src.length/getNumInComponents(),
                LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
                LCMSImageLayout.BYTES_SH(1), getNumInComponents());

        LCMSImageLayout dstIL = new LCMSImageLayout(
                dst, dst.length/getNumOutComponents(),
                LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
                LCMSImageLayout.BYTES_SH(1), getNumOutComponents());

        doTransform(srcIL, dstIL);

        return dst;
    } catch (ImageLayoutException e) {
        throw new CMMException("Unable to convert data");
    }
}
 
Example #20
Source File: InvalidRenderIntentTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    ICC_Profile pSRGB = ICC_Profile.getInstance(CS_sRGB);

    byte[] raw_data = pSRGB.getData();

    setRenderingIntent(0x1000000, raw_data);

    ICC_Profile p = ICC_Profile.getInstance(raw_data);

    ICC_ColorSpace cs = new ICC_ColorSpace(p);

    // perfrom test color conversion
    ColorConvertOp op = new ColorConvertOp(cs,
            ColorSpace.getInstance(CS_sRGB), null);
    BufferedImage src = new BufferedImage(1, 1, TYPE_3BYTE_BGR);
    BufferedImage dst = new BufferedImage(1, 1, TYPE_3BYTE_BGR);

    try {
        op.filter(src.getRaster(), dst.getRaster());
    } catch (CMMException e) {
        throw new RuntimeException("Test failed.", e);
    }
    System.out.println("Test passed.");
}
 
Example #21
Source File: LCMSTransform.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public byte[] colorConvert(byte[] src, byte[] dst) {
    if (dst == null) {
        dst = new byte [(src.length/getNumInComponents())*getNumOutComponents()];
    }

    try {
        LCMSImageLayout srcIL = new LCMSImageLayout(
                src, src.length/getNumInComponents(),
                LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
                LCMSImageLayout.BYTES_SH(1), getNumInComponents());

        LCMSImageLayout dstIL = new LCMSImageLayout(
                dst, dst.length/getNumOutComponents(),
                LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
                LCMSImageLayout.BYTES_SH(1), getNumOutComponents());

        doTransform(srcIL, dstIL);

        return dst;
    } catch (ImageLayoutException e) {
        throw new CMMException("Unable to convert data");
    }
}
 
Example #22
Source File: LCMSTransform.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public short[] colorConvert(short[] src, short[] dst) {

        if (dst == null) {
            dst = new short [(src.length/getNumInComponents())*getNumOutComponents()];
        }

        try {
            LCMSImageLayout srcIL = new LCMSImageLayout(
                    src, src.length/getNumInComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2);

            LCMSImageLayout dstIL = new LCMSImageLayout(
                    dst, dst.length/getNumOutComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2);

            doTransform(srcIL, dstIL);

            return dst;
        } catch (ImageLayoutException e) {
            throw new CMMException("Unable to convert data");
        }
    }
 
Example #23
Source File: LCMS.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
static long createTransform(
    LCMSProfile[] profiles, int renderType,
    int inFormatter, boolean isInIntPacked,
    int outFormatter, boolean isOutIntPacked,
    Object disposerRef)
{
    long[] ptrs = new long[profiles.length];

    for (int i = 0; i < profiles.length; i++) {
        if (profiles[i] == null) throw new CMMException("Unknown profile ID");

        ptrs[i] = profiles[i].getLcmsPtr();
    }

    return createNativeTransform(ptrs, renderType, inFormatter,
            isInIntPacked, outFormatter, isOutIntPacked, disposerRef);
}
 
Example #24
Source File: LCMS.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
static long createTransform(
    LCMSProfile[] profiles, int renderType,
    int inFormatter, boolean isInIntPacked,
    int outFormatter, boolean isOutIntPacked,
    Object disposerRef)
{
    long[] ptrs = new long[profiles.length];

    for (int i = 0; i < profiles.length; i++) {
        if (profiles[i] == null) throw new CMMException("Unknown profile ID");

        ptrs[i] = profiles[i].getLcmsPtr();
    }

    return createNativeTransform(ptrs, renderType, inFormatter,
            isInIntPacked, outFormatter, isOutIntPacked, disposerRef);
}
 
Example #25
Source File: LCMSTransform.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public byte[] colorConvert(byte[] src, byte[] dst) {
    if (dst == null) {
        dst = new byte [(src.length/getNumInComponents())*getNumOutComponents()];
    }

    try {
        LCMSImageLayout srcIL = new LCMSImageLayout(
                src, src.length/getNumInComponents(),
                LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
                LCMSImageLayout.BYTES_SH(1), getNumInComponents());

        LCMSImageLayout dstIL = new LCMSImageLayout(
                dst, dst.length/getNumOutComponents(),
                LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
                LCMSImageLayout.BYTES_SH(1), getNumOutComponents());

        doTransform(srcIL, dstIL);

        return dst;
    } catch (ImageLayoutException e) {
        throw new CMMException("Unable to convert data");
    }
}
 
Example #26
Source File: LCMSTransform.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public short[] colorConvert(short[] src, short[] dst) {

        if (dst == null) {
            dst = new short [(src.length/getNumInComponents())*getNumOutComponents()];
        }

        try {
            LCMSImageLayout srcIL = new LCMSImageLayout(
                    src, src.length/getNumInComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2);

            LCMSImageLayout dstIL = new LCMSImageLayout(
                    dst, dst.length/getNumOutComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2);

            doTransform(srcIL, dstIL);

            return dst;
        } catch (ImageLayoutException e) {
            throw new CMMException("Unable to convert data");
        }
    }
 
Example #27
Source File: LCMS.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
static long createTransform(
    LCMSProfile[] profiles, int renderType,
    int inFormatter, boolean isInIntPacked,
    int outFormatter, boolean isOutIntPacked,
    Object disposerRef)
{
    long[] ptrs = new long[profiles.length];

    for (int i = 0; i < profiles.length; i++) {
        if (profiles[i] == null) throw new CMMException("Unknown profile ID");

        ptrs[i] = profiles[i].getLcmsPtr();
    }

    return createNativeTransform(ptrs, renderType, inFormatter,
            isInIntPacked, outFormatter, isOutIntPacked, disposerRef);
}
 
Example #28
Source File: LCMSTransform.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public byte[] colorConvert(byte[] src, byte[] dst) {
    if (dst == null) {
        dst = new byte [(src.length/getNumInComponents())*getNumOutComponents()];
    }

    try {
        LCMSImageLayout srcIL = new LCMSImageLayout(
                src, src.length/getNumInComponents(),
                LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
                LCMSImageLayout.BYTES_SH(1), getNumInComponents());

        LCMSImageLayout dstIL = new LCMSImageLayout(
                dst, dst.length/getNumOutComponents(),
                LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
                LCMSImageLayout.BYTES_SH(1), getNumOutComponents());

        doTransform(srcIL, dstIL);

        return dst;
    } catch (ImageLayoutException e) {
        throw new CMMException("Unable to convert data");
    }
}
 
Example #29
Source File: LCMSTransform.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public short[] colorConvert(short[] src, short[] dst) {

        if (dst == null) {
            dst = new short [(src.length/getNumInComponents())*getNumOutComponents()];
        }

        try {
            LCMSImageLayout srcIL = new LCMSImageLayout(
                    src, src.length/getNumInComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2);

            LCMSImageLayout dstIL = new LCMSImageLayout(
                    dst, dst.length/getNumOutComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2);

            doTransform(srcIL, dstIL);

            return dst;
        } catch (ImageLayoutException e) {
            throw new CMMException("Unable to convert data");
        }
    }
 
Example #30
Source File: LCMSTransform.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public short[] colorConvert(short[] src, short[] dst) {

        if (dst == null) {
            dst = new short [(src.length/getNumInComponents())*getNumOutComponents()];
        }

        try {
            LCMSImageLayout srcIL = new LCMSImageLayout(
                    src, src.length/getNumInComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumInComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumInComponents()*2);

            LCMSImageLayout dstIL = new LCMSImageLayout(
                    dst, dst.length/getNumOutComponents(),
                    LCMSImageLayout.CHANNELS_SH(getNumOutComponents()) |
                    LCMSImageLayout.BYTES_SH(2), getNumOutComponents()*2);

            doTransform(srcIL, dstIL);

            return dst;
        } catch (ImageLayoutException e) {
            throw new CMMException("Unable to convert data");
        }
    }