| 1 |
// Copyright 2002, FreeHEP. |
| 2 |
package org.freehep.graphicsio.emf.gdi; |
| 3 |
|
| 4 |
import java.io.IOException; |
| 5 |
|
| 6 |
import org.freehep.graphicsio.emf.EMFInputStream; |
| 7 |
import org.freehep.graphicsio.emf.EMFOutputStream; |
| 8 |
import org.freehep.graphicsio.emf.EMFTag; |
| 9 |
import org.freehep.graphicsio.emf.EMFRenderer; |
| 10 |
|
| 11 |
/** |
| 12 |
* SetMiterLimit TAG. |
| 13 |
* |
| 14 |
* @author Mark Donszelmann |
| 15 |
* @version $Id: freehep-graphicsio-emf/src/main/java/org/freehep/graphicsio/emf/gdi/SetMiterLimit.java c0f15e7696d3 2007/01/22 19:26:48 duns $ |
| 16 |
*/ |
| 17 |
public class SetMiterLimit extends EMFTag { |
| 18 |
|
| 19 |
private int limit; |
| 20 |
|
| 21 |
public SetMiterLimit() { |
| 22 |
super(58, 1); |
| 23 |
} |
| 24 |
|
| 25 |
public SetMiterLimit(int limit) { |
| 26 |
this(); |
| 27 |
this.limit = limit; |
| 28 |
} |
| 29 |
|
| 30 |
public EMFTag read(int tagID, EMFInputStream emf, int len) |
| 31 |
throws IOException { |
| 32 |
|
| 33 |
return new SetMiterLimit(emf.readDWORD()); |
| 34 |
} |
| 35 |
|
| 36 |
public void write(int tagID, EMFOutputStream emf) throws IOException { |
| 37 |
emf.writeDWORD(limit); |
| 38 |
} |
| 39 |
|
| 40 |
public String toString() { |
| 41 |
return super.toString() + "\n limit: " + limit; |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* displays the tag using the renderer |
| 46 |
* |
| 47 |
* @param renderer EMFRenderer storing the drawing session data |
| 48 |
*/ |
| 49 |
public void render(EMFRenderer renderer) { |
| 50 |
// The SetMiterLimit function sets the limit for the length of miter |
| 51 |
// joins for the specified device context. |
| 52 |
// The miter length is defined as the distance from the intersection |
| 53 |
// of the line walls on the inside of the join to the intersection of |
| 54 |
// the line walls on the outside of the join. The miter limit is the |
| 55 |
// maximum allowed ratio of the miter length to the line width. |
| 56 |
|
| 57 |
// The default miter limit is 10.0. |
| 58 |
renderer.setMeterLimit(limit); |
| 59 |
} |
| 60 |
} |