TinyLine
v2.0

com.tinyline.tiny2d
Class Tiny2D

java.lang.Object
  extended bycom.tinyline.tiny2d.Tiny2D

public final class Tiny2D
extends java.lang.Object

The Tiny2D defines a graphics context that allows an application to draw shapes, images and texts onto a target surface TinyBuffer using the current graphics state TinyState.

Rendering Methods

Tiny2D provides the general rendering methods to draw any geometry primitive, text, or image using the currect graphics state.

Method Description
drawPath(com.tinyline.tiny2d.TinyPath, com.tinyline.tiny2d.TinyRect, com.tinyline.tiny2d.TinyMatrix) Draws the outline of the specified TinyPath.
drawLine(int, int, int, int) Draws a line between the points (x1, y1) and (x2, y2)
drawRect(int, int, int, int) Draws the outline of the specified rectangle.
drawRoundRect(int, int, int, int, int, int) Draws an outlined round-cornered rectangle.
drawOval(int, int, int, int) Draws the outline of an oval.
drawPolyline(com.tinyline.tiny2d.TinyVector) Draws a sequence of connected lines defined by a vector of points.
drawPolygon(com.tinyline.tiny2d.TinyVector) Draws a closed polygon defined by vector of points.
drawChars(com.tinyline.tiny2d.TinyFont, int, char[], int, int, int, int, int) Draws the outline of a character array.

Coordinate systems and Transformations

TinyLine supports 3 coordinate spaces: CHARACTER SPACE, USER SPACE and DEVICE SPACE.

Characters in a TinyFont are defined in CHARACTER SPACE. The transformation from character space to user space is defined by a matrix (cmat) charToUserTransform(com.tinyline.tiny2d.TinyPath, com.tinyline.tiny2d.TinyFont, int, int, int, int). In TinyLine character space coordinates are EM units.

USER SPACE is the logical coordinate system. It allows to be independent of the resolution of the output device. In TinyLine user space coordinates are fixed point numbers.

Coordinates in DEVICE SPACE specify a particular pixel. Device space is a device-dependent coordinate system and it varies according to the target device. In TinyLine device space coordinates are integers. The origin of device space coordinate system is at the upper left corner with the positive direction of the y-axis pointing downward, and the positive direction of the x-axis to the right.

In TinyLine all coordinate transformations, including transformations from character, user to device space, are represented by TinyMatrix objects.

Fixed Point Numbers

The Tiny2D class contains methods for performing basic numeric operations with fixed point precision numbers:

Name Description
abs(int) Returns the absolute value of a fixed point value.
max(int, int) Returns the greater of two fixed point values.
min(int, int) Returns the smaller of two fixed point values.
mul(int, int) Returns a fixed point number whose value is (a * b).
fastDistance(int, int) Returns the fast approximation for the Euclidean distance between two points, in 2D it is d = sqrt(x^2 + y^2).
div(int, int) Returns a fixed point number whose value is (a / b).
round(int) Returns the closest int to the argument.
sin(int) Returns the trigonometric sine of an angle.
cos(int) Returns the trigonometric cosine of an angle.
tan(int) Returns the trigonometric tangent of an angle.
atan2(int, int) Converts rectangular coordinates (dxdy) to polar (r, theta).

TinyLine supports fixed point and double fixed point numbers. It corresponds to FIX_BITS and DFIX_BITS binary points. In other words, fixed point numbers have FIX_BITS bits fraction length and double fixed point numbers have DFIX_BITS bits fraction length. Thus all numbers must be limited in range between -32,767.9999 to +32,767.9999

Version:
2.0
Author:
Andrew Girow

Field Summary
static int CAP_BUTT
          Ends unclosed subpaths and dash segments with no added decoration.
static int CAP_ROUND
          Ends unclosed subpaths and dash segments with a round decoration that has a radius equal to half of the width of the pen.
