| 1 |
|
| 2 |
package org.freehep.graphicsio.cgm; |
| 3 |
|
| 4 |
import java.awt.geom.Point2D; |
| 5 |
import java.awt.geom.Rectangle2D; |
| 6 |
import java.io.IOException; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
public class ClipRectangle extends CGMTag { |
| 16 |
|
| 17 |
private Rectangle2D clip; |
| 18 |
|
| 19 |
public ClipRectangle() { |
| 20 |
super(3, 5, 1); |
| 21 |
} |
| 22 |
|
| 23 |
public ClipRectangle(Rectangle2D rectangle) { |
| 24 |
this(); |
| 25 |
clip = rectangle; |
| 26 |
} |
| 27 |
|
| 28 |
public void write(int tagID, CGMOutputStream cgm) throws IOException { |
| 29 |
cgm.writePoint(new Point2D.Double(clip.getMinX(), clip.getMinY())); |
| 30 |
cgm.writePoint(new Point2D.Double(clip.getMaxX(), clip.getMaxY())); |
| 31 |
} |
| 32 |
|
| 33 |
public void write(int tagID, CGMWriter cgm) throws IOException { |
| 34 |
cgm.print("CLIPRECT "); |
| 35 |
cgm.writePoint(new Point2D.Double(clip.getMinX(), clip.getMinY())); |
| 36 |
cgm.print(", "); |
| 37 |
cgm.writePoint(new Point2D.Double(clip.getMaxX(), clip.getMaxY())); |
| 38 |
} |
| 39 |
} |