/** * Returns the sRGB value obtained by forcing the * conversion method to the intent passed to the * constructor. * @param values the color values in the local color space * @return the sRGB values */ public float[] intendedToRGB(float[] values) { switch(intent) { case ABSOLUTE_COLORIMETRIC: return absoluteColorimetricToRGB(values); case PERCEPTUAL: case AUTO: return perceptualToRGB(values); case RELATIVE_COLORIMETRIC: return relativeColorimetricToRGB(values); case SATURATION: return saturationToRGB(values); default: throw new RuntimeException("invalid intent:" + intent); } }
/** * Relative colorimetric needs to happen through CIEXYZ * conversion. * @param values the color values in the local color space * @return the sRGB values */ private float[] relativeColorimetricToRGB(float[] values) { float[] ciexyz = toCIEXYZ(values); return SRGB.fromCIEXYZ(ciexyz); }
colorSpace = new ICCColorSpaceWithIntent(iccProfile, renderingIntent, profileName, iccProfileSrc);
float[] rgb = profileCS.intendedToRGB(colorValue);
return null; // no profile ICC_Profile iccProfile = profileCS.getProfile();
ColorSpace imgCS = imgCM.getColorSpace(); int nImageComponents = imgCS.getNumComponents(); int nProfileComponents = colorSpace.getNumComponents(); if(nImageComponents != nProfileComponents){
/** * Absolute colorimetric. NOT IMPLEMENTED. * Temporarily returns same as perceptual. * @param values the color values in the local color space * @return the sRGB values */ private float[] absoluteColorimetricToRGB(float[] values) { return perceptualToRGB(values); }
/** * Analyzes the color-profile property and builds an ICCColorSpaceExt * object from it. * * @param element the element with the color-profile property * @param ctx the bridge context */ protected static ICCColorSpaceWithIntent extractColorSpace(Element element, BridgeContext ctx) { String colorProfileProperty = CSSUtilities.getComputedStyle (element, SVGCSSEngine.COLOR_PROFILE_INDEX).getStringValue(); // The only cases that need special handling are 'sRGB' and 'name' ICCColorSpaceWithIntent colorSpace = null; if (CSS_SRGB_VALUE.equalsIgnoreCase(colorProfileProperty)) { colorSpace = new ICCColorSpaceWithIntent (ICC_Profile.getInstance(ColorSpace.CS_sRGB), RenderingIntent.AUTO, "sRGB", null); } else if (!CSS_AUTO_VALUE.equalsIgnoreCase(colorProfileProperty) && !"".equalsIgnoreCase(colorProfileProperty)){ // The value is neither 'sRGB' nor 'auto': it is a profile name. SVGColorProfileElementBridge profileBridge = (SVGColorProfileElementBridge) ctx.getBridge (SVG_NAMESPACE_URI, SVG_COLOR_PROFILE_TAG); if (profileBridge != null) { colorSpace = profileBridge.createICCColorSpaceWithIntent (ctx, element, colorProfileProperty); } } return colorSpace; }
float[] rgb = profileCS.intendedToRGB(colorValue);
return null; // no profile ICC_Profile iccProfile = profileCS.getProfile();
ColorSpace imgCS = imgCM.getColorSpace(); int nImageComponents = imgCS.getNumComponents(); int nProfileComponents = colorSpace.getNumComponents(); if(nImageComponents != nProfileComponents){
/** * Saturation. NOT IMPLEMENTED. Temporarily returns same * as perceptual. * @param values the color values in the local color space * @return the sRGB values */ private float[] saturationToRGB(float[] values) { return perceptualToRGB(values); }
/** * Analyzes the color-profile property and builds an ICCColorSpaceExt * object from it. * * @param element the element with the color-profile property * @param ctx the bridge context */ protected static ICCColorSpaceWithIntent extractColorSpace(Element element, BridgeContext ctx) { String colorProfileProperty = CSSUtilities.getComputedStyle (element, SVGCSSEngine.COLOR_PROFILE_INDEX).getStringValue(); // The only cases that need special handling are 'sRGB' and 'name' ICCColorSpaceWithIntent colorSpace = null; if (CSS_SRGB_VALUE.equalsIgnoreCase(colorProfileProperty)) { colorSpace = new ICCColorSpaceWithIntent (ICC_Profile.getInstance(ColorSpace.CS_sRGB), RenderingIntent.AUTO, "sRGB", null); } else if (!CSS_AUTO_VALUE.equalsIgnoreCase(colorProfileProperty) && !"".equalsIgnoreCase(colorProfileProperty)){ // The value is neither 'sRGB' nor 'auto': it is a profile name. SVGColorProfileElementBridge profileBridge = (SVGColorProfileElementBridge) ctx.getBridge (SVG_NAMESPACE_URI, SVG_COLOR_PROFILE_TAG); if (profileBridge != null) { colorSpace = profileBridge.createICCColorSpaceWithIntent (ctx, element, colorProfileProperty); } } return colorSpace; }
float[] rgb = profileCS.intendedToRGB(colorValue);
return null; // no profile ICC_Profile iccProfile = profileCS.getProfile();
ColorSpace imgCS = imgCM.getColorSpace(); int nImageComponents = imgCS.getNumComponents(); int nProfileComponents = colorSpace.getNumComponents(); if(nImageComponents != nProfileComponents){
/** * Analyzes the color-profile property and builds an ICCColorSpaceExt * object from it. * * @param element the element with the color-profile property * @param ctx the bridge context */ protected static ICCColorSpaceWithIntent extractColorSpace(Element element, BridgeContext ctx) { String colorProfileProperty = CSSUtilities.getComputedStyle (element, SVGCSSEngine.COLOR_PROFILE_INDEX).getStringValue(); // The only cases that need special handling are 'sRGB' and 'name' ICCColorSpaceWithIntent colorSpace = null; if (CSS_SRGB_VALUE.equalsIgnoreCase(colorProfileProperty)) { colorSpace = new ICCColorSpaceWithIntent (ICC_Profile.getInstance(ColorSpace.CS_sRGB), RenderingIntent.AUTO, "sRGB", null); } else if (!CSS_AUTO_VALUE.equalsIgnoreCase(colorProfileProperty) && !"".equalsIgnoreCase(colorProfileProperty)){ // The value is neither 'sRGB' nor 'auto': it is a profile name. SVGColorProfileElementBridge profileBridge = (SVGColorProfileElementBridge) ctx.getBridge (SVG_NAMESPACE_URI, SVG_COLOR_PROFILE_TAG); if (profileBridge != null) { colorSpace = profileBridge.createICCColorSpaceWithIntent (ctx, element, colorProfileProperty); } } return colorSpace; }
cs = new ICCColorSpaceWithIntent(p, intent, href, iccProfileName);
cs = new ICCColorSpaceWithIntent(p, intent, href, iccProfileName);
cs = new ICCColorSpaceWithIntent(p, intent, href, iccProfileName);