static int CAP_SQUARE
          Ends unclosed subpaths and dash segments with a square projection that extends beyond the end of the segment to a distance equal to half of the line width.
static int DFIX
          2 raised to the power of DFIX_BITS
static int DFIX_BITS
          The number of fractional bits for double fixed point numbers
static int FILL_STYLE_EO
          An even-odd winding rule.
static int FILL_STYLE_WIND
          A non-zero winding rule.
static int FIX
          2 raised to the power of FIX_BITS
static int FIX_BITS
          The number of fractional bits for fixed point numbers
static int JOIN_BEVEL
          Joins path segments by connecting the outer corners of their wide outlines with a straight segment.
static int JOIN_MITER
          Joins path segments by extending their outside edges until they meet.
static int JOIN_ROUND
          Joins path segments by rounding off the corner at a radius of half the line width.
static int MAX_VALUE
          A constant holding the maximum value
static int MIN_VALUE
          A constant holding the minimum value
static java.lang.String name
          The License structure
static int TEXT_ANCHOR_END
          The rendered characters are aligned such that the end of the text string is at the initial current text position.
static int TEXT_ANCHOR_MIDDLE
          The rendered characters are aligned such that the middle of the text string is at the current text position.
static int TEXT_ANCHOR_START
          The rendered characters are aligned such that the start of the text string is at the initial current text position.
static int TEXT_DIR_LR
          Sets the text direction to left-to-right, as is common in most Latin-based documents.
static int TEXT_DIR_RL
          Sets the text direction to right-to-left, as is common in Arabic or Hebrew scripts.
static int TEXT_DIR_TB
          Sets the text direction to top-to-bottom, as is common in some Asian scripts, such as Chinese and Japanese.
 
Constructor Summary
Tiny2D()
          Constructs a new Tiny2D object.
 
Method Summary
static int abs(int a)
          Returns the absolute value of a fixed point value.
static int atan2(int dy, int dx)
          Converts rectangular coordinates (dxdy) to polar (r, theta).
static TinyRect charsBounds(TinyFont font, int fontSize, char[] ac, int off, int len, int tdir)
          Returns outlined bounds of the character array.
static TinyPath charsToPath(TinyFont font, char[] ac, int off, int len, int tdir)
          Returns an outlined path of the character array.
static TinyMatrix charToUserTransform(TinyPath path, TinyFont font, int fontSize, int x, int y, int anchor)
          Returns the transformation matrix from character space to user space.
 void clearRect(TinyRect r)
          Clears the specified rectangle.
static int cos(int ang)
          Returns the trigonometric cosine of an angle.
static int div(int a, int b)
          Returns a fixed point number whose value is (a / b).
 void drawChars(TinyFont font, int fontSize, char[] ac, int off, int len, int x, int y, int anchor)
          Draws the outlined of the character array using this Tiny2D current state.
 void drawLine(int x1, int y1, int x2, int y2)
          Draws a line, using the current Tiny2D state, between the points (x1, y1) and (x2, y2).
 void drawOval(int x, int y, int width, int height)
          Draws the outline of an oval using this Tiny2D current state.
 void drawPath(TinyPath path)
          Draws the outline of the specified path.
 void drawPath(TinyPath path, TinyRect bbox, TinyMatrix cmat)
          Draws the outline of the specified path.
 void drawPolygon(TinyVector points)
          Draws a closed polygon defined by vector of points using this Tiny2D current state.
 void drawPolyline(TinyVector points)
          Draws a sequence of connected lines defined by a vector of points using this Tiny2D current state.
 void drawRect(int x, int y, int width, int height)
          Draws the outline of the specified rectangle.
 void drawRoundRect(int x, int y, int width, int height, int rx, int ry)
          Draws an outlined round-cornered rectangle using this Tiny2D current state.
