| Package | de.popforge.imageprocessing.geom |
| Class | public final class Curve |
By default the image uses a linear function f(x) = x to render
the colors. This class represents such a function which is based on interpolation
between given fix points.
By default the curve will act as such a linear function. In this example has a
curve been created with no parameters:
Another example for a curve. Two points (0x40|0xc0) and (0xc0|0x40) have been
added:
| Property | Defined by | ||
|---|---|---|---|
| mode : int
The mode of the curve.
| Curve | ||
| points : Array
An array consisting of Point objects which describe the curve.
| Curve | ||
| Method | Defined by | ||
|---|---|---|---|
|
Curve(addDefaultPoints:Boolean = true, mode:int = 4)
Creates a new Curve object.
| Curve | ||
|
addPoint(point:Point):void
Adds a point to the curve.
| Curve | ||
|
getBitmapData(bgColor:int = 0x333333, pointColor:int = 0xff00ff, lineColor:int = 0x666666, gridColor:int = 0x3a3a3a):BitmapData
Renders the curve to a BitmapData object.
| Curve | ||
|
getTable():Array
Calulates the new color values based on the current mode.
| Curve | ||
|
removePoint(point:Point):void
Removes a point from the curve.
| Curve | ||
| mode | property |
mode:int [read-write]The mode of the curve. Can be any value of CurveMode.
Implementation public function get mode():int
public function set mode(value:int):void
| points | property |
public var points:ArrayAn array consisting of Point objects which describe the curve.
| Curve | () | constructor |
public function Curve(addDefaultPoints:Boolean = true, mode:int = 4)Creates a new Curve object.
ParametersaddDefaultPoints:Boolean (default = true) — If set to true the points (0|0) and (255|255) will be added automatically.
|
|
mode:int (default = 4) — The mode of the curve which may be any value of CurveMode.
|
| addPoint | () | method |
public function addPoint(point:Point):voidAdds a point to the curve. The point will be only added to the curve if an existing one with same coordinates could not be found.
Parameterspoint:Point — The point that should be added. x and y have to be >= 0 and <= 255.
|
| getBitmapData | () | method |
public function getBitmapData(bgColor:int = 0x333333, pointColor:int = 0xff00ff, lineColor:int = 0x666666, gridColor:int = 0x3a3a3a):BitmapDataRenders the curve to a BitmapData object.
ParametersbgColor:int (default = 0x333333) — Background color of the BitmapData.
|
|
pointColor:int (default = 0xff00ff) — Color to use for points.
|
|
lineColor:int (default = 0x666666) — The line color.
|
|
gridColor:int (default = 0x3a3a3a) — Color for the grid.
|
BitmapData — A BitmapData object containing the visual representation of the Curve object.
|
| getTable | () | method |
public function getTable():ArrayCalulates the new color values based on the current mode. If no points have been set this function will return an array that has been filled with zeros. Otherwise two more points will be added dynamically. They will always be at position (0|p0.y) and (255|pN.y).
The interpolation between the automatically added points and the first and last point is always linear.
ReturnsArray — An array that can be used in combination with BitmapData.paletteMap() for instance.
|
| removePoint | () | method |
public function removePoint(point:Point):voidRemoves a point from the curve.
Parameterspoint:Point — A point that should be removed.
|