Packagecom.yworks.graph.drawing
Classpublic class ImageIcon
InheritanceImageIcon Inheritance Object
Implements IIcon

A trivial implementation of the IIcon interface that paints an image.



Public Properties
 PropertyDefined By
  className : String
[read-only] The name of the image class
ImageIcon
  height : Number
The height of the icon.
ImageIcon
  image : DisplayObject
[read-only] The displayed image.
ImageIcon
  loaded : Boolean
[read-only] Whether the image associated with this style is completely loaded.
ImageIcon
  url : String
The URL this image is to be loaded from.
ImageIcon
  width : Number
The width of the icon.
ImageIcon
Public Methods
 MethodDefined By
  
ImageIcon(image:Object, width:Number = -1, height:Number = -1)
Creates a new Icon with the given image.
ImageIcon
  
Creates a new DisplayObject from scratch.
ImageIcon
  
updateDisplayObject(oldDisplayObject:DisplayObject, context:IDisplayObjectContext):DisplayObject
Updates the given DisplayObject or creates a new one.
ImageIcon
Protected Methods
 MethodDefined By
  
setImageTransform(theImage:DisplayObject):void
ImageIcon
Property Detail
classNameproperty
className:String  [read-only]

The name of the image class


Implementation
    public function get className():String
heightproperty 
height:Number

The height of the icon.


Implementation
    public function get height():Number
    public function set height(value:Number):void
imageproperty 
image:DisplayObject  [read-only]

The displayed image.


Implementation
    public function get image():DisplayObject
loadedproperty 
loaded:Boolean  [read-only]

Whether the image associated with this style is completely loaded.


Implementation
    public function get loaded():Boolean
urlproperty 
url:String

The URL this image is to be loaded from.

Setting an image url causes this style to load the image from the given url.


Implementation
    public function get url():String
    public function set url(value:String):void
widthproperty 
width:Number

The width of the icon.


Implementation
    public function get width():Number
    public function set width(value:Number):void
Constructor Detail
ImageIcon()Constructor
public function ImageIcon(image:Object, width:Number = -1, height:Number = -1)

Creates a new Icon with the given image.

Parameters
image:Object — An object which specifies an image. The following types are allowed to specify the image that will be displayed be the style:
  • SpriteAsset (embedded scalable image)
  • BitmapAsset (embedded bitmap image)
  • Class (embedded scalable or bitmap image)
  • BitmapData
  • DisplayObject
  • String (image URL)

If a DisplayObject instance is passed that does not extend SpriteAsset or BitmapAsset and that does not implement ICloneable, the style instance can not be shared and printing may not work properly.

If a CloneableBitmap or BitmapData instance is passed, (de)serialization of the icon instance will not work.

 
width:Number (default = -1)
 
height:Number (default = -1)
Method Detail
createDisplayObject()method
public function createDisplayObject(context:IDisplayObjectContext):DisplayObject

Creates a new DisplayObject from scratch.

Parameters

context:IDisplayObjectContext — The context for which the display object is created.

Returns
DisplayObject — A DisplayObject.
setImageTransform()method 
protected function setImageTransform(theImage:DisplayObject):void

Parameters

theImage:DisplayObject

updateDisplayObject()method 
public function updateDisplayObject(oldDisplayObject:DisplayObject, context:IDisplayObjectContext):DisplayObject

Updates the given DisplayObject or creates a new one.

Implementors can decide whether they update the given display object or create a new one. Updating can mean re-rendering or updating size and/or coordinates.

Parameters

oldDisplayObject:DisplayObject — The display object to update.
 
context:IDisplayObjectContext — The context for which the display object should be updated.

Returns
DisplayObject — The updated display object or a completely new display object.