Skip to content

GeoRadialGradientBrush

Namespace: ThinkGeo.Core

Encapsulates a GeoBrush with a radial (circular) gradient.

public class GeoRadialGradientBrush : GeoBrush

Inheritance object → GeoBrush → GeoRadialGradientBrush

Remarks:

This brush fills an area with a gradient defined by GeoRadialGradientBrush.ColorStops that runs from the center of the shape (offset 0) outward to its edge (offset 1).

Behavior details: Stops - colors are placed at normalized offsets from 0 (center) to 1 (edge); add as many as you like through . The two-color constructor is a shortcut that creates a center-to-edge gradient.Center - the gradient is centered on the middle of the shape's bounding box, not its centroid. For a circle, ellipse or rectangle this is the visual center; for an irregular or concave polygon the bounding-box center can fall outside the shape.Extent - the gradient is fitted to the bounding box as an axis-aligned ellipse, so the last stop is reached at the middle of each side. A circle stays circular and a non-square area is filled edge-to-edge; the gradient does not trace an irregular outline, and anything beyond the fitted ellipse is filled with the last stop's color.Color blend - adjacent stops are interpolated as a straight line in sRGB, component by component. It does not travel around a hue wheel, so red directly to blue passes through purple; insert intermediate stops to control the midtones.

For a gradient that runs along a line rather than from a center, use GeoLinearGradientBrush instead.

Properties

ColorStops

Gets the collection of GeoColorStop entries that define the gradient. Each stop places a color at a normalized offset from 0 (center) to 1 (edge); insert any number of stops to control the midtones. Stops are applied in ascending offset order regardless of the order they were added.

public Collection<GeoColorStop> ColorStops { get; }

Property Value

Collection<GeoColorStop>

Id

The id of the GeoBrush. This is always used as a key when in the cached brushes.

public long Id { get; }

Property Value

long

Constructors

GeoRadialGradientBrush(GeoColor, GeoColor)

Create an instance of GeoRadialGradientBrush by passing the center color and the edge color. This is a shortcut for a two-stop gradient (center at offset 0, edge at 1).

public GeoRadialGradientBrush(GeoColor centerColor, GeoColor edgeColor)

Parameters

centerColor GeoColor
This parameter specifies the GeoColor drawn at the center (offset 0).

edgeColor GeoColor
This parameter specifies the GeoColor drawn at the outer edge (offset 1).

GeoRadialGradientBrush(IEnumerable<GeoColorStop>)

Create an instance of GeoRadialGradientBrush from a set of color stops. Each stop's offset runs from 0 (center) to 1 (edge); the order does not matter.

public GeoRadialGradientBrush(IEnumerable<GeoColorStop> colorStops)

Parameters

colorStops IEnumerable<GeoColorStop>
This parameter specifies the GeoColorStop entries that define the gradient.