static int fastDistance(int x, int y)
          Returns the fast approximation for the Euclidean distance between two points, in 2D it is d = sqrt(x^2 + y^2).
 void flush()
          Flushs the Tiny2D resources.
 TinyRect getDevBounds(TinyMatrix matrix, int strokeWidth, TinyRect bounds)
          Returns the device bounds.
 TinyProducer getProducer()
          Returns the current TinyProducer.
 TinyState getState()
          Returns the current graphics state for this Tiny2D object.
 TinyBuffer getTarget()
          Returns the pixel buffer (target surface) for this Tiny2D object.
static TinyMatrix getTinyMatrix(TinyVector xform)
          Returns the TinyMatrix that represents the given transforms list.
 boolean hitPath(int x, int y, TinyPath path, TinyMatrix cmat)
          Checks whether or not the specified point (x, y) intersects (hits) the given path.
static void init(int[] lickey)
          Registers Tiny2D with the Developer's License Key.
 void invalidate()
          Invalidates this Tiny2D.
static TinyPath lineToPath(int x0, int y0, int x1, int y1)
          Returns the outline path of a line.
static int max(int a, int b)
          Returns the greater of two fixed point values.
static int min(int a, int b)
          Returns the smaller of two fixed point values.
static int mul(int a, int b)
          Returns a fixed point number whose value is (a * b).
static TinyPath ovalToPath(int x, int y, int width, int height)
          Returns the outline path of an oval.
static TinyVector pathToPoints(TinyPath path)
          Constructs a TinyVector of TinyPoint's that flattens a TinyPath as it iterates over it.
static TinyPath pointsToPath(TinyVector points)
          Returns an outlined path as a sequence of connected lines defined by a vector of points.
static TinyPath rectToPath(int x0, int y0, int x1, int y1)
          Returns the outline path of a rectangle.
static int round(int a)
          Returns the closest int to the argument.
static TinyPath roundRectToPath(int xmin, int ymin, int width, int height, int rx, int ry)
          Returns an outlined path of round-cornered rectangle.
 void sendPixels()
          Sends new pixels under the device clip rectangle to the registered TinyProducer.
 void setClip(TinyRect rect)
          Sets the current clip of this Tiny2D.
 void setProducer(TinyProducer imageProducer)
          Sets the current TinyProducer.
 void setState(TinyState ts)
          Sets the current graphics state for this Tiny2D object.
 void setTarget(TinyBuffer pixbuf)
          Sets the pixel buffer (target surface) for this Tiny2D object.
static int sin(int ang)
          Returns the trigonometric sine of an angle.
static int tan(int ang)
          Returns the trigonometric tangent of an angle.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_VALUE

public static final int MIN_VALUE
A constant holding the minimum value

See Also:
Constant Field Values

MAX_VALUE

public static final int MAX_VALUE
A constant holding the maximum value

See Also:
Constant Field Values

FIX_BITS

public static final int FIX_BITS
The number of fractional bits for fixed point numbers

See Also:
Constant Field Values

FIX

public static final int FIX
2 raised to the power of FIX_BITS

See Also:
Constant Field Values

DFIX_BITS

public static final int DFIX_BITS
The number of fractional bits for double fixed point numbers

See Also:
Constant Field Values

DFIX

public static final int DFIX
2 raised to the power of DFIX_BITS

See Also:
Constant Field Values

FILL_STYLE_WIND

public static final int FILL_STYLE_WIND
A non-zero winding rule. A FILL_SYLE_WIND winding rule means that if a ray is drawn in any direction from a given point to infinity and the places where the path intersects the ray are examined, the point is inside of the path if and only if the number of times that the path crosses the ray from left to right does not equal the number of times that the path crosses the ray from right to left.

See Also:
Constant Field Values

FILL_STYLE_EO

public static final int FILL_STYLE_EO
An even-odd winding rule. An FILL_STYLE_EO winding rule means that enclosed regions of the path alternate between interior and exterior areas as traversed from the outside of the path towards a point inside the region.

See Also:
Constant Field Values

JOIN_MITER

public static final int JOIN_MITER
Joins path segments by extending their outside edges until they meet.

