/** * Tests if this RtfColor is equal to another RtfColor. * * @param obj another RtfColor * @return <code>True</code> if red, green and blue values of the two colours match, <code>false * </code> otherwise. */ public boolean equals(Object obj) { if (!(obj instanceof RtfColor)) { return false; } RtfColor color = (RtfColor) obj; return (this.red == color.getRed() && this.green == color.getGreen() && this.blue == color.getBlue()); }
public void writeDefinition(final OutputStream result) throws IOException { result.write(OPEN_GROUP); result.write(COLOR_TABLE); for (int i = 0; i < colorList.size(); i++) { RtfColor color = colorList.get(i); color.writeDefinition(result); } result.write(CLOSE_GROUP); result.write((byte) '\n'); }
/** * Constructs a RtfColor as a clone of an existing RtfColor * * @param doc The RtfDocument this RtfColor belongs to * @param col The RtfColor to use as a base */ public RtfColor(RtfDocument doc, RtfColor col) { super(doc); if (col != null) { this.red = col.getRed(); this.green = col.getGreen(); this.blue = col.getBlue(); } if (this.document != null) { this.colorNumber = this.document.getDocumentHeader().getColorNumber(this); } }