Java Code Examples for java.awt.color.ColorSpace#CS_GRAY

The following examples show how to use java.awt.color.ColorSpace#CS_GRAY . 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: ImageDump.java    From commons-imaging with Apache License 2.0 6 votes vote down vote up
private String colorSpaceTypeToName(final ColorSpace cs) {
    // System.out.println(prefix + ": " + "type: "
    // + cs.getType() );
    switch (cs.getType()) {
    case ColorSpace.TYPE_CMYK:
        return "TYPE_CMYK";
    case ColorSpace.TYPE_RGB:
        return "TYPE_RGB";

    case ColorSpace.CS_sRGB:
        return "CS_sRGB";
    case ColorSpace.CS_GRAY:
        return "CS_GRAY";
    case ColorSpace.CS_CIEXYZ:
        return "CS_CIEXYZ";
    case ColorSpace.CS_LINEAR_RGB:
        return "CS_LINEAR_RGB";
    case ColorSpace.CS_PYCC:
        return "CS_PYCC";
    default:
        return "unknown";
    }
}
 
Example 2
Source File: CMMTests.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void init() {
    cmmRoot = new Group("cmm", "Color Management Benchmarks");
    cmmRoot.setTabbed();

    cmmOptRoot = new Group(cmmRoot, "opts", "General Options");

    /*
    usePlatfromProfiles =
            new Option.Enable(cmmOptRoot, "csPlatfrom",
                    "Use Platfrom Profiles", false);
    */
    int[] colorspaces = new int[] {
        ColorSpace.CS_sRGB,
        ColorSpace.CS_GRAY,
        ColorSpace.CS_LINEAR_RGB,
        ColorSpace.CS_CIEXYZ
    };

    String[] csNames = new String[]{
        "CS_sRGB",
        "CS_GRAY",
        "CS_LINEAR_RGB",
        "CS_CIEXYZ"
    };

    csList = new Option.IntList(cmmOptRoot,
            "profiles", "Color Profiles",
            colorspaces, csNames, csNames, 0x8);

    ColorConversionTests.init();
    ProfileTests.init();
}
 
Example 3
Source File: CMMTests.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void init() {
    cmmRoot = new Group("cmm", "Color Management Benchmarks");
    cmmRoot.setTabbed();

    cmmOptRoot = new Group(cmmRoot, "opts", "General Options");

    /*
    usePlatfromProfiles =
            new Option.Enable(cmmOptRoot, "csPlatfrom",
                    "Use Platfrom Profiles", false);
    */
    int[] colorspaces = new int[] {
        ColorSpace.CS_sRGB,
        ColorSpace.CS_GRAY,
        ColorSpace.CS_LINEAR_RGB,
        ColorSpace.CS_CIEXYZ
    };

    String[] csNames = new String[]{
        "CS_sRGB",
        "CS_GRAY",
        "CS_LINEAR_RGB",
        "CS_CIEXYZ"
    };

    csList = new Option.IntList(cmmOptRoot,
            "profiles", "Color Profiles",
            colorspaces, csNames, csNames, 0x8);

    ColorConversionTests.init();
    ProfileTests.init();
}
 
Example 4
Source File: CMMTests.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected static ColorSpace getColorSpace(TestEnvironment env) {
    ColorSpace cs;
    Boolean usePlatfrom = true; //(Boolean)env.getModifier(usePlatfromProfiles);

    int cs_code = env.getIntValue(csList);
    if (usePlatfrom) {
        cs = ColorSpace.getInstance(cs_code);
    } else {
        String resource = "profiles/";
        switch (cs_code) {
            case ColorSpace.CS_CIEXYZ:
                resource += "CIEXYZ.pf";
                break;
            case ColorSpace.CS_GRAY:
                resource += "GRAY.pf";
                break;
            case ColorSpace.CS_LINEAR_RGB:
                resource += "LINEAR_RGB.pf";
                break;
            case ColorSpace.CS_PYCC:
                resource += "PYCC.pf";
                break;
            case ColorSpace.CS_sRGB:
                resource += "sRGB.pf";
                break;
            default:
                throw new RuntimeException("Unknown color space: " + cs_code);
        }

        try {
            InputStream is = CMMTests.class.getResourceAsStream(resource);
            ICC_Profile p = ICC_Profile.getInstance(is);

            cs = new ICC_ColorSpace(p);
        } catch (IOException e) {
            throw new RuntimeException("Unable load profile from resource " + resource, e);
        }
    }
    return cs;
}
 