See Also:
Constant Field Values

JOIN_ROUND

public static final int JOIN_ROUND
Joins path segments by rounding off the corner at a radius of half the line width.

See Also:
Constant Field Values

JOIN_BEVEL

public static final int JOIN_BEVEL
Joins path segments by connecting the outer corners of their wide outlines with a straight segment.

See Also:
Constant Field Values

CAP_BUTT

public static final int CAP_BUTT
Ends unclosed subpaths and dash segments with no added decoration.

See Also:
Constant Field Values

CAP_ROUND

public static final int CAP_ROUND
Ends unclosed subpaths and dash segments with a round decoration that has a radius equal to half of the width of the pen.

See Also:
Constant Field Values

CAP_SQUARE

public static final int CAP_SQUARE
Ends unclosed subpaths and dash segments with a square projection that extends beyond the end of the segment to a distance equal to half of the line width.

See Also:
Constant Field Values

TEXT_ANCHOR_START

public static final int TEXT_ANCHOR_START
The rendered characters are aligned such that the start of the text string is at the initial current text position.

See Also:
Constant Field Values

TEXT_ANCHOR_MIDDLE

public static final int TEXT_ANCHOR_MIDDLE
The rendered characters are aligned such that the middle of the text string is at the current text position.

See Also:
Constant Field Values

TEXT_ANCHOR_END

public static final int TEXT_ANCHOR_END
The rendered characters are aligned such that the end of the text string is at the initial current text position.

See Also:
Constant Field Values

TEXT_DIR_LR

public static final int TEXT_DIR_LR
Sets the text direction to left-to-right, as is common in most Latin-based documents. The current text position is advanced from left to right after each glyph is rendered.

See Also:
Constant Field Values

TEXT_DIR_RL

public static final int TEXT_DIR_RL
Sets the text direction to right-to-left, as is common in Arabic or Hebrew scripts.

See Also:
Constant Field Values

TEXT_DIR_TB

public static final int TEXT_DIR_TB
Sets the text direction to top-to-bottom, as is common in some Asian scripts, such as Chinese and Japanese.

See Also:
Constant Field Values

name

public static java.lang.String name
The License structure

Constructor Detail

Tiny2D

public Tiny2D()
Constructs a new Tiny2D object.

Method Detail

setState

public void setState(TinyState ts)
Sets the current graphics state for this Tiny2D object.

Parameters:
ts - graphics state.

getState

public TinyState getState()
Returns the current graphics state for this Tiny2D object.


setTarget

public void setTarget(TinyBuffer pixbuf)
Sets the pixel buffer (target surface) for this Tiny2D object. This also resets the graphic states to default.

Parameters:
pixbuf - the pixel buffer.

flush

public final void flush()
Flushs the Tiny2D resources.


getTarget

public final TinyBuffer getTarget()
Returns the pixel buffer (target surface) for this Tiny2D object.


setProducer

public final void setProducer(TinyProducer imageProducer)
Sets the current TinyProducer.


getProducer

public final TinyProducer getProducer()
Returns the current TinyProducer.


sendPixels

public final void sendPixels()
Sends new pixels under the device clip rectangle to the registered TinyProducer.


invalidate

public final void invalidate()
Invalidates this Tiny2D. Sets the current clip to the pixel buffer bounds.


setClip

public final void setClip(TinyRect rect)
Sets the current clip of this Tiny2D.

COORDINATES ARE IN DEVICE SPACE.

The real clip will be a little enlarged and checked against the pixel buffer dimensions.

Parameters:
rect - The new device clip.

clearRect

public final void clearRect(TinyRect r)
Clears the specified rectangle. Does nothing if the target pixbuf is null.


getDevBounds

public final TinyRect getDevBounds(TinyMatrix matrix,
                                   int strokeWidth,
                                   TinyRect bounds)
Returns the device bounds.

