org.freehep.graphicsio.emf.gdi.LogPen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of freehep-graphicsio-emf Show documentation
Show all versions of freehep-graphicsio-emf Show documentation
FreeHEP Enhanced Metafile Format Driver
// Copyright 2002, FreeHEP.
package org.freehep.graphicsio.emf.gdi;
import java.awt.Color;
import java.io.IOException;
import org.freehep.graphicsio.emf.EMFInputStream;
import org.freehep.graphicsio.emf.EMFOutputStream;
import org.freehep.graphicsio.emf.EMFRenderer;
/**
* EMF LogPen
*
* @author Mark Donszelmann
* @version $Id: freehep-graphicsio-emf/src/main/java/org/freehep/graphicsio/emf/gdi/LogPen.java 10ec7516e3ce 2007/02/06 18:42:34 duns $
*/
public class LogPen extends AbstractPen {
private int penStyle;
private int width;
private Color color;
public LogPen(int penStyle, int width, Color color) {
this.penStyle = penStyle;
this.width = width;
this.color = color;
}
public LogPen(EMFInputStream emf) throws IOException {
penStyle = emf.readDWORD();
width = emf.readDWORD();
/* int y = */ emf.readDWORD();
color = emf.readCOLORREF();
}
public void write(EMFOutputStream emf) throws IOException {
emf.writeDWORD(penStyle);
emf.writeDWORD(width);
emf.writeDWORD(0);
emf.writeCOLORREF(color);
}
public String toString() {
return " LogPen\n" + " penstyle: " + penStyle +
"\n width: " + width +
"\n color: " + color;
}
/**
* displays the tag using the renderer
*
* @param renderer EMFRenderer storing the drawing session data
*/
public void render(EMFRenderer renderer) {
renderer.setUseCreatePen(true);
renderer.setPenPaint(color);
renderer.setPenStroke(
createStroke(renderer, penStyle, null, width));
}
}