Example 5
Source File: CMMTests.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void init() {
    cmmRoot = new Group("cmm", "Color Management Benchmarks");
    cmmRoot.setTabbed();

    cmmOptRoot = new Group(cmmRoot, "opts", "General Options");

    /*
    usePlatformProfiles =
            new Option.Enable(cmmOptRoot, "csPlatform",
                    "Use Platform Profiles", false);
    */
    int[] colorspaces = new int[] {
        ColorSpace.CS_sRGB,
        ColorSpace.CS_GRAY,
        ColorSpace.CS_LINEAR_RGB,
        ColorSpace.CS_CIEXYZ
    };

    String[] csNames = new String[]{
        "CS_sRGB",
        "CS_GRAY",
        "CS_LINEAR_RGB",
        "CS_CIEXYZ"
    };

    csList = new Option.IntList(cmmOptRoot,
            "profiles", "Color Profiles",
            colorspaces, csNames, csNames, 0x8);

    ColorConversionTests.init();
    ProfileTests.init();
}
 
Example 6
Source File: ColConvTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
static String getCSName(int cs) {
    switch(cs) {
        case ColorSpace.CS_GRAY:
            return "CS_GRAY";
        case ColorSpace.CS_CIEXYZ:
            return "CS_CIEXYZ";
        case ColorSpace.CS_LINEAR_RGB:
            return "CS_LINEAR_RGB";
        case ColorSpace.CS_PYCC:
            return "CS_PYCC";
        case ColorSpace.CS_sRGB:
            return "CS_sRGB";
    }
    return "UNKNOWN";
}
 
Example 7
Source File: CMMTests.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected static ColorSpace getColorSpace(TestEnvironment env) {
    ColorSpace cs;
    Boolean usePlatfrom = true; //(Boolean)env.getModifier(usePlatfromProfiles);

    int cs_code = env.getIntValue(csList);
    if (usePlatfrom) {
        cs = ColorSpace.getInstance(cs_code);
    } else {
        String resource = "profiles/";
        switch (cs_code) {
            case ColorSpace.CS_CIEXYZ:
                resource += "CIEXYZ.pf";
                break;
            case ColorSpace.CS_GRAY:
                resource += "GRAY.pf";
                break;
            case ColorSpace.CS_LINEAR_RGB:
                resource += "LINEAR_RGB.pf";
                break;
            case ColorSpace.CS_PYCC:
                resource += "PYCC.pf";
                break;
            case ColorSpace.CS_sRGB:
                resource += "sRGB.pf";
                break;
            default:
                throw new RuntimeException("Unknown color space: " + cs_code);
        }

        try {
            InputStream is = CMMTests.class.getResourceAsStream(resource);
            ICC_Profile p = ICC_Profile.getInstance(is);

            cs = new ICC_ColorSpace(p);
        } catch (IOException e) {
            throw new RuntimeException("Unable load profile from resource " + resource, e);
        }
    }
    return cs;
}
 
