Package org.apache.xmlgraphics.java2d.color

Examples of org.apache.xmlgraphics.java2d.color.NamedColorSpace


        assertEquals("Named Color Profile Example", ncp.getProfileName());
        assertEquals("The Apache Software Foundation", ncp.getCopyright());
        assertEquals(RenderingIntent.PERCEPTUAL, ncp.getRenderingIntent());
        NamedColorSpace[] namedColors = ncp.getNamedColors();
        assertEquals(2, namedColors.length);
        NamedColorSpace ncs;
        ncs = namedColors[0];
        assertEquals("Postgelb", ncs.getColorName());
        float[] xyz = ncs.getXYZ();
        assertEquals(0.6763079f, xyz[0], 0.01f);
        assertEquals(0.6263507f, xyz[1], 0.01f);
        assertEquals(0.04217565f, xyz[2], 0.01f);

        ncs = namedColors[1];
        assertEquals("MyRed", ncs.getColorName());
    }
View Full Code Here


            //device coordinates are ignored for now
            /*int[] deviceCoord =*/ readUInt16Array(din, numDeviceCoord);

            switch (profile.getPCSType()) {
            case ColorSpace.TYPE_XYZ:
                result[i] = new NamedColorSpace(name, colorvalue, profileName, profileURI);
                break;
            case ColorSpace.TYPE_Lab:
                //Not sure if this always D50 here,
                //but the illuminant in the header is fixed to D50.
                CIELabColorSpace labCS = ColorSpaces.getCIELabColorSpaceD50();
                result[i] = new NamedColorSpace(name, labCS.toColor(colorvalue, 1.0f),
                        profileName, profileURI);
                break;
            default:
                throw new UnsupportedOperationException(
                        "PCS type is not supported: " + profile.getPCSType());
View Full Code Here

            g2d.setColor(colLab);
            g2d.fillRect(110, 30, 40, 40);

            //Try named color (Separation, not implemented, yet)
            float[] c1xyz = d50.toCIEXYZNative(83.25f, 16.45f, 96.89f);
            NamedColorSpace postgelb = new NamedColorSpace("Postgelb", c1xyz);
            Color colNamed = new Color(postgelb, new float[] {1.0f}, 1.0f);
            g2d.setColor(colNamed);
            g2d.fillRect(160, 30, 40, 40);

            //Cleanup
View Full Code Here

        assertEquals(0, fallback.getBlue());

        assertFalse(colActual.hasAlternativeColors());

        assertTrue(colActual.getColorSpace() instanceof NamedColorSpace);
        NamedColorSpace ncs;
        ncs = (NamedColorSpace)colActual.getColorSpace();
        assertEquals("Postgelb", ncs.getColorName());
        float[] comps = colActual.getColorComponents(null);
        assertEquals(1, comps.length);
        assertEquals(1f, comps[0], 0);
        assertEquals(colSpec, ColorUtil.colorToString(colActual));
View Full Code Here

        assertEquals(1f, comps[0], 0);
        assertEquals(0.8f, comps[1], 0);
        assertEquals(0f, comps[2], 0);

        assertTrue(colActual.getColorSpace() instanceof NamedColorSpace);
        NamedColorSpace ncs;
        ncs = (NamedColorSpace)colActual.getColorSpace();
        assertEquals("Postgelb", ncs.getColorName());
        comps = colActual.getColorComponents(null);
        assertEquals(1, comps.length);
        assertEquals(1f, comps[0], 0);

        assertEquals(colSpec, ColorUtil.colorToString(colActual));
View Full Code Here

                String iccProfileSrc = null;
                if (isPseudoProfile(iccProfileName)) {
                    if (CMYK_PSEUDO_PROFILE.equalsIgnoreCase(iccProfileName)) {
                        colorSpace = ColorSpaces.getDeviceCMYKColorSpace();
                    } else if (SEPARATION_PSEUDO_PROFILE.equalsIgnoreCase(iccProfileName)) {
                        colorSpace = new NamedColorSpace(args[5], sRGB,
                                SEPARATION_PSEUDO_PROFILE, null);
                    } else {
                        assert false : "Incomplete implementation";
                    }
                } else {
View Full Code Here

                    ICC_Profile profile = colorSpace.getProfile();
                    if (NamedColorProfileParser.isNamedColorProfile(profile)) {
                        NamedColorProfileParser parser = new NamedColorProfileParser();
                        NamedColorProfile ncp = parser.parseProfile(profile,
                                    iccProfileName, iccProfileSrc);
                        NamedColorSpace ncs = ncp.getNamedColor(colorName);
                        if (ncs != null) {
                            parsedColor = new ColorWithFallback(ncs,
                                    new float[] {1.0f}, 1.0f, null, sRGB);
                        } else {
                            log.warn("Color '" + colorName
View Full Code Here

        if (origin.getProfileURI() != null) {
            sb.append("\"").append(origin.getProfileURI()).append("\"");
        }

        if (cs instanceof NamedColorSpace) {
            NamedColorSpace ncs = (NamedColorSpace)cs;
            if (SEPARATION_PSEUDO_PROFILE.equalsIgnoreCase(profileName)) {
                functionName = "fop-rgb-icc";
            } else {
                functionName = "fop-rgb-named-color";
            }
            sb.append(",").append(ncs.getColorName());
        } else {
            functionName = "fop-rgb-icc";
            float[] colorComponents = specColor.getColorComponents(null);
            for (float colorComponent : colorComponents) {
                sb.append(",");
View Full Code Here

TOP

Related Classes of org.apache.xmlgraphics.java2d.color.NamedColorSpace

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.