IconContext
ReferencesContext 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.
filter
Colour filter to use.
Properties
Background
#Gets the average/estimated background colour for this icon.
public Color Background { get; }
Filter
#Gets the filter to apply to icon colours. Note that this may not affect all colours used by icons.
FrameVisualSize
#Gets the smallest visual dimensions of the frame. This equals the Min(Width, Height) multiplied by the zoom.
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).
Methods
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.
Returns: Resolved colour or original colour.
ResolveSpecialColour
#Resolve a special colour.
Returns: 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 a point into frame space.
public PointF Transform()
PointF
value
Point to transform.
Returns: Transformed point.
Transform
#Transform a bunch of points into frame space.
public PointF[] Transform()
PointF[]
values
Points to transform.
Returns: Transformed points.
Transform
#Transform a rectangle into frame space.
public RectangleF Transform()
RectangleF
value
Rectangle to transform.
Returns: Transformed rectangle.
Transform
#Transform a size into frame space.
public SizeF Transform()
SizeF
value
Size to transform.
Returns: Transformed size.