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
#public IconContext(Context context, RectangleF frame, Color background, IconPalette palette, Func<Color, Color> filter)
Create a new icon context.
Parameters:
| context (Context) | Graphics context. |
| frame (RectangleF) | Target frame. |
| background (Color) | Background colour estimate. |
| palette (IconPalette) | Palette to use. |
| filter (Func<Color, Color>) | Colour filter to use. |
Properties
Background
#public Color Background { get; }
Gets the average/estimated background colour for this icon.
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
MakeSpecialColour
#Create an ARGB colour which hints at a special colour.
Parameters:
| code (SpecialColour) | Code. |
Returns: ARGB colour.
Modify
#Modify this context.
Parameters:
| newFrame (RectangleF? = null) | If specified, the new framing. |
| newBackground (Color? = null) | If specified, the new background. |
ResolveSpecialColour
#public Color ResolveSpecialColour(Color colour)
Resolve a special colour, leave regular colours unmolested.
Parameters:
| colour (Color) | Special colour to resolve. |
Returns: Resolved colour or original colour.
ResolveSpecialColour
#Resolve a special colour.
Parameters:
| specialColour (SpecialColour) | Special colour to resolve. |
Returns: Actual colour associated with the special code.
SetupTransform
#public void SetupTransform(SizeF iconSize)
Set up the required transformation details for a specific icon. This method *must* be called before any of the Transform methods are invoked.
Parameters:
| iconSize (SizeF) | Size of icon. |
Transform
#Transform an arc into frame space.
Parameters:
| value (ArcF) | Arc to transform. |
Returns: Transformed arc.
Transform
#Transform a bezier curve into frame space.
Parameters:
| value (BezierF) | Bezier to transform. |
Returns: Transformed bezier.
Transform
#Transform a circle into frame space.
Parameters:
| value (CircleF) | Circle to transform. |
Returns: Transformed circle.
Transform
#Transform an ellipse into frame space.
Parameters:
| value (EllipseF) | Ellipse to transform. |
Returns: Transformed ellipse.
Transform
#Transform a numeric value into frame space.
Parameters:
| value (float) | Value to transform. |
Returns: Transformed value.
Transform
#Transform a line into frame space.
Parameters:
| value (LineF) | Line to transform. |
Returns: Transformed line.
Transform
#public PointF Transform(PointF value)
Transform a point into frame space.
Parameters:
| value (PointF) | Point to transform. |
Returns: Transformed point.
Transform
#public PointF[] Transform(PointF[] values)
Transform a bunch of points into frame space.
Parameters:
| values (PointF[]) | Points to transform. |
Returns: Transformed points.
Transform
#public RectangleF Transform(RectangleF value)
Transform a rectangle into frame space.
Parameters:
| value (RectangleF) | Rectangle to transform. |
Returns: Transformed rectangle.
Transform
#public SizeF Transform(SizeF value)
Transform a size into frame space.
Parameters:
| value (SizeF) | Size to transform. |
Returns: Transformed size.
WithFadingFilter
#Modify the filter of this context to the standard blending filter.
Parameters:
| background (Color) | |
| factor (float) |