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
  
paint(g:YGraphics, x:Number, y:Number):void
Paint the icon onto the graphics context at the given position.
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
paint()method
public function paint(g:YGraphics, x:Number, y:Number):void

Paint the icon onto the graphics context at the given position.

Parameters

g:YGraphics — The graphics to render into.
 
x:Number — The top left x coordinate of the icon.
 
y:Number — The top left y coordinate of the icon.