Example 8
Source File: CMMTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void init() {
    cmmRoot = new Group("cmm", "Color Management Benchmarks");
    cmmRoot.setTabbed();

    cmmOptRoot = new Group(cmmRoot, "opts", "General Options");

    /*
    usePlatfromProfiles =
            new Option.Enable(cmmOptRoot, "csPlatfrom",
                    "Use Platfrom Profiles", false);
    */
    int[] colorspaces = new int[] {
        ColorSpace.CS_sRGB,
        ColorSpace.CS_GRAY,
        ColorSpace.CS_LINEAR_RGB,
        ColorSpace.CS_CIEXYZ
    };

    String[] csNames = new String[]{
        "CS_sRGB",
        "CS_GRAY",
        "CS_LINEAR_RGB",
        "CS_CIEXYZ"
    };

    csList = new Option.IntList(cmmOptRoot,
            "profiles", "Color Profiles",
            colorspaces, csNames, csNames, 0x8);

    ColorConversionTests.init();
    ProfileTests.init();
}
 
Example 9
Source File: CMMTests.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void init() {
    cmmRoot = new Group("cmm", "Color Management Benchmarks");
    cmmRoot.setTabbed();

    cmmOptRoot = new Group(cmmRoot, "opts", "General Options");

    /*
    usePlatfromProfiles =
            new Option.Enable(cmmOptRoot, "csPlatfrom",
                    "Use Platfrom Profiles", false);
    */
    int[] colorspaces = new int[] {
        ColorSpace.CS_sRGB,
        ColorSpace.CS_GRAY,
        ColorSpace.CS_LINEAR_RGB,
        ColorSpace.CS_CIEXYZ
    };

    String[] csNames = new String[]{
        "CS_sRGB",
        "CS_GRAY",
        "CS_LINEAR_RGB",
        "CS_CIEXYZ"
    };

    csList = new Option.IntList(cmmOptRoot,
            "profiles", "Color Profiles",
            colorspaces, csNames, csNames, 0x8);

    ColorConversionTests.init();
    ProfileTests.init();
}
 
Example 10
Source File: CMMTests.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected static ColorSpace getColorSpace(TestEnvironment env) {
    ColorSpace cs;
    Boolean usePlatfrom = true; //(Boolean)env.getModifier(usePlatfromProfiles);

    int cs_code = env.getIntValue(csList);
    if (usePlatfrom) {
        cs = ColorSpace.getInstance(cs_code);
    } else {
        String resource = "profiles/";
        switch (cs_code) {
            case ColorSpace.CS_CIEXYZ:
                resource += "CIEXYZ.pf";
                break;
            case ColorSpace.CS_GRAY:
                resource += "GRAY.pf";
                break;
            case ColorSpace.CS_LINEAR_RGB:
                resource += "LINEAR_RGB.pf";
                break;
            case ColorSpace.CS_PYCC:
                resource += "PYCC.pf";
                break;
            case ColorSpace.CS_sRGB:
                resource += "sRGB.pf";
                break;
            default:
                throw new RuntimeException("Unknown color space: " + cs_code);
        }

        try {
            InputStream is = CMMTests.class.getResourceAsStream(resource);
            ICC_Profile p = ICC_Profile.getInstance(is);

            cs = new ICC_ColorSpace(p);
        } catch (IOException e) {
            throw new RuntimeException("Unable load profile from resource " + resource, e);
        }
    }
    return cs;
}
 
Example 11
Source File: CMMTests.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void init() {
    cmmRoot = new Group("cmm", "Color Management Benchmarks");
    cmmRoot.setTabbed();

    cmmOptRoot = new Group(cmmRoot, "opts", "General Options");

    /*
    usePlatfromProfiles =
            new Option.Enable(cmmOptRoot, "csPlatfrom",
                    "Use Platfrom Profiles", false);
    */
    int[] colorspaces = new int[] {
        ColorSpace.CS_sRGB,
        ColorSpace.CS_GRAY,
        ColorSpace.CS_LINEAR_RGB,
        ColorSpace.CS_CIEXYZ
    };

    String[] csNames = new String[]{
        "CS_sRGB",
        "CS_GRAY",
        "CS_LINEAR_RGB",
        "CS_CIEXYZ"
    };

    csList = new Option.IntList(cmmOptRoot,
            "profiles", "Color Profiles",
            colorspaces, csNames, csNames, 0x8);

    ColorConversionTests.init();
    ProfileTests.init();
}
 
