public class Stroke
extends java.lang.Object
addPoint(int, int)
method and are
memorized in a ordered list.Modifier and Type | Class and Description |
---|---|
class |
Stroke.Point
A point.
|
Modifier and Type | Field and Description |
---|---|
private java.util.List<Stroke.Point> |
_points
List of points.
|
private int |
_width
Width of the stroke.
|
private float |
_zoom
Zoom level.
|
Constructor and Description |
---|
Stroke()
Create a stroke.
|
Modifier and Type | Method and Description |
---|---|
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.
|
java.util.List<Stroke.Point> |
getPoints()
Returns the list of points in this page.
|
int |
getWidth()
Returns the width of this stroke.
|
float |
getZoom()
Returns the zoom level of this stroke.
|
void |
setWidth(int width)
Set the width of this stroke.
|
void |
setZoom(float zoom)
Set the zoom level of this stroke.
|
private java.util.List<Stroke.Point> _points
private float _zoom
private int _width
public int getWidth()
public void setWidth(int width)
width
- the width of the stroke (must be positive)java.lang.IllegalArgumentException
- if width
is not positivepublic float getZoom()
public void setZoom(float zoom)
zoom
- the zoom level of the stroke (must be positive)java.lang.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 java.util.List<Stroke.Point> getPoints()
void draw(com.lowagie.text.pdf.PdfContentByte cb, float xAdjust, float yAdjust)
ColorMgr
class.
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 (the program in iRex devices) 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 strokejava.lang.ArithmeticException
- if the setZoom(float)
method has not
been called© 2015 andynaz - http://andynaz.altervista.org