Package java.awt.color

Examples of java.awt.color.ICC_Profile


      if (stream == null) {
        return new ValidationError(ERROR_GRAPHIC_OUTPUT_INTENT_INVALID_ENTRY,
            "OutputIntent object uses a NULL Object");
      }

      ICC_Profile iccp = ICC_Profile.getInstance(stream.getByteArray());
      // check the ICC Profile version (6.2.2)
      if (iccp.getMajorVersion() == 2) {
        if (iccp.getMinorVersion() > 0x40) {
          // TODO on lazy mode this error should be a warning?
          // in PDF 1.4, max version is 02h.40h (meaning V 3.5)
          // see the ICCProfile specification (ICC.1:1998-09)page 13 - §6.1.3 :
          // The current profile version number is "2.4.0" (encoded as 02400000h"
          return new ValidationError(
              ERROR_GRAPHIC_OUTPUT_INTENT_ICC_PROFILE_TOO_RECENT, "Invalid version of the ICCProfile");
        } // else OK
      } else if (iccp.getMajorVersion() > 2) {
        // TODO on lazy mode this error should be a warning?
        // in PDF 1.4, max version is 02h.40h (meaning V 3.5)
        // see the ICCProfile specification (ICC.1:1998-09)page 13 - §6.1.3 :
        // The current profile version number is "2.4.0" (encoded as 02400000h"
        return new ValidationError(
View Full Code Here


   */
  protected boolean processICCBasedColorSpace(PDColorSpace pdcs,
      List<ValidationError> result) {
    PDICCBased iccBased = (PDICCBased) pdcs;
    try {
      ICC_Profile iccp = ICC_Profile.getInstance(iccBased.getPDStream().getByteArray());
      if (iccp == null) {
        result.add(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_ICCBASED, "Unable to read ICCBase color space "));
        return false;
      }
      List<PDColorSpace> altCs = iccBased.getAlternateColorSpaces();
View Full Code Here

        InputStream profile = null;
        ColorSpace cSpace = null;
        try
        {
            profile = stream.createInputStream();
            ICC_Profile iccProfile = ICC_Profile.getInstance( profile );
            cSpace = new ICC_ColorSpace( iccProfile );
            float[] components = new float[numberOfComponents];
            // there maybe a ProfileDataException or a CMMException as there
            // are some issues when loading ICC_Profiles, see PDFBOX-1295
            // Try to create a color as test ...
View Full Code Here

            return null;

        // Now that we have a profile element,
        // try to load the corresponding ICC profile xlink:href
        String href = XLinkSupport.getXLinkHref(profile);
        ICC_Profile p = null;
        if (href != null) {
            try{
                URL baseURL = ((SVGOMDocument)doc).getURLObject();
                URL url = new URL(baseURL, href);
                p = ICC_Profile.getInstance(url.openStream());
View Full Code Here

        IIOMetadataNode markerSequence = (IIOMetadataNode) tree.getElementsByTagName("markerSequence").item(0);

        JFIFSegment jfifSegment = reader.getJFIF();
        JFXXSegment jfxxSegment = reader.getJFXX();
        AdobeDCTSegment adobeDCT = reader.getAdobeDCT();
        ICC_Profile embeddedICCProfile = reader.getEmbeddedICCProfile(true);
        SOFSegment sof = reader.getSOF();

        boolean hasRealJFIF = false;
        boolean hasRealJFXX = false;
        boolean hasRealICC = false;
View Full Code Here

            typeList.add(ImageTypeSpecifier.createFromBufferedImageType(BufferedImage.TYPE_3BYTE_BGR));
            typeList.add(ImageTypeSpecifier.createFromBufferedImageType(BufferedImage.TYPE_INT_RGB));
            typeList.add(ImageTypeSpecifier.createFromBufferedImageType(BufferedImage.TYPE_INT_BGR));

            // We also read and return CMYK if the source image is CMYK/YCCK + original color profile if present
            ICC_Profile profile = getEmbeddedICCProfile(false);

            if (csType == JPEGColorSpace.CMYK || csType == JPEGColorSpace.YCCK) {
                if (profile != null) {
                    typeList.add(ImageTypeSpecifier.createInterleaved(ColorSpaces.createColorSpace(profile), new int[] {3, 2, 1, 0}, DataBuffer.TYPE_BYTE, false, false));
                }
View Full Code Here

        JPEGColorSpace csType = getSourceCSType(getJFIF(), getAdobeDCT(), getSOF());

        switch (csType) {
            case CMYK:
                // Create based on embedded profile if exists, or create from "Generic CMYK"
                ICC_Profile profile = getEmbeddedICCProfile(false);

                if (profile != null) {
                    return ImageTypeSpecifier.createInterleaved(ColorSpaces.createColorSpace(profile), new int[] {3, 2, 1, 0}, DataBuffer.TYPE_BYTE, false, false);
                }
View Full Code Here

//                System.err.println("PixelXDimension: " + exifIFD.getEntryById(EXIF.TAG_PIXEL_X_DIMENSION));
//                System.err.println("PixelYDimension: " + exifIFD.getEntryById(EXIF.TAG_PIXEL_Y_DIMENSION));
//            }
//        }

        ICC_Profile profile = getEmbeddedICCProfile(false);
        AdobeDCTSegment adobeDCT = getAdobeDCT();
        SOFSegment sof = getSOF();
        JPEGColorSpace sourceCSType = getSourceCSType(getJFIF(), adobeDCT, sof);

        // We need to apply ICC profile unless the profile is sRGB/default gray (whatever that is)
View Full Code Here

        if (iccData == null) {
            iccCS = null;
            return;
        }

        ICC_Profile newProfile = null;
        try {
            newProfile = ICC_Profile.getInstance(iccData);
        } catch (IllegalArgumentException e) {
            /*
             * Color profile data seems to be invalid.
             * Ignore this profile.
             */
            iccCS = null;
            warningOccurred(WARNING_IGNORE_INVALID_ICC);

            return;
        }
        byte[] newData = newProfile.getData();

        ICC_Profile oldProfile = null;
        if (iccCS instanceof ICC_ColorSpace) {
            oldProfile = ((ICC_ColorSpace)iccCS).getProfile();
        }
        byte[] oldData = null;
        if (oldProfile != null) {
            oldData = oldProfile.getData();
        }

        /*
         * At the moment we can't rely on the ColorSpace.equals()
         * and ICC_Profile.equals() because they do not detect
View Full Code Here

        ICCMarkerSegment(Node node) throws IIOInvalidTreeException {
            super(JPEG.APP2);
            if (node instanceof IIOMetadataNode) {
                IIOMetadataNode ourNode = (IIOMetadataNode) node;
                ICC_Profile prof = (ICC_Profile) ourNode.getUserObject();
                if (prof != null) {  // May be null
                    profile = prof.getData();
                }
            }
        }
View Full Code Here

TOP

Related Classes of java.awt.color.ICC_Profile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.