Example 12
Source File: CMMTests.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected static ColorSpace getColorSpace(TestEnvironment env) {
    ColorSpace cs;
    Boolean usePlatfrom = true; //(Boolean)env.getModifier(usePlatfromProfiles);

    int cs_code = env.getIntValue(csList);
    if (usePlatfrom) {
        cs = ColorSpace.getInstance(cs_code);
    } else {
        String resource = "profiles/";
        switch (cs_code) {
            case ColorSpace.CS_CIEXYZ:
                resource += "CIEXYZ.pf";
                break;
            case ColorSpace.CS_GRAY:
                resource += "GRAY.pf";
                break;
            case ColorSpace.CS_LINEAR_RGB:
                resource += "LINEAR_RGB.pf";
                break;
            case ColorSpace.CS_PYCC:
                resource += "PYCC.pf";
                break;
            case ColorSpace.CS_sRGB:
                resource += "sRGB.pf";
                break;
            default:
                throw new RuntimeException("Unknown color space: " + cs_code);
        }

        try {
            InputStream is = CMMTests.class.getResourceAsStream(resource);
            ICC_Profile p = ICC_Profile.getInstance(is);

            cs = new ICC_ColorSpace(p);
        } catch (IOException e) {
            throw new RuntimeException("Unable load profile from resource " + resource, e);
        }
    }
    return cs;
}
 
Example 13
Source File: ColConvTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
static String getCSName(int cs) {
    switch(cs) {
        case ColorSpace.CS_GRAY:
            return "CS_GRAY";
        case ColorSpace.CS_CIEXYZ:
            return "CS_CIEXYZ";
        case ColorSpace.CS_LINEAR_RGB:
            return "CS_LINEAR_RGB";
        case ColorSpace.CS_PYCC:
            return "CS_PYCC";
        case ColorSpace.CS_sRGB:
            return "CS_sRGB";
    }
    return "UNKNOWN";
}
 
Example 14
Source File: CMMTests.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected static ColorSpace getColorSpace(TestEnvironment env) {
    ColorSpace cs;
    Boolean usePlatfrom = true; //(Boolean)env.getModifier(usePlatfromProfiles);

    int cs_code = env.getIntValue(csList);
    if (usePlatfrom) {
        cs = ColorSpace.getInstance(cs_code);
    } else {
        String resource = "profiles/";
        switch (cs_code) {
            case ColorSpace.CS_CIEXYZ:
                resource += "CIEXYZ.pf";
                break;
            case ColorSpace.CS_GRAY:
                resource += "GRAY.pf";
                break;
            case ColorSpace.CS_LINEAR_RGB:
                resource += "LINEAR_RGB.pf";
                break;
            case ColorSpace.CS_PYCC:
                resource += "PYCC.pf";
                break;
            case ColorSpace.CS_sRGB:
                resource += "sRGB.pf";
                break;
            default:
                throw new RuntimeException("Unknown color space: " + cs_code);
        }

        try {
            InputStream is = CMMTests.class.getResourceAsStream(resource);
            ICC_Profile p = ICC_Profile.getInstance(is);

            cs = new ICC_ColorSpace(p);
        } catch (IOException e) {
            throw new RuntimeException("Unable load profile from resource " + resource, e);
        }
    }
    return cs;
}
 
Example 15
Source File: ColConvTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
static String getCSName(int cs) {
    switch(cs) {
        case ColorSpace.CS_GRAY:
            return "CS_GRAY";
        case ColorSpace.CS_CIEXYZ:
            return "CS_CIEXYZ";
        case ColorSpace.CS_LINEAR_RGB:
            return "CS_LINEAR_RGB";
        case ColorSpace.CS_PYCC:
            return "CS_PYCC";
        case ColorSpace.CS_sRGB:
            return "CS_sRGB";
    }
    return "UNKNOWN";
}
 