Parameters:
matrix - the transformation matrix.
strokeWidth - the stroke width of the shape in USER SPACE.
bounds - the bounds in USER SPACE.
Returns:
the bounds in DEVICE SPACE.

drawPath

public final void drawPath(TinyPath path,
                           TinyRect bbox,
                           TinyMatrix cmat)
Draws the outline of the specified path.

Parameters:
path - the path object.
bbox - the path bounding box in USER SPACE.
cmat - the transformation matrix from CHARACTER SPACE to USER SPACE.

drawPath

public final void drawPath(TinyPath path)
Draws the outline of the specified path.

Parameters:
path - the path object.

hitPath

public final boolean hitPath(int x,
                             int y,
                             TinyPath path,
                             TinyMatrix cmat)
Checks whether or not the specified point (x, y) intersects (hits) the given path. (COORDINATES ARE IN DEVICE SPACE).

Parameters:
x - the point's x coordinate.
y - the point's y coordinate.
path - the path object.
cmat - the transformation matrix from CHARACTER SPACE to USER SPACE.
Returns:
true if the point hits the path and false otherwise.

drawLine

public final void drawLine(int x1,
                           int y1,
                           int x2,
                           int y2)
Draws a line, using the current Tiny2D state, between the points (x1, y1) and (x2, y2). (COORDINATES ARE IN DEVICE SPACE).

Parameters:
x1 - the first point's x coordinate.
y1 - the first point's y coordinate.
x2 - the second point's x coordinate.
y2 - the second point's y coordinate. Does nothing if the target pixbuf is null.

drawRect

public final void drawRect(int x,
                           int y,
                           int width,
                           int height)
Draws the outline of the specified rectangle. The left and right edges of the rectangle are at x and x + width. The top and bottom edges are at y and y + height. The rectangle is drawn using the graphics context's current color. (COORDINATES ARE IN DEVICE SPACE).

Parameters:
x - the x coordinate of the rectangle to be drawn.
y - the y coordinate of the rectangle to be drawn.
width - the width of the rectangle to be drawn.
height - the height of the rectangle to be drawn. Does nothing if the function is not supported.

drawRoundRect

public final void drawRoundRect(int x,
                                int y,
                                int width,
                                int height,
                                int rx,
                                int ry)
Draws an outlined round-cornered rectangle using this Tiny2D current state. The left and right edges of the rectangle are at x and x + width, respectively. The top and bottom edges of the rectangle are at y and y + height.

Parameters:
x - the x coordinate of the rectangle to be drawn.
y - the y coordinate of the rectangle to be drawn.
width - the width of the rectangle to be drawn.
height - the height of the rectangle to be drawn.
rx - the horizontal diameter of the arc at the four corners.
ry - the vertical diameter of the arc at the four corners. Does nothing if the function is not supported.

drawOval

public final void drawOval(int x,
                           int y,
                           int width,
                           int height)
Draws the outline of an oval using this Tiny2D current state. The result is a circle or ellipse that fits within the rectangle specified by the x, y, width, and height arguments.

Parameters:
x - the x coordinate of the upper left corner of the oval to be drawn.
y - the y coordinate of the upper left corner of the oval to be drawn.
width - the width of the oval to be drawn.
height - the height of the oval to be drawn. Does nothing if the function is not supported.
Returns:
a path object.

drawPolyline

public final void drawPolyline(TinyVector points)
Draws a sequence of connected lines defined by a vector of points using this Tiny2D current state. The figure is not closed if the first point differs from the last point.

Parameters:
points - a vector of points Does nothing if the function is not supported.

drawPolygon

public final void drawPolygon(TinyVector points)
Draws a closed polygon defined by vector of points using this Tiny2D current state. The figure is automatically closed by drawing a line connecting the final point to the first point, if those points are different.

Parameters:
points - a vector of points Does nothing if the function is not supported.

drawChars

public final void drawChars(TinyFont font,
                            int fontSize,
                            char[] ac,
                            int off,
                            int len,
                            int x,
                            int y,
                            int anchor)
