AbstractIcon

References
public abstract class AbstractIcon : IIcon
Abstract implementation of IIcon. Consider deriving from this base class rather than implementing IIcon from scratch. This class also has many static creation methods for creating IIcon instances from a variety of data.

Constructors

AbstractIcon

#
Abstract base class constructor.
protected AbstractIcon(
type
Icon type.
)

Properties

States

#
Enumerate over all state names.
public IEnumerable<IconState> States { get; }
States

Type

#
Gets the type of icon.
public IconType Type { get; }
Type

Methods

AddState

#
Add a state to this icon. This method ought to be called from the constructor of derived types only.
protected void AddState(
state
State to add.
)

Draw

#
Render this icon into a graphics context.
public void Draw(
context
Graphics context for icon.
)
Draw

DrawDropShadow

#
Create a bitmap containing the drop shadow of this icon.
public Bitmap DrawDropShadow(
Size
size,
Size of the icon in pixels.
blur,
Amount of blurring.
strength
Darkness of shadow.
)
A bitmap with only black pixels and varying transparencies. The size of this bitmap is the provided size plus padding to cater for the blurring.

DrawInternal

#
Render the icon.
protected abstract void DrawInternal(
context
)

DrawToBitmap

#
Render the icon to a bitmap.
public Bitmap DrawToBitmap(
Size
size,
Size of bitmap.
padding,
Number of padding pixels around entire image.
Color
background
Icon background colour. Note that the actual bitmap will be drawn on a Transparent background. This argument merely informs those parts of icon that case about background/foreground contrast.
)
Rendered bitmap.
DrawToBitmap

FindState

#
Find the icon state with the specified name.
public IconState FindState(
name
Name to search for.
)
Icon state with given name or null.
FindState

FromBitmap

#
Create an image from an Eto bitmap.
public static IIcon FromBitmap(
params Bitmap[]
bitmaps
Bitmap.
)
Image.

FromFile

#
Create an icon from a grasshopper icon file (*.ghicon).
public static IIcon FromFile(
fileName
Filename.
)
Image or null if file is not a valid image file.

FromResource

#
Create an icon from named, embedded resources in the supplied assembly.
public static IIcon FromResource(
name,
Name or full path of resource. Missing '.ghicon' suffixes will be automatically included.
assembly
Assembly containing the resource.
)

FromResource

#
Create an icon from named, embedded resources in the assembly associated with the supplied type.
public static IIcon FromResource(
name,
Name or full path of resource. Missing '.ghicon' suffixes will be automatically included.
type
Type associated with assembly containing the resource.
)

FromResource

#
Create an icon from named, embedded resources in the assembly associated with the supplied type.
public static IIcon FromResource(
type
Type associated with both the name of the icon and the assembly containing the resource.
)

FromStream

#
Create an icon from a stream of data. The stream must contain data written by a IStorable type. VectorIcon is but one example of such a type.
public static IIcon FromStream(
stream
Stream.
)
Icon or null if stream cannot be parsed.

HandleStateChange

#
Override this method if you need to respond to state changes as they happen.
protected virtual void HandleStateChange(
state
)

MoveState

#
Move a named state to a new value over time.
public void MoveState(
value,
State value to assign.
name = null,
Name of state. Leave blank to set the default state.
duration = null,
Animation duration. Leave blank to re-use the previous duration.
motion = null
Animation motion. Leave blank to re-use the previous motion.
)
MoveState

SetState

#
Set the value of a named state immediately.
public void SetState(
value,
State value to assign.
name = null
Name of state. Leave blank to set the default state.
)
SetState