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

The following examples show how to use java.awt.color.ColorSpace#CS_sRGB . 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: AWTImageTools.java    From scifio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/** Gets a color space for the given number of color components. */
public static ColorSpace makeColorSpace(final int c) {
	int type;
	switch (c) {
		case 1:
			type = ColorSpace.CS_GRAY;
			break;
		case 2:
			type = TwoChannelColorSpace.CS_2C;
			break;
		case 3:
			type = ColorSpace.CS_sRGB;
			break;
		case 4:
			type = ColorSpace.CS_sRGB;
			break;
		default:
			return null;
	}
	return TwoChannelColorSpace.getInstance(type);
}
 
Example 2
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 3
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 4
Source File: CMMTests.java    From openjdk-8-source 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
protected static ColorSpace getColorSpace(TestEnvironment env) {
    ColorSpace cs;
    boolean usePlatform = true; //(Boolean)env.getModifier(usePlatformProfiles);

    int cs_code = env.getIntValue(csList);
    if (usePlatform) {
        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 6
Source File: CMMTests.java    From openjdk-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 7
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 8
Source File: CMMTests.java    From jdk8u-dev-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 9
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 10
Source File: ColConvTest.java    From openjdk-jdk8u 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 11
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 12
Source File: ColConvTest.java    From jdk8u-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 13
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 14
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 15
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 16
Source File: CMMTests.java    From openjdk-8-source 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 17
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 18
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 19
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 20
Source File: ColorBase.java    From MyBox with Apache License 2.0 4 votes vote down vote up
public static String colorSpaceType(int colorType) {
    switch (colorType) {
        case ColorSpace.TYPE_XYZ:
            return "XYZ";
        case ColorSpace.TYPE_Lab:
            return "Lab";
        case ColorSpace.TYPE_Luv:
            return "Luv";
        case ColorSpace.TYPE_YCbCr:
            return "YCbCr";
        case ColorSpace.TYPE_Yxy:
            return "Yxy";
        case ColorSpace.TYPE_RGB:
            return "RGB";
        case ColorSpace.TYPE_GRAY:
            return "GRAY";
        case ColorSpace.TYPE_HSV:
            return "HSV";
        case ColorSpace.TYPE_HLS:
            return "HLS";
        case ColorSpace.TYPE_CMYK:
            return "CMYK";
        case ColorSpace.TYPE_CMY:
            return "CMY";
        case ColorSpace.TYPE_2CLR:
            return "2CLR";
        case ColorSpace.TYPE_3CLR:
            return "3CLR";
        case ColorSpace.TYPE_4CLR:
            return "4CLR";
        case ColorSpace.TYPE_5CLR:
            return "5CLR";
        case ColorSpace.TYPE_6CLR:
            return "6CLR";
        case ColorSpace.TYPE_7CLR:
            return "CMY";
        case ColorSpace.TYPE_8CLR:
            return "8CLR";
        case ColorSpace.TYPE_9CLR:
            return "9CLR";
        case ColorSpace.TYPE_ACLR:
            return "ACLR";
        case ColorSpace.TYPE_BCLR:
            return "BCLR";
        case ColorSpace.TYPE_CCLR:
            return "CCLR";
        case ColorSpace.TYPE_DCLR:
            return "DCLR";
        case ColorSpace.TYPE_ECLR:
            return "ECLR";
        case ColorSpace.TYPE_FCLR:
            return "FCLR";
        case ColorSpace.CS_sRGB:
            return "sRGB";
        case ColorSpace.CS_LINEAR_RGB:
            return "LINEAR_RGB";
        case ColorSpace.CS_CIEXYZ:
            return "CIEXYZ";
        case ColorSpace.CS_PYCC:
            return "PYCC";
        case ColorSpace.CS_GRAY:
            return "GRAY";
        default:
            return "Unknown";

    }

}