Color color = Context.getWmlObjectFactory().createColor(); try { fRed = cssPrimitiveValue.getRGBColorValue().getRed() .getFloatValue(ignored); fGreen = cssPrimitiveValue.getRGBColorValue().getGreen()
fRed = cssPrimitiveValue.getRGBColorValue().getRed() .getFloatValue(ignored); fGreen = cssPrimitiveValue.getRGBColorValue().getGreen()
fRed = cssPrimitiveValue.getRGBColorValue().getRed() .getFloatValue(ignored); fGreen = cssPrimitiveValue.getRGBColorValue().getGreen()
public Shading(CSSValue value) { CTShd shd = Context.getWmlObjectFactory().createCTShd(); // PrimitiveType 25 -> RGBCOLOR short ignored = 1; CSSPrimitiveValue cssPrimitiveValue = (CSSPrimitiveValue)value; float fRed = cssPrimitiveValue.getRGBColorValue().getRed().getFloatValue(ignored); float fGreen = cssPrimitiveValue.getRGBColorValue().getGreen().getFloatValue(ignored); float fBlue = cssPrimitiveValue.getRGBColorValue().getBlue().getFloatValue(ignored); shd.setFill(UnitsOfMeasurement.rgbTripleToHex(fRed, fGreen, fBlue) ); this.setObject( shd ); }
/** * Copied from Josh M.'s CSSAccessor class * * @param rgbcol PARAM * @return Returns */ public static Color rgbToColor( RGBColor rgbcol ) { return new java.awt.Color( rgbcol.getRed().getFloatValue( CSSPrimitiveValue.CSS_NUMBER ) / 255f, rgbcol.getGreen().getFloatValue( CSSPrimitiveValue.CSS_NUMBER ) / 255f, rgbcol.getBlue().getFloatValue( CSSPrimitiveValue.CSS_NUMBER ) / 255f ); } }// end class
/** * Copied from Josh M.'s CSSAccessor class * * @param rgbcol PARAM * @return Returns */ public static Color rgbToColor( RGBColor rgbcol ) { return new java.awt.Color( rgbcol.getRed().getFloatValue( CSSPrimitiveValue.CSS_NUMBER ) / 255f, rgbcol.getGreen().getFloatValue( CSSPrimitiveValue.CSS_NUMBER ) / 255f, rgbcol.getBlue().getFloatValue( CSSPrimitiveValue.CSS_NUMBER ) / 255f ); } }// end class
/** * Copied from Josh M.'s CSSAccessor class * * @param rgbcol PARAM * @return Returns */ public static Color rgbToColor( RGBColor rgbcol ) { return new java.awt.Color( rgbcol.getRed().getFloatValue( CSSPrimitiveValue.CSS_NUMBER ) / 255f, rgbcol.getGreen().getFloatValue( CSSPrimitiveValue.CSS_NUMBER ) / 255f, rgbcol.getBlue().getFloatValue( CSSPrimitiveValue.CSS_NUMBER ) / 255f ); } }// end class
/** * Return hexadecimal (ex : #FFFFFF) color string value from w3c * <code>rgbColor</code> instance. * * @param rgbColor * @return */ public static String getHexaColorStringValue(RGBColor rgbColor) { String result = "#"; int red = (int) rgbColor.getRed().getFloatValue( CSSPrimitiveValue.CSS_NUMBER); if (red < 16) result += "0"; result += Integer.toHexString(red); int green = (int) rgbColor.getGreen().getFloatValue( CSSPrimitiveValue.CSS_NUMBER); if (green < 16) result += "0"; result += Integer.toHexString(green); int blue = (int) rgbColor.getBlue().getFloatValue( CSSPrimitiveValue.CSS_NUMBER); if (blue < 16) result += "0"; result += Integer.toHexString(blue); return result; }
public static String getCSSRGBColorKey(RGBColor rgbColor) { if (rgbColor == null) return null; String rgb = ((int) rgbColor.getGreen().getFloatValue( CSSPrimitiveValue.CSS_NUMBER)) + "_"; rgb += ((int) rgbColor.getRed().getFloatValue( CSSPrimitiveValue.CSS_NUMBER)) + "_"; rgb += ((int) rgbColor.getBlue().getFloatValue( CSSPrimitiveValue.CSS_NUMBER)) + ""; return rgb; }
public static RGBA getRGBA(RGBColor color) { return new RGBA((int) color.getRed().getFloatValue( CSSPrimitiveValue.CSS_NUMBER), (int) color.getGreen() .getFloatValue(CSSPrimitiveValue.CSS_NUMBER), (int) color .getBlue().getFloatValue(CSSPrimitiveValue.CSS_NUMBER), // for now, we only support solid RGB colors in CSS - our CSS model // as of now does not have an element for RGBAColor. 255); }
public static RGB getRGB(RGBColor color) { return new RGB((int) color.getRed().getFloatValue( CSSPrimitiveValue.CSS_NUMBER), (int) color.getGreen() .getFloatValue(CSSPrimitiveValue.CSS_NUMBER), (int) color .getBlue().getFloatValue(CSSPrimitiveValue.CSS_NUMBER)); }
fRed = cssPrimitiveValue.getRGBColorValue().getRed() .getFloatValue(ignored); fGreen = cssPrimitiveValue.getRGBColorValue().getGreen()
fRed = cssPrimitiveValue.getRGBColorValue().getRed() .getFloatValue(ignored); fGreen = cssPrimitiveValue.getRGBColorValue().getGreen()
Color color = Context.getWmlObjectFactory().createColor(); try { fRed = cssPrimitiveValue.getRGBColorValue().getRed() .getFloatValue(ignored); fGreen = cssPrimitiveValue.getRGBColorValue().getGreen()
/** * Return rgb (ex : rgb(0,0,0)) color string value from w3c * <code>rgbColor</code> instance. * * @param rgbColor * @return */ public static String getRGBColorStringValue(RGBColor rgbColor) { String result = "rgb("; int red = (int) rgbColor.getRed().getFloatValue( CSSPrimitiveValue.CSS_NUMBER); result += red; result += ","; int green = (int) rgbColor.getGreen().getFloatValue( CSSPrimitiveValue.CSS_NUMBER); result += green; result += ","; int blue = (int) rgbColor.getBlue().getFloatValue( CSSPrimitiveValue.CSS_NUMBER); result += blue; result += ")"; return result; }
public Shading(CSSValue value) { CTShd shd = Context.getWmlObjectFactory().createCTShd(); // PrimitiveType 25 -> RGBCOLOR short ignored = 1; CSSPrimitiveValue cssPrimitiveValue = (CSSPrimitiveValue)value; float fRed = cssPrimitiveValue.getRGBColorValue().getRed().getFloatValue(ignored); float fGreen = cssPrimitiveValue.getRGBColorValue().getGreen().getFloatValue(ignored); float fBlue = cssPrimitiveValue.getRGBColorValue().getBlue().getFloatValue(ignored); shd.setFill(UnitsOfMeasurement.rgbTripleToHex(fRed, fGreen, fBlue) ); this.setObject( shd ); }