TinyLine
v2.0

com.tinyline.tiny2d
Class TinyPaint

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

public class TinyPaint
extends java.lang.Object

The TinyPaint class defines paint servers in the ARGB color space.

With TinyPaint, you can define the following buid-in paint servers:

Version:
2.0

Author:
Andrew Girow

Field Summary
 TinyBuffer bitmap
          The source of the bitmap (or pattern) color.
static int FILL_BITMAP
          The bitmap color
static int FILL_LINEAR_GRADIENT
          The linear gradient color
static int FILL_PATTERN
          The pattern (tiled bitmap) color
static int FILL_RADIAL_GRADIENT
          The radial gradient color
static int FILL_SOLID
          The solid color in the ARGB color space
static int FILL_URI
          The uri referenced color
 int fillType
          The TinyColor type: FILL_SOLID, FILL_LINEAR_GRADIENT, FILL_RADIAL_GRADIENT, FILL_BITMAP, FILL_PATTERN, FILL_URI
static int GRADIENT_PAD
          Use the terminal colors of the gradient to fill the remainder of the target region
static int GRADIENT_REFLECT
          Reflect the gradient pattern start-to-end, end-to-start, start-to-end, etc.
static int GRADIENT_REPEAT
          Repeat the gradient pattern start-to-end, start-to-end, start-to-end, etc.
 TinyVector gStops
          The list of gradient stops.
 TinyMatrix matrix
          The additional TinyMatrix transform.
static int OBJECT_BOUNDING_BOX
          Use the coordinate system established by the bounding box of the element to which the paint is applied
 int r
          The radius of the largest radial gradient circle.
 int spread
          The gradient color spread method: GRADIENT_PAD, GRADIENT_REFLECT, GRADIENT_REPEAT
 int units
          The paint units: USER_SPACE_ON_USE, OBJECT_BOUNDING_BOX
 TinyString uri
          The uri provides the ID of the color the given color is refferred to
static int USER_SPACE_ON_USE
          Use the current user coordinate system
 int x1
          The x-axis coordinate of the start of the linear gradient vector (or the x-axis coordinate of the center of the largest radial gradient circle).
 int x2
          The x-axis coordinate of the end of the linear gradient vector.
 int y1
          The y-axis coordinate of the start of the linear gradient vector (or the y-axis coordinate of the center of the largest radial gradient circle).
 int y2
          The y-axis coordinate of the end of the linear gradient vector.
 
Constructor Summary
TinyPaint(int fillType)
          Creates a specified gradient, bitmap or pattern TinyPaint object.
 
Method Summary
 void addStop(int color, int ratio)
          Adds a gradient color stop.
static void copy(TinyPaint dst, TinyPaint src)
          Creates a new TinyPaint as copy of the given 'source' TinyPaint.
 void createColorRamp()
          Creates a gradient color ramp.
static void init(TinyPaint paint, int fillType)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILL_SOLID

public static final int FILL_SOLID
The solid color in the ARGB color space

See Also:
Constant Field Values

FILL_LINEAR_GRADIENT

public static final int FILL_LINEAR_GRADIENT
The linear gradient color

See Also:
Constant Field Values

FILL_RADIAL_GRADIENT

public static final int FILL_RADIAL_GRADIENT
The radial gradient color

See Also:
Constant Field Values

FILL_BITMAP

public static final int FILL_BITMAP
The bitmap color

See Also:
Constant Field Values

FILL_PATTERN

public static final int FILL_PATTERN
The pattern (tiled bitmap) color

See Also:
Constant Field Values

FILL_URI

public static final int FILL_URI
The uri referenced color

See Also:
Constant Field Values

fillType

public int fillType
The TinyColor type: FILL_SOLID, FILL_LINEAR_GRADIENT, FILL_RADIAL_GRADIENT, FILL_BITMAP, FILL_PATTERN, FILL_URI


bitmap

public TinyBuffer bitmap
The source of the bitmap (or pattern) color.


uri

public TinyString uri
The uri provides the ID of the color the given color is refferred to


matrix

public TinyMatrix matrix
The additional TinyMatrix transform.


x1

public int x1
The x-axis coordinate of the start of the linear gradient vector (or the x-axis coordinate of the center of the largest radial gradient circle).


y1

public int y1
The y-axis coordinate of the start of the linear gradient vector (or the y-axis coordinate of the center of the largest radial gradient circle).


x2

public int x2
The x-axis coordinate of the end of the linear gradient vector.


y2

public int y2
The y-axis coordinate of the end of the linear gradient vector.


r

public int r
The radius of the largest radial gradient circle.


gStops

public TinyVector gStops
The list of gradient stops.


GRADIENT_PAD

public static final int GRADIENT_PAD
Use the terminal colors of the gradient to fill the remainder of the target region

See Also:
Constant Field Values

GRADIENT_REFLECT

public static final int GRADIENT_REFLECT
Reflect the gradient pattern start-to-end, end-to-start, start-to-end, etc.

See Also:
Constant Field Values

GRADIENT_REPEAT

public static final int GRADIENT_REPEAT
Repeat the gradient pattern start-to-end, start-to-end, start-to-end, etc.

See Also:
Constant Field Values

spread

public int spread
The gradient color spread method: GRADIENT_PAD, GRADIENT_REFLECT, GRADIENT_REPEAT


USER_SPACE_ON_USE

public static final int USER_SPACE_ON_USE
Use the current user coordinate system

See Also:
Constant Field Values

OBJECT_BOUNDING_BOX

public static final int OBJECT_BOUNDING_BOX
Use the coordinate system established by the bounding box of the element to which the paint is applied

See Also:
Constant Field Values

units

public int units
The paint units: USER_SPACE_ON_USE, OBJECT_BOUNDING_BOX

Constructor Detail

TinyPaint

public TinyPaint(int fillType)
Creates a specified gradient, bitmap or pattern TinyPaint object.

Parameters:
fillType - The type of the paint. It must be one of the following types: FILL_LINEAR_GRADIENT, FILL_RADIAL_GRADIENT, FILL_BITMAP, FILL_PATTERN.
Method Detail

init

public static void init(TinyPaint paint,
                        int fillType)

copy

public static void copy(TinyPaint dst,
                        TinyPaint src)
Creates a new TinyPaint as copy of the given 'source' TinyPaint.

Parameters:
src - the source paint.

addStop

public void addStop(int color,
                    int ratio)
Adds a gradient color stop. It must be in a sorted order.

Parameters:
color - The stop color argb value.
ratio - The stop color offset. The value must be in the range [0,1] in the pixed point format.

createColorRamp

public void createColorRamp()
Creates a gradient color ramp. It must be called after the last gradient color stop is added. The number of gradient color stops must be bigger than one.


TinyLine
v2.0

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