Example 16
Source File: ColConvTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
static String getCSName(int cs) {
    switch(cs) {
        case ColorSpace.CS_GRAY:
            return "CS_GRAY";
        case ColorSpace.CS_CIEXYZ:
            return "CS_CIEXYZ";
        case ColorSpace.CS_LINEAR_RGB:
            return "CS_LINEAR_RGB";
        case ColorSpace.CS_PYCC:
            return "CS_PYCC";
        case ColorSpace.CS_sRGB:
            return "CS_sRGB";
    }
    return "UNKNOWN";
}
 
Example 17
Source File: ColConvTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
static String getCSName(int cs) {
    switch(cs) {
        case ColorSpace.CS_GRAY:
            return "CS_GRAY";
        case ColorSpace.CS_CIEXYZ:
            return "CS_CIEXYZ";
        case ColorSpace.CS_LINEAR_RGB:
            return "CS_LINEAR_RGB";
        case ColorSpace.CS_PYCC:
            return "CS_PYCC";
        case ColorSpace.CS_sRGB:
            return "CS_sRGB";
    }
    return "UNKNOWN";
}
 
Example 18
Source File: CMMTests.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void init() {
    cmmRoot = new Group("cmm", "Color Management Benchmarks");
    cmmRoot.setTabbed();

    cmmOptRoot = new Group(cmmRoot, "opts", "General Options");

    /*
    usePlatfromProfiles =
            new Option.Enable(cmmOptRoot, "csPlatfrom",
                    "Use Platfrom Profiles", false);
    */
    int[] colorspaces = new int[] {
        ColorSpace.CS_sRGB,
        ColorSpace.CS_GRAY,
        ColorSpace.CS_LINEAR_RGB,
        ColorSpace.CS_CIEXYZ
    };

    String[] csNames = new String[]{
        "CS_sRGB",
        "CS_GRAY",
        "CS_LINEAR_RGB",
        "CS_CIEXYZ"
    };

    csList = new Option.IntList(cmmOptRoot,
            "profiles", "Color Profiles",
            colorspaces, csNames, csNames, 0x8);

    ColorConversionTests.init();
    ProfileTests.init();
}
 
Example 19
Source File: ColConvTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
static String getCSName(int cs) {
    switch(cs) {
        case ColorSpace.CS_GRAY:
            return "CS_GRAY";
        case ColorSpace.CS_CIEXYZ:
            return "CS_CIEXYZ";
        case ColorSpace.CS_LINEAR_RGB:
            return "CS_LINEAR_RGB";
        case ColorSpace.CS_PYCC:
            return "CS_PYCC";
        case ColorSpace.CS_sRGB:
            return "CS_sRGB";
    }
    return "UNKNOWN";
}
 
Example 20
Source File: CMMTests.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected static ColorSpace getColorSpace(TestEnvironment env) {
    ColorSpace cs;
    Boolean usePlatfrom = true; //(Boolean)env.getModifier(usePlatfromProfiles);

    int cs_code = env.getIntValue(csList);
    if (usePlatfrom) {
        cs = ColorSpace.getInstance(cs_code);
    } else {
        String resource = "profiles/";
        switch (cs_code) {
            case ColorSpace.CS_CIEXYZ:
                resource += "CIEXYZ.pf";
                break;
            case ColorSpace.CS_GRAY:
                resource += "GRAY.pf";
                break;
            case ColorSpace.CS_LINEAR_RGB:
                resource += "LINEAR_RGB.pf";
                break;
            case ColorSpace.CS_PYCC:
                resource += "PYCC.pf";
                break;
            case ColorSpace.CS_sRGB:
                resource += "sRGB.pf";
                break;
            default:
                throw new RuntimeException("Unknown color space: " + cs_code);
        }

        try {
            InputStream is = CMMTests.class.getResourceAsStream(resource);
            ICC_Profile p = ICC_Profile.getInstance(is);

            cs = new ICC_ColorSpace(p);
        } catch (IOException e) {
            throw new RuntimeException("Unable load profile from resource " + resource, e);
        }
    }
    return cs;
}