Java 类java.awt.color.CMMException 实例源码

项目:OpenJSharp    文件:LCMS.java   
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);
}
项目:OpenJSharp    文件:LCMSTransform.java   
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");
        }
    }
项目:OpenJSharp    文件:LCMSTransform.java   
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");
    }
}
项目:jdk8u-jdk    文件:LCMS.java   
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);
}
项目:jdk8u-jdk    文件:LCMSTransform.java   
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");
        }
    }
项目:jdk8u-jdk    文件:LCMSTransform.java   
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");
    }
}
项目:jdk8u-jdk    文件:InvalidRenderIntentTest.java   
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.");
}
项目:openjdk-jdk10    文件:LCMS.java   
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);
}
项目:openjdk-jdk10    文件:LCMSTransform.java   
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");
        }
    }
项目:openjdk-jdk10    文件:LCMSTransform.java   
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");
    }
}
项目:openjdk-jdk10    文件:InvalidRenderIntentTest.java   
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.");
}
项目:openjdk9    文件:LCMS.java   
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);
}
项目:openjdk9    文件:LCMSTransform.java   
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");
        }
    }
项目:openjdk9    文件:LCMSTransform.java   
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");
    }
}
项目:openjdk9    文件:InvalidRenderIntentTest.java   
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.");
}
项目:jdk8u_jdk    文件:LCMS.java   
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);
}
项目:jdk8u_jdk    文件:LCMSTransform.java   
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");
        }
    }
项目:jdk8u_jdk    文件:LCMSTransform.java   
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");
    }
}
项目:jdk8u_jdk    文件:InvalidRenderIntentTest.java   
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.");
}
项目:lookaside_java-1.8.0-openjdk    文件:LCMS.java   
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);
}
项目:lookaside_java-1.8.0-openjdk    文件:LCMSTransform.java   
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");
        }
    }
项目:lookaside_java-1.8.0-openjdk    文件:LCMSTransform.java   
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");
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:InvalidRenderIntentTest.java   
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.");
}
项目:communote-server    文件:FileSystemCachingImageManager.java   
/**
 * Resize the given image.
 *
 * @param typeName
 *            Name of the type.
 * @param image
 *            Image to resize.
 * @param descriptor
 *            The descriptor.
 * @param imageFormatType
 *            the mime type of the image to resize
 * @return The resized image or null if resizing failed
 * @throws IOException
 *             in case reading the image to resize failed
 */
private Image resizeImage(String typeName, Image image, ImageDescriptor descriptor,
        ImageFormatType imageFormatType) throws IOException {
    ImageScaler scaler = new ImageScaler(descriptor.getSize(), imageFormatType);
    scaler.setDrawBackground(descriptor.isDrawBackground());
    scaler.setBackgroundColor(descriptor.getBackgroundColor());
    scaler.setSameAspectRatio(descriptor.isPreserveAspectRation());
    scaler.setHorizontalAlignment(descriptor.getHorizontalAlignment());
    scaler.setVerticalAlignment(descriptor.getVerticalAlignment());
    byte[] resizedImage = null;
    try {
        resizedImage = scaler.resizeImage(image.getBytes());
    } catch (CMMException e) {
        LOGGER.error("Was not able to read an image: " + typeName + ":"
                + descriptor.getIdentifier() + " -> " + e.getMessage());
    }
    if (resizedImage != null) {
        return new ByteArrayImage(resizedImage, imageFormatType.getContentType(),
                image.getLastModificationDate(), image.getProviderId(), image.isDefaultImage(),
                image.isExternal());
    }
    return null;
}
项目:infobip-open-jdk-8    文件:LCMS.java   
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);
}
项目:infobip-open-jdk-8    文件:LCMSTransform.java   
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");
        }
    }
项目:infobip-open-jdk-8    文件:LCMSTransform.java   
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");
    }
}
项目:infobip-open-jdk-8    文件:InvalidRenderIntentTest.java   
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.");
}
项目:jdk8u-dev-jdk    文件:LCMS.java   
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);
}
项目:jdk8u-dev-jdk    文件:LCMSTransform.java   
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");
        }
    }
项目:jdk8u-dev-jdk    文件:LCMSTransform.java   
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");
    }
}
项目:jdk8u-dev-jdk    文件:InvalidRenderIntentTest.java   
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.");
}
项目:yamj-v2    文件:JpegReader.java   
/**
 * Attempt to read the image as a CYMK or YCCK file.
 *
 * @param file
 * @param reader
 * @return
 */
private BufferedImage readImageCmyk(File file, ImageReader reader) {
    colorType = COLOR_TYPE_CMYK;
    BufferedImage image;
    try {
        checkAdobeMarker(file);
        ICC_Profile profile = Sanselan.getICCProfile(file);
        WritableRaster raster = (WritableRaster) reader.readRaster(0, null);

        if (colorType == COLOR_TYPE_YCCK) {
            convertYcckToCmyk(raster);
        }

        if (hasAdobeMarker) {
            convertInvertedColors(raster);
        }

        image = convertCmykToRgb(raster, profile);
    } catch (IOException | ImageReadException | CMMException ex) {
        LOG.warn("Failed to transform image: {}, error: {}", file.getAbsolutePath(), ex.getMessage());
        image = null;
    }
    return image;
}
项目:OLD-OpenJDK8    文件:LCMS.java   
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);
}
项目:OLD-OpenJDK8    文件:LCMSTransform.java   
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");
        }
    }
项目:OLD-OpenJDK8    文件:LCMSTransform.java   
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");
    }
}
项目:OLD-OpenJDK8    文件:InvalidRenderIntentTest.java   
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.");
}
项目:openjdk-jdk7u-jdk    文件:LCMSTransform.java   
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");
        }
    }
项目:openjdk-jdk7u-jdk    文件:LCMSTransform.java   
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");
    }
}
项目:openjdk-icedtea7    文件:LCMSTransform.java   
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");
        }
    }