IconContext

References
public sealed class IconContext
Context used during the rendering of icons. It encodes both the transformation from icon to render space, as well as the estimated background colour.

Constructors

IconContext

#
Create a new icon context.
public IconContext(
context,
Graphics context.
RectangleF
frame,
Target frame.
Color
background,
Background colour estimate.
palette,
Palette to use.
Func<Color, Color>
filter
Colour filter to use.
)

IconContext

#
Create a new icon context.
public IconContext(
context,
Graphics context.
RectangleF
frame,
Target frame.
Color
background
Background colour estimate.
)

Properties

Background

#
Gets the average/estimated background colour for this icon.
public Color Background { get; }

Context

#
Gets the graphics context for this draw event.
public Context Context { get; }

Filter

#
Gets the filter to apply to icon colours. Note that this may not affect all colours used by icons.
public Func<Color, Color> Filter { get; }

Frame

#
Gets the dimensions of the target frame.
public RectangleF Frame { get; }

FrameVisualSize

#
Gets the smallest visual dimensions of the frame. This equals the Min(Width, Height) multiplied by the zoom.
public float FrameVisualSize { get; }

Palette

#
Gets the icon palette tied to this context.
public IconPalette Palette { get; }

Scaling

#
Gets the scaling factor for the current context state. The scaling is computed by dividing the Frame size by the icon size as part of SetupTransform(SizeF).
public float Scaling { get; }

Zoom

#
Gets the zoom factor of the frame graphics. Typically you do not need to do anything with this, but some vector graphics elements may choose to alter their display based on their final physical size.
public float Zoom { get; }

Methods

AddSpecialColoursToMenu

#
Add all defined special icon colours to a menu.
public static void AddSpecialColoursToMenu(
MenuItemCollection
menu,
Menu collection to append to.
handler,
CLick handler. The sender will be a Command and the argument will be a SpecialColour.
current = SpecialColour.None
Current special colour, used to set a check mark.
)

MakeSpecialColour

#
Create an ARGB colour which hints at a special colour.
public static Color MakeSpecialColour(
code
Code.
)
ARGB colour.

Modify

#
Modify this context.
public IconContext Modify(
RectangleF?
newFrame = null,
If specified, the new framing.
Color?
newBackground = null
If specified, the new background.
)

ResolveSpecialColour

#
Resolve a special colour, leave regular colours unmolested.
public Color ResolveSpecialColour(
Color
colour
Special colour to resolve.
)
Resolved colour or original colour.

ResolveSpecialColour

#
Resolve a special colour.
public Color ResolveSpecialColour(
specialColour
Special colour to resolve.
)
Actual colour associated with the special code.

SetupTransform

#
Set up the required transformation details for a specific icon. This method *must* be called before any of the Transform methods are invoked.
public void SetupTransform(
SizeF
iconSize
Size of icon.
)

Transform

#
Transform an arc into frame space.
public ArcF Transform(
value
Arc to transform.
)
Transformed arc.

Transform

#
Transform a bezier curve into frame space.
public BezierF Transform(
value
Bezier to transform.
)
Transformed bezier.

Transform

#
Transform a circle into frame space.
public CircleF Transform(
value
Circle to transform.
)
Transformed circle.

Transform

#
Transform an ellipse into frame space.
public EllipseF Transform(
value
Ellipse to transform.
)
Transformed ellipse.

Transform

#
Transform a numeric value into frame space.
public float Transform(
value
Value to transform.
)
Transformed value.

Transform

#
Transform a line into frame space.
public LineF Transform(
value
Line to transform.
)
Transformed line.

Transform

#
Transform a point into frame space.
public PointF Transform(
PointF
value
Point to transform.
)
Transformed point.

Transform

#
Transform a bunch of points into frame space.
public PointF[] Transform(
PointF[]
values
Points to transform.
)
Transformed points.

Transform

#
Transform a rectangle into frame space.
public RectangleF Transform(
RectangleF
value
Rectangle to transform.
)
Transformed rectangle.

Transform

#
Transform a size into frame space.
public SizeF Transform(
SizeF
value
Size to transform.
)
Transformed size.

WithDisabledFilter

#
Modify the filter of this context to the standard disabled filter.
public IconContext WithDisabledFilter()

WithFadingFilter

#
Modify the filter of this context to the standard blending filter.
public IconContext WithFadingFilter(
Color
background,
factor
)

WithFilter

#
Modify the filter of this context.
public IconContext WithFilter(
Func<Color, Color>
filter
)

WithGreyscaleFilter

#
Modify the filter of this context to the standard disabled filter.
public IconContext WithGreyscaleFilter()

WithPalette

#
Assign a new icon palette to this context.
public IconContext WithPalette(
palette
)