Draws the outlined of the character array using this Tiny2D current state. All the text is styled using the specified font and fontSize. The baseline of the first character is defined by position (xy) and alignment anchor.

Parameters:
font - the font object.
fontSize - the size of the font.
ac - array of characters.
off - the initial array offset.
len - the length of array.
x - the x-axis coordinate of the current text position
y - the y-axis coordinate of the current text position
anchor - the text alignement. Does nothing if the target pixbuf is null.

charsBounds

public static final TinyRect charsBounds(TinyFont font,
                                         int fontSize,
                                         char[] ac,
                                         int off,
                                         int len,
                                         int tdir)
Returns outlined bounds of the character array.

Parameters:
font - the font object.
fontSize - the size of the font.
ac - array of characters.
off - the initial array offset.
len - the length of array.
tdir - the text direction. Throws a RuntimeException if the function is not supported.
Returns:
outlined bounds in the character space or null.

charToUserTransform

public static final TinyMatrix charToUserTransform(TinyPath path,
                                                   TinyFont font,
                                                   int fontSize,
                                                   int x,
                                                   int y,
                                                   int anchor)
Returns the transformation matrix from character space to user space.

Parameters:
path - the outlined path of the character array.
font - the font object.
fontSize - the size of the font.
x - the x-axis coordinate of the current text position
y - the y-axis coordinate of the current text position
anchor - the text alignement.
Returns:
the transformation matrix. Throws a RuntimeException if the function is not supported.

lineToPath

public static final TinyPath lineToPath(int x0,
                                        int y0,
                                        int x1,
                                        int y1)
Returns the outline path of a line.

Parameters:
x0 - the start point X coord.
y0 - the start point Y coord.
x1 - the end point X coord.
y1 - the end point Y coord.
Returns:
a path object that represents the outline of a line whose start point is specified as (x0, y0) and whose end point is specified as (x1, y1).

rectToPath

public static final TinyPath rectToPath(int x0,
                                        int y0,
                                        int x1,
                                        int y1)
Returns the outline path of a rectangle.

Parameters:
x0 - the top-left corner X coord.
y0 - the top-left corner Y coord.
x1 - the down-right corner X coord.
y1 - the down-right corner Y coord.
Returns:
a path object that represents the outline of a rectangle whose top-left corner is specified as (x0, y0) and whose down-right corner is specified as (x1, y1).

ovalToPath

public static final TinyPath ovalToPath(int x,
                                        int y,
                                        int width,
                                        int height)
Returns the outline path of an oval. The result is a circle or ellipse that fits within the rectangle specified by the x, y, width, and height arguments.

Parameters:
x - the x coordinate of the upper left corner of the oval to be drawn.
y - the y coordinate of the upper left corner of the oval to be drawn.
width - the width of the oval to be drawn.
height - the height of the oval to be drawn.
Returns:
a path object.

roundRectToPath

public static final TinyPath roundRectToPath(int xmin,
                                             int ymin,
                                             int width,
                                             int height,
                                             int rx,
                                             int ry)
Returns an outlined path of round-cornered rectangle. The left and right edges of the rectangle are at x and x + width, respectively. The top and bottom edges of the rectangle are at y and y + height.

Parameters:
xmin - the x coordinate of the rectangle to be drawn.
ymin - the y coordinate of the rectangle to be drawn.
width - the width of the rectangle to be drawn.
height - the height of the rectangle to be drawn.
rx - the horizontal diameter of the arc at the four corners.
ry - the vertical diameter of the arc at the four corners.
Returns:
a path object

charsToPath

public static final TinyPath charsToPath(TinyFont font,
                                         char[] ac,
                                         int off,
                                         int len,
                                         int tdir)
Returns an outlined path of the character array. All the text is styled using the specified font. The baseline of the first character is defined by position (xy).

Parameters:
font - the font object.
ac - array of characters.
off - the initial array offset.
len - the length of array. Throws a RuntimeException if the function is not supported.
Returns:
an outlined path object in the character space or null.

pointsToPath

public static final TinyPath pointsToPath(TinyVector points)
Returns an outlined path as a sequence of connected lines defined by a vector of points. The figure is not closed if the first point differs from the last point.

Parameters:
points - a vector points

pathToPoints

public static final TinyVector pathToPoints(TinyPath path)
Constructs a TinyVector of TinyPoint's that flattens a TinyPath as it iterates over it.

Parameters:
path - the original unflattened path being iterated over.
Returns:
a flattened path as a TinyVector of TinyPoints.

getTinyMatrix

public static TinyMatrix getTinyMatrix(TinyVector xform)
Returns the TinyMatrix that represents the given transforms list.

Parameters:
xform - The list of TinyMatrix objects.
Returns:
The TinyMatrix that represents this transform list.

abs

public static final int abs(int a)
Returns the absolute value of a fixed point value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.

Parameters:
a - a fixed point value.
Returns:
the absolute value of the argument.

max

public static final int max(int a,
                            int b)
Returns the greater of two fixed point values.

Parameters:
a - a fixed point value.
b - a fixed point value.
Returns:
the larger of a and b.

min

public static final int min(int a,
                            int b)
Returns the smaller of two fixed point values.

Parameters:
a - a fixed point value.
b - a fixed point value.
Returns:
the smaller of a and b.

mul

public static final int mul(int a,
                            int b)
Returns a fixed point number whose value is (a * b).

Parameters:
a - a fixed point value.
b - a fixed point value.
Returns:
a * b

fastDistance

public static final int fastDistance(int x,
                                     int y)
Returns the fast approximation for the Euclidean distance between two points, in 2D it is d = sqrt(x^2 + y^2).

Parameters:
x - a fixed point value.
y - a fixed point value.
Returns:
the fast approximation for sqrt(x^2 + y^2).

div

public static final int div(int a,
                            int b)
Returns a fixed point number whose value is (a / b).

Parameters:
a - a fixed point value.
b - a fixed point value.
Returns:
a / b

round

public static final int round(int a)
Returns the closest int to the argument.

Parameters:
a - a fixed point value to be rounded to an integer.
Returns:
the value of the argument rounded to the nearest int value.

sin

public static int sin(int ang)
Returns the trigonometric sine of an angle.

Parameters:
ang - an angle is a fixed point number, in degrees.
Returns:
the sine (a fixed point number) of the argument.

cos

public static int cos(int ang)
Returns the trigonometric cosine of an angle.

Parameters:
ang - an angle is a fixed point number, in degrees.
Returns:
the cosine (a fixed point number) of the argument.

tan

public static int tan(int ang)
Returns the trigonometric tangent of an angle.

Parameters:
ang - an angle is a fixed point number, in degrees.
Returns:
the tangent ( a fixed point number) of the argument.

atan2

public static int atan2(int dy,
                        int dx)
Converts rectangular coordinates (dxdy) to polar (r, theta). This method computes the phase theta by computing an arc tangent of dy/dx in the range of -pi to pi.

Parameters:
dy - the ordinate coordinate
dx - the abscissa coordinate
Returns:
the theta component of the point (rtheta) in polar coordinates that corresponds to the point (xy) in Cartesian coordinates.

init

public static final void init(int[] lickey)
Registers Tiny2D with the Developer's License Key.

Here the License Key - registration id provided when the TinyLine 2D license is purchased. This will identify which version of TinyLine 2D is licensed and permit all licensed functions to work.

IMPORTANT: YOU MUST CALL IT WITH YOUR LICENSE KEY PROVIDED WHEN THE TINYLINE 2D LICENSE IS PURCHASED!

Parameters:
lickey - The Developer's License Key

TinyLine
v2.0

Provided under the terms of the TinyLine License Agreement that has been included with this distribution