Packageaway3d.extrusions
Classpublic class ElevationReader

Public Properties
 PropertyDefined by
  maxElevation : Number
ElevationReader
  minElevation : Number
ElevationReader
  source : BitmapData
[read-only] returns the generated bitmapdata, a smooth representation of the geometry.
ElevationReader
Public Methods
 MethodDefined by
  
ElevationReader
(smoothness:int = 0)
Class generates a traced representation of the elevation geometry, allowing surface tracking to place or move objects on the elevation geometry.
ElevationReader
  
applyHeightGradient(src:BitmapData, color:uint = 0x80000000, reverse:Boolean = true, blendmode:String = "normal"):void
Apply the generated height source to a bitmapdata.
ElevationReader
  
getLevel(x:Number, y:Number, offset:Number = 0):Number
returns the generated bitmapdata, a smooth representation of the geometry.
ElevationReader
  
setSource(sourceBmd:BitmapData, channel:String = "r", factorX:Number = 1, factorY:Number = 1, factorZ:Number = .5):void
Optional method to be allow the use of a custom (externally) prerendered map.
ElevationReader
  
traceLevels(sourceBmd:BitmapData, channel:String = "r", subdivisionX:int = 10, subdivisionY:int = 10, factorX:Number = 1, factorY:Number = 1, elevate:Number = .5):void
generates the smooth representation of the geometry.
ElevationReader
Property detail
maxElevationproperty
maxElevation:Number  [read-write]Implementation
    public function get maxElevation():Number
    public function set maxElevation(value:Number):void
minElevationproperty 
minElevation:Number  [read-write]Implementation
    public function get minElevation():Number
    public function set minElevation(value:Number):void
sourceproperty 
source:BitmapData  [read-only]

returns the generated bitmapdata, a smooth representation of the geometry.

Implementation
    public function get source():BitmapData
Constructor detail
ElevationReader()constructor
public function ElevationReader(smoothness:int = 0)Parameters
smoothness:int (default = 0)
Init Parameters
Method detail
applyHeightGradient()method
public function applyHeightGradient(src:BitmapData, color:uint = 0x80000000, reverse:Boolean = true, blendmode:String = "normal"):void

Apply the generated height source to a bitmapdata. The height information is merged to the source creating a smoother look.

Parameters
src:BitmapData — The bitmapdata that will be merged.
 
color:uint (default = 0x80000000) — [optional] The color that will be applied. Note that 32 bits color will allow alpha. 0x88FF0000 defines a red with .5 alpha while 0xFF0000 defines a red with no alpha. Default is .5 alpha black.
 
reverse:Boolean (default = true) — [optional] Defines if the color is set using the heightmap from 0-255 or 255-0. Default = true, if a black is used, the darkest are will be at the base of the elevation.
 
blendmode:String (default = "normal") — [optional] Blendmode to be applyed in the merge. Possible string values are: lighten, multiply, overlay, screen, substract, add, darken, difference, erase, hardlight, invert and layer.Default = "normal";
getLevel()method 
public function getLevel(x:Number, y:Number, offset:Number = 0):Number

returns the generated bitmapdata, a smooth representation of the geometry.

Parameters
x:Number — The x coordinate on the generated bitmapdata.
 
y:Number — The y coordinate on the generated bitmapdata.
 
offset:Number (default = 0) — [optional] the offset that will be added to the elevation value at the x and y coordinates plus the offset. Default = 0.

Returns
Number — A Number, the elevation value at the x and y coordinates plus the offset.
setSource()method 
public function setSource(sourceBmd:BitmapData, channel:String = "r", factorX:Number = 1, factorY:Number = 1, factorZ:Number = .5):void

Optional method to be allow the use of a custom (externally) prerendered map.

Parameters
sourceBmd:BitmapData — Bitmapdata. The bitmapData to read from.
 
channel:String (default = "r") — [optional] String. The channel information to read. Supported "a", alpha, "r", red, "g", green, "b", blue and "av" (averages and luminance). Default is red channel "r".
 
factorX:Number (default = 1) — [optional] Number. The scale multiplier along the x axis. Default is 1.
 
factorY:Number (default = 1) — [optional] Number. The scale multiplier along the y axis. Default is 1.
 
factorZ:Number (default = .5) — [optional] Number. The scale multiplier along the z axis (the elevation factor). Default is .5.
traceLevels()method 
public function traceLevels(sourceBmd:BitmapData, channel:String = "r", subdivisionX:int = 10, subdivisionY:int = 10, factorX:Number = 1, factorY:Number = 1, elevate:Number = .5):void

generates the smooth representation of the geometry. uses same parameters as the Elevation class.

Parameters
sourceBmd:BitmapData — Bitmapdata. The bitmapData to read from.
 
channel:String (default = "r") — [optional] String. The channel information to read. supported "a", alpha, "r", red, "g", green, "b", blue and "av" (averages and luminance). Default is red channel "r".
 
subdivisionX:int (default = 10) — [optional] int. The subdivision to read the pixels along the x axis. Default is 10.
 
subdivisionY:int (default = 10) — [optional] int. The subdivision to read the pixels along the y axis. Default is 10.
 
factorX:Number (default = 1) — [optional] Number. The scale multiplier along the x axis. Default is 1.
 
factorY:Number (default = 1) — [optional] Number. The scale multiplier along the y axis. Default is 1.
 
elevate:Number (default = .5) — [optional] Number. The scale multiplier along the z axis. Default is .5.

See also

Wiki link
Click to go to the wiki page for 'away3d.extrusions.ElevationReader'

Code examples

Comments