PixelIcon

AbstractIcon
[IoId("00000000-c661-40c2-9323-56a2f3d911d3")] public sealed class PixelIcon : AbstractIcon, IStorable
Implements IIcon for bitmap icons.

Constructors

PixelIcon

#
public PixelIcon(IReader reader)
reader (IReader)

PixelIcon

#
public PixelIcon(params Bitmap[] bitmaps)
Create a new pixel icon from a collection of bitmap images.
bitmaps (params Bitmap[])Collection of variable resolution bitmaps. All bitmaps must have significantly different diagonal dimensions.

PixelIcon

#
public PixelIcon(params string[] bitmapFiles)
Create a new pixel icon from a collection of bitmap image files.
bitmapFiles (params string[])Files.

Properties

ImageCount

#
public int ImageCount { get; }
Gets the number of images stored in this icon.

LargestSize

#
public Size LargestSize { get; }
Gets the size of the largest image.

LargestSpan

#
public int LargestSpan { get; }
Gets the span (diagonal) of the largest image.

SmallestSize

#
public Size SmallestSize { get; }
Gets the size of the smallest image.

SmallestSpan

#
public int SmallestSpan { get; }
Gets the span (diagonal) of the smallest image.

States

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

Type

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

Indexers

this[]

#
public Bitmap this[int index] { get; }
Gets the image associated with the given index.
index (int)Index of image to retrieve.
Image at index.

Methods

AddState

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

BestMatch

#
public int BestMatch(int span, out float factor)
Find the best match image for a specific span.
span (int)Span.
factor (out float)Scaling factor to be applied to found image.
Index of best match.

Draw

public void Draw(IconContext context)
Render this icon into a graphics context.
inherited fromAbstractIcon
context (IconContext)Graphics context for icon.
Draw

DrawDropShadow

public Bitmap DrawDropShadow(Size size, int blur, float strength)
Create a bitmap containing the drop shadow of this icon.
inherited fromAbstractIcon
size (Size)Size of the icon in pixels.
blur (int)Amount of blurring.
strength (float)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

#
protected override void DrawInternal(IconContext context)
context (IconContext)

DrawToBitmap

public Bitmap DrawToBitmap(Size size, int padding, Color background)
Render the icon to a bitmap.
inherited fromAbstractIcon
size (Size)Size of bitmap.
padding (int)Number of padding pixels around entire image.
background (Color)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

ExactMatchOrLarger

#
public int ExactMatchOrLarger(int span)
Find the image which matches the span or the first larger one. If there are no larger images, the largest possible image will be returned.
span (int)Span.
Index of found image.

ExactMatchOrLarger

#
public int ExactMatchOrLarger(Rectangle frame)
Find the image which matches the span or the first larger one. If there are no larger images, the largest possible image will be returned.
frame (Rectangle)Span frame.
Index of found image.

ExactMatchOrLarger

#
public int ExactMatchOrLarger(Size size)
Find the image which matches the span or the first larger one. If there are no larger images, the largest possible image will be returned.
size (Size)Span size.
Index of found image.

ExactMatchOrSmaller

#
public int ExactMatchOrSmaller(int span)
Find the image which matches the span or the first smaller one. If there are no smaller images, the smallest possible image will be returned.
span (int)Span.
Index of found image.

ExactMatchOrSmaller

#
public int ExactMatchOrSmaller(Rectangle frame)
Find the image which matches the span or the first smaller one. If there are no smaller images, the smallest possible image will be returned.
frame (Rectangle)Span frame.
Index of found image.

ExactMatchOrSmaller

#
public int ExactMatchOrSmaller(Size size)
Find the image which matches the span or the first smaller one. If there are no smaller images, the smallest possible image will be returned.
size (Size)Span size.
Index of found image.

FindState

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

HandleStateChange

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

MoveState

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

SetState

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

Store

#
public void Store(IWriter writer)
writer (IWriter)
Store