| Method from com.lowagie.text.pdf.draw.LineSeparator Detail: |
public void draw(PdfContentByte canvas,
float llx,
float lly,
float urx,
float ury,
float y) {
canvas.saveState();
drawLine(canvas, llx, urx, y);
canvas.restoreState();
}
|
public void drawLine(PdfContentByte canvas,
float leftX,
float rightX,
float y) {
float w;
if (getPercentage() < 0)
w = -getPercentage();
else
w = (rightX - leftX) * getPercentage() / 100.0f;
float s;
switch (getAlignment()) {
case Element.ALIGN_LEFT:
s = 0;
break;
case Element.ALIGN_RIGHT:
s = rightX - leftX - w;
break;
default:
s = (rightX - leftX - w) / 2;
break;
}
canvas.setLineWidth(getLineWidth());
if (getLineColor() != null)
canvas.setColorStroke(getLineColor());
canvas.moveTo(s + leftX, y + offset);
canvas.lineTo(s + w + leftX, y + offset);
canvas.stroke();
}
|
public int getAlignment() {
return alignment;
}
Getter for the alignment of the line. |
public Color getLineColor() {
return lineColor;
}
Getter for the color of the line that will be drawn. |
public float getLineWidth() {
return lineWidth;
}
Getter for the line width. |
public float getPercentage() {
return percentage;
}
Setter for the width as a percentage of the available width. |
public void setAlignment(int align) {
this.alignment = align;
}
Setter for the alignment of the line. |
public void setLineColor(Color color) {
this.lineColor = color;
}
Setter for the color of the line that will be drawn. |
public void setLineWidth(float lineWidth) {
this.lineWidth = lineWidth;
}
Setter for the line width. |
public void setPercentage(float percentage) {
this.percentage = percentage;
}
Setter for the width as a percentage of the available width. |