|
iRex DR1000 Manager v0.6 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.andynaz.irex.dr1000.scribble.Stroke
public class Stroke
A stroke, made up of various points.
Points can be added via the addPoint(int, int)
method and are
memorized in a ordered list.
A stroke has also a width and a zoom level.
Nested Class Summary | |
---|---|
class |
Stroke.Point
A point. |
Field Summary | |
---|---|
private List<Stroke.Point> |
points
List of points. |
private int |
width
Width of the stroke. |
private float |
zoom
Zoom level. |
Constructor Summary | |
---|---|
Stroke()
Create a stroke. |
Method Summary | |
---|---|
void |
addPoint(int x,
int y)
Add a point to this stroke. |
(package private) void |
draw(com.lowagie.text.pdf.PdfContentByte cb,
float xAdjust,
float yAdjust)
Draw the stroke. |
(package private) void |
draw(com.lowagie.text.pdf.PdfContentByte cb,
float xAdjust,
float yAdjust,
Color c)
Draw the stroke. |
List<Stroke.Point> |
getPoints()
Returns the list of points in this page. |
int |
getWidth()
Returns the width of this stroke. |
void |
setWidth(int width)
Set the width of this stroke. |
void |
setZoom(float zoom)
Set the zoom level of this stroke. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private List<Stroke.Point> points
private float zoom
private int width
Constructor Detail |
---|
public Stroke()
Method Detail |
---|
public int getWidth()
public void setWidth(int width)
width
- the width of the stroke (must be positive)
IllegalArgumentException
- if width
is not positivepublic void setZoom(float zoom)
zoom
- the zoom level of the stroke (must be positive)
IllegalArgumentException
- if zoom
is not positivepublic void addPoint(int x, int y)
x
- 'x' coordinate of the point to addy
- 'y' coordinate of the point to addpublic List<Stroke.Point> getPoints()
void draw(com.lowagie.text.pdf.PdfContentByte cb, float xAdjust, float yAdjust, Color c)
When being drawn on the PDF, all the points of the stroke are scaled and adapted for the iText library, which uses a different coordinate system as the one used by the iPDF library, as shown in the following picture.
At first, the poinys' coordinates are scaled using the zoom factor as (as explained here):
x 1 48 x x' = ---------- * ----------------- = ------ zoom/100 160/72 (1-1/16) zoom y 1 48 y y' = ---------- * ----------------- = ------ zoom/100 160/72 (1-1/16) zoomso the zoom factor has to be set with the
setZoom(float)
method
before calling the draw(PdfContentByte, float, float)
method).x' = xa + x y' = ya - ywhere
xa
and ya
are the
arguments of the method.
cb
- content of the PDFxAdjust
- value to correct the 'x' coordinate of all the points in
this strokeyAdjust
- value to correct the 'y' coordinate of all the points in
this stroke
ArithmeticException
- if the setZoom(float)
method has not
been calledvoid draw(com.lowagie.text.pdf.PdfContentByte cb, float xAdjust, float yAdjust)
ColorMgr
class).
cb
- content of the PDFxAdjust
- value to correct the 'x' coordinate of all the points in
this strokeyAdjust
- value to correct the 'y' coordinate of all the points in
this stroke
ArithmeticException
- if the setZoom(float)
} method has not
been calleddraw(PdfContentByte, float, float, Color)
|
iRex DR1000 Manager v0.6 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |