/** * Sets the text color. * @param color the new text color */ public void setTextColor(Color color) { if (!ColorUtil.isSameColor(color, this.textColor)) { this.fontChanged = true; } this.textColor = color; }
/** {@inheritDoc} */ @Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof ColorProperty) { return org.apache.xmlgraphics.java2d.color.ColorUtil.isSameColor( ((ColorProperty) o).color, this.color); } return false; }
/** * Establishes the specified color (RGB). * @param value color as defined by the setrgbcolor command * @return true if the color changed compared to the previous setting */ public boolean useColor(Color value) { if (!ColorUtil.isSameColor(color, value)) { color = value; return true; } else { return false; } }
/** {@inheritDoc} */ @Override public boolean equals(Object obj) { if (obj == null) { return false; } else if (obj == this) { return true; } else { if (obj instanceof BorderProps) { BorderProps other = (BorderProps) obj; return (style == other.style) && org.apache.xmlgraphics.java2d.color.ColorUtil.isSameColor( color, other.color) && width == other.width && mode == other.mode && radiusStart == other.radiusStart && radiusEnd == other.radiusEnd; } } return false; }
/** * Set the current paint. * This checks if the paint will change and then sets the current paint. * * @param p the new paint * @return true if the new paint changes the current paint */ public boolean setPaint(Paint p) { PDFData data = getPDFData(); Paint currentPaint = data.paint; if (currentPaint == null) { if (p != null) { data.paint = p; return true; } } else if (p instanceof Color && currentPaint instanceof Color) { if (!ColorUtil.isSameColor((Color)p, (Color)currentPaint)) { data.paint = p; return true; } } else if (!currentPaint.equals(p)) { data.paint = p; return true; } return false; }
/** * Set the current background color. Check if the background color will * change and then set the new color. * * @param col the new color as a java.awt.Color * @return true if the background color has changed */ public boolean updateColor(Color col) { if (!ColorUtil.isSameColor(col, getGraph().getColor())) { getGraph().setColor(col); return true; } else { return false; } }
/** * Set the current color. * Check if the new color is a change and then set the current color. * * @param col the color to set * @return true if the color has changed */ public boolean setColor(Color col) { Color other = getData().color; if (!org.apache.xmlgraphics.java2d.color.ColorUtil.isSameColor(col, other)) { getData().color = col; return true; } return false; }
/** * Set the current background color. * Check if the new background color is a change and then set the current background color. * * @param col the background color to set * @return true if the color has changed */ public boolean setBackColor(Color col) { Color other = getData().backColor; if (!org.apache.xmlgraphics.java2d.color.ColorUtil.isSameColor(col, other)) { getData().backColor = col; return true; } return false; }
/** * Sets the current color * * @param color the active color to use */ public void setColor(Color color) { if (!ColorUtil.isSameColor(color, graphicsState.color)) { addObject(new GraphicsSetProcessColor(colorConverter.convert(color))); graphicsState.color = color; } }
/** * Set the current paint. This checks if the paint will change and then sets * the current paint. * * @param p the new paint * @return true if the new paint changes the current paint */ public boolean updatePaint(Paint p) { Paint currentPaint = getGraph().getPaint(); if (currentPaint == null) { if (p != null) { getGraph().setPaint(p); return true; } } else if (p instanceof Color && currentPaint instanceof Color) { if (!ColorUtil.isSameColor((Color)p, (Color)currentPaint)) { getGraph().setPaint(p); return true; } } else if (!p.equals(currentPaint)) { getGraph().setPaint(p); return true; } return false; }
/** * Indicates whether another instance has the same alternative colors. * @param col the color to compare the alternatives to * @return true if the same alternative colors are present */ public boolean hasSameAlternativeColors(ColorWithAlternatives col) { if (!hasAlternativeColors()) { return !col.hasAlternativeColors(); } // this.hasAlternativeColors() if (!col.hasAlternativeColors()) { return false; } // this.hasAlternativeColors() && col.hasAlternativeColors() Color[] alt1 = getAlternativeColors(); Color[] alt2 = col.getAlternativeColors(); if (alt1.length != alt2.length) { return false; } for (int i = 0, c = alt1.length; i < c; i++) { Color c1 = alt1[i]; Color c2 = alt2[i]; if (!ColorUtil.isSameColor(c1, c2)) { return false; } } return true; }
if (ColorUtil.isSameColor(col, currentColor)) { return;
changed = !org.apache.xmlgraphics.java2d.color.ColorUtil.isSameColor( color, state.getTextColor()); if (changed) {