@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ColorStyle)) { return false; } return Objects.equals(DrawPaint.applyColorTransform(this), DrawPaint.applyColorTransform((ColorStyle)o)); }
@Override public int hashCode() { return DrawPaint.applyColorTransform(this).hashCode(); }
/** * * @return the displayed color as a Java Color. * If not color information was found in the supplied xml object then a null is returned. */ public Color getColor() { return DrawPaint.applyColorTransform(getColorStyle()); }
private Paint safeFractions(BiFunction<float[],Color[],Paint> init, GradientPaint fill) { float[] fractions = fill.getGradientFractions(); final ColorStyle[] styles = fill.getGradientColors(); // need to remap the fractions, because Java doesn't like repeating fraction values Map<Float,Color> m = new TreeMap<>(); for (int i = 0; i<fractions.length; i++) { // if fc is null, use transparent color to get color of background m.put(fractions[i], (styles[i] == null ? TRANSPARENT : applyColorTransform(styles[i]))); } final Color[] colors = new Color[m.size()]; if (fractions.length != m.size()) { fractions = new float[m.size()]; } int i=0; for (Map.Entry<Float,Color> me : m.entrySet()) { fractions[i] = me.getKey(); colors[i] = me.getValue(); i++; } return init.apply(fractions, colors); }
/** * @return the color of this shadow. * Depending whether the parent shape is filled or stroked, this color is used to fill or stroke this shadow */ public Color getFillColor() { SolidPaint ps = getFillStyle(); if (ps == null) return null; return DrawPaint.applyColorTransform(ps.getSolidColor()); }
@Override public Color getFillColor() { PaintStyle ps = getFillPaint(); if (ps instanceof SolidPaint) { return DrawPaint.applyColorTransform(((SolidPaint)ps).getSolidColor()); } return null; }
/** * * @return solid fill color of null if not set */ @Override public Color getFillColor() { PaintStyle ps = getFillPaint(); if (ps instanceof SolidPaint) { ColorStyle cs = ((SolidPaint) ps).getSolidColor(); return DrawPaint.applyColorTransform(cs); } return null; }
return applyColorTransform(cs);
/** * 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()}); }
Color shadowColor = DrawPaint.applyColorTransform(shadowPaint.getSolidColor());
@Override public void setFontColor(PaintStyle color) { if (!(color instanceof SolidPaint)) { LOG.log(POILogger.WARN, "Currently only SolidPaint is supported!"); return; } SolidPaint sp = (SolidPaint)color; Color c = DrawPaint.applyColorTransform(sp.getSolidColor()); CTTextCharacterProperties rPr = getRPr(true); CTSolidColorFillProperties fill = rPr.isSetSolidFill() ? rPr.getSolidFill() : rPr.addNewSolidFill(); XSLFColor col = new XSLFColor(fill, getParentParagraph().getParentShape().getSheet().getTheme(), fill.getSchemeClr()); col.setColor(c); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ColorStyle)) { return false; } return Objects.equals(DrawPaint.applyColorTransform(this), DrawPaint.applyColorTransform((ColorStyle)o)); }
@Override public int hashCode() { return DrawPaint.applyColorTransform(this).hashCode(); }
/** * * @return the displayed color as a Java Color. * If not color information was found in the supplied xml object then a null is returned. */ public Color getColor() { return DrawPaint.applyColorTransform(getColorStyle()); }
@Override public void setFontColor(PaintStyle color) { if (!(color instanceof SolidPaint)) { throw new IllegalArgumentException("HSLF only supports solid paint"); } // In PowerPont RGB bytes are swapped, as BGR SolidPaint sp = (SolidPaint)color; Color c = DrawPaint.applyColorTransform(sp.getSolidColor()); int rgb = new Color(c.getBlue(), c.getGreen(), c.getRed(), 254).getRGB(); setFontColor(rgb); }
@Override public void setBulletFontColor(PaintStyle color) { if (!(color instanceof SolidPaint)) { throw new IllegalArgumentException("HSLF only supports SolidPaint"); } SolidPaint sp = (SolidPaint)color; Color col = DrawPaint.applyColorTransform(sp.getSolidColor()); HSLFTextParagraph.this.setBulletColor(col); }
/** * @return the color of this shadow. * Depending whether the parent shape is filled or stroked, this color is used to fill or stroke this shadow */ public Color getFillColor() { SolidPaint ps = getFillStyle(); if (ps == null) return null; return DrawPaint.applyColorTransform(ps.getSolidColor()); }
@Override public Color getFillColor() { PaintStyle ps = getFillPaint(); if (ps instanceof SolidPaint) { return DrawPaint.applyColorTransform(((SolidPaint)ps).getSolidColor()); } return null; }
/** * * @return solid fill color of null if not set */ @Override public Color getFillColor() { PaintStyle ps = getFillPaint(); if (ps instanceof SolidPaint) { ColorStyle cs = ((SolidPaint) ps).getSolidColor(); return DrawPaint.applyColorTransform(cs); } return null; }
@Override public void setFontColor(PaintStyle color) { if (!(color instanceof SolidPaint)) { LOG.log(POILogger.WARN, "Currently only SolidPaint is supported!"); return; } SolidPaint sp = (SolidPaint)color; Color c = DrawPaint.applyColorTransform(sp.getSolidColor()); CTTextCharacterProperties rPr = getRPr(true); CTSolidColorFillProperties fill = rPr.isSetSolidFill() ? rPr.getSolidFill() : rPr.addNewSolidFill(); XSLFColor col = new XSLFColor(fill, getParentParagraph().getParentShape().getSheet().getTheme(), fill.getSchemeClr()); col.setColor(c); }