public byte[] getValue() { return color.getVal(); }
public void setValue(byte[] value) { color.setVal(value); }
rgb.setVal(rgbBytes); alphaPct = (addAlpha) ? rgb.addNewAlpha() : null; } else { CTScRgbColor rgb = fill.addNewScrgbClr();
rgb.setVal(rgbBytes); alphaPct = (addAlpha) ? rgb.addNewAlpha() : null; } else { CTScRgbColor rgb = fill.addNewScrgbClr();
/** * Set the color to be used on bullet characters within a given paragraph. * * @param color the bullet color */ public void setBulletFontColor(Color color){ CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); CTColor c = pr.isSetBuClr() ? pr.getBuClr() : pr.addNewBuClr(); CTSRgbColor clr = c.isSetSrgbClr() ? c.getSrgbClr() : c.addNewSrgbClr(); clr.setVal(new byte[]{(byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()}); }
public String toRGBHex() { StringBuilder sb = new StringBuilder(6); for (byte b: color.getVal()) { sb.append(String.format(Locale.ROOT, "%02X", b)); } return sb.toString().toUpperCase(Locale.ROOT); } }
/** * Set the color to be used on bullet characters within a given paragraph. * * @param color the bullet color */ @SuppressWarnings("WeakerAccess") public void setBulletFontColor(PaintStyle color) { if (!(color instanceof SolidPaint)) { throw new IllegalArgumentException("Currently XSLF only supports SolidPaint"); } // TODO: implement setting bullet color to null SolidPaint sp = (SolidPaint)color; Color col = DrawPaint.applyColorTransform(sp.getSolidColor()); CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); CTColor c = pr.isSetBuClr() ? pr.getBuClr() : pr.addNewBuClr(); CTSRgbColor clr = c.isSetSrgbClr() ? c.getSrgbClr() : c.addNewSrgbClr(); clr.setVal(new byte[]{(byte) col.getRed(), (byte) col.getGreen(), (byte) col.getBlue()}); }
public Color getFontColor(){ CTTextCharacterProperties rPr = getRPr(); if(rPr.isSetSolidFill()){ CTSolidColorFillProperties fill = rPr.getSolidFill(); if(fill.isSetSrgbClr()){ CTSRgbColor clr = fill.getSrgbClr(); byte[] rgb = clr.getVal(); return new Color(0xFF & rgb[0], 0xFF & rgb[1], 0xFF & rgb[2]); } } return new Color(0, 0, 0); }
@Override public void setFillColor(int red, int green, int blue) { CTShapeProperties props = getShapeProperties(); CTSolidColorFillProperties fill = props.isSetSolidFill() ? props.getSolidFill() : props.addNewSolidFill(); CTSRgbColor rgb = CTSRgbColor.Factory.newInstance(); rgb.setVal(new byte[]{(byte)red, (byte)green, (byte)blue}); fill.setSrgbClr(rgb); }
public boolean fetch(CTTextParagraphProperties props){ if(props.isSetBuClr()){ if(props.getBuClr().isSetSrgbClr()){ CTSRgbColor clr = props.getBuClr().getSrgbClr(); byte[] rgb = clr.getVal(); setValue(new Color(0xFF & rgb[0], 0xFF & rgb[1], 0xFF & rgb[2])); return true; } } return false; } };
public void setFontColor(Color color){ CTTextCharacterProperties rPr = getRPr(); CTSolidColorFillProperties fill = rPr.isSetSolidFill() ? rPr.getSolidFill() : rPr.addNewSolidFill(); CTSRgbColor clr = fill.isSetSrgbClr() ? fill.getSrgbClr() : fill.addNewSrgbClr(); clr.setVal(new byte[]{(byte)color.getRed(), (byte)color.getGreen(), (byte)color.getBlue()}); if(fill.isSetHslClr()) fill.unsetHslClr(); if(fill.isSetPrstClr()) fill.unsetPrstClr(); if(fill.isSetSchemeClr()) fill.unsetSchemeClr(); if(fill.isSetScrgbClr()) fill.unsetScrgbClr(); if(fill.isSetSysClr()) fill.unsetSysClr(); }
byte[] val = srgb.getVal(); color = new Color(0xFF & val[0], 0xFF & val[1], 0xFF & val[2]); } else if (ch instanceof CTSystemColor) {
@Override public void setLineStyleColor( int red, int green, int blue ) { CTShapeProperties props = getShapeProperties(); CTLineProperties ln = props.isSetLn() ? props.getLn() : props.addNewLn(); CTSolidColorFillProperties fill = ln.isSetSolidFill() ? ln.getSolidFill() : ln.addNewSolidFill(); CTSRgbColor rgb = CTSRgbColor.Factory.newInstance(); rgb.setVal(new byte[]{(byte)red, (byte)green, (byte)blue}); fill.setSrgbClr(rgb); }
if (ctColor.isSetSrgbClr()) { rgb = ctColor.getSrgbClr().getVal(); } else if (ctColor.isSetSysClr()) {
if (xlsColor.isSetRgb()) { CTSRgbColor clr = fill.isSetSrgbClr() ? fill.getSrgbClr() : fill.addNewSrgbClr(); clr.setVal(xlsColor.getRgb()); } else if (xlsColor.isSetIndexed()) { HSSFColor indexed = HSSFColor.getIndexHash().get((int) xlsColor.getIndexed()); rgb[2] = (byte) indexed.getTriplet()[2]; CTSRgbColor clr = fill.isSetSrgbClr() ? fill.getSrgbClr() : fill.addNewSrgbClr(); clr.setVal(rgb);
public byte[] getValue() { return color.getVal(); }
public void setValue(byte[] value) { color.setVal(value); }
public String toRGBHex() { StringBuilder sb = new StringBuilder(6); for (byte b: color.getVal()) { sb.append(String.format(Locale.ROOT, "%02X", b)); } return sb.toString().toUpperCase(Locale.ROOT); } }
/** * Set the color to be used on bullet characters within a given paragraph. * * @param color the bullet color */ public void setBulletFontColor(Color color){ CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); CTColor c = pr.isSetBuClr() ? pr.getBuClr() : pr.addNewBuClr(); CTSRgbColor clr = c.isSetSrgbClr() ? c.getSrgbClr() : c.addNewSrgbClr(); clr.setVal(new byte[]{(byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()}); }
public Color getFontColor(){ CTTextCharacterProperties rPr = getRPr(); if(rPr.isSetSolidFill()){ CTSolidColorFillProperties fill = rPr.getSolidFill(); if(fill.isSetSrgbClr()){ CTSRgbColor clr = fill.getSrgbClr(); byte[] rgb = clr.getVal(); return new Color(0xFF & rgb[0], 0xFF & rgb[1], 0xFF & rgb[2]); } } return new Color(0, 0, 0); }