@Override public Format intersects(Format other) { final Format result = super.intersects(other); if (other instanceof GIFFormat) { final GIFFormat resultCast = (GIFFormat) result; final GIFFormat oCast = (GIFFormat) other; if (getClass().isAssignableFrom(other.getClass())) { // "other" was cloned. } else if (other.getClass().isAssignableFrom(getClass())) { // this was cloned } } FormatTraceUtils.traceIntersects(this, other, result); return result; }
public Format intersects(Format other) { final Format result = super.intersects(other); if (other instanceof RGBFormat) { final RGBFormat resultCast = (RGBFormat) result; final RGBFormat oCast = (RGBFormat) other; if (getClass().isAssignableFrom(other.getClass())) { // "other" was cloned. if (FormatUtils.specified(this.bitsPerPixel)) resultCast.bitsPerPixel = this.bitsPerPixel; if (FormatUtils.specified(this.redMask)) resultCast.redMask = this.redMask; if (FormatUtils.specified(this.greenMask)) resultCast.greenMask = this.greenMask; if (FormatUtils.specified(this.blueMask)) resultCast.blueMask = this.blueMask; if (FormatUtils.specified(this.pixelStride)) resultCast.pixelStride = this.pixelStride; if (FormatUtils.specified(this.lineStride)) resultCast.lineStride = this.lineStride; if (FormatUtils.specified(this.flipped)) resultCast.flipped = this.flipped; if (FormatUtils.specified(this.endian)) resultCast.endian = this.endian; } else { // this was cloned if (!FormatUtils.specified(resultCast.bitsPerPixel)) resultCast.bitsPerPixel = oCast.bitsPerPixel; if (!FormatUtils.specified(resultCast.redMask)) resultCast.redMask = oCast.redMask; if (!FormatUtils.specified(resultCast.greenMask)) resultCast.greenMask = oCast.greenMask; if (!FormatUtils.specified(resultCast.blueMask)) resultCast.blueMask = oCast.blueMask; if (!FormatUtils.specified(resultCast.pixelStride)) resultCast.pixelStride = oCast.pixelStride; if (!FormatUtils.specified(resultCast.lineStride)) resultCast.lineStride = oCast.lineStride; if (!FormatUtils.specified(resultCast.flipped)) resultCast.flipped = oCast.flipped; if (!FormatUtils.specified(resultCast.endian)) resultCast.endian = oCast.endian; } } FormatUtils.traceIntersects(this, other, result); return result; }