ThinkGeo.com    |     Documentation    |     Premium Support

Radial Gradient Brush

Is it possible to the get to create a radial gradient brush? I see GeoLinearGradientBrush but I would like to be able to set the gradient outward from the center of a circle. I could possibly use an image, if it is not possible.

Thanks,
James R.

Hi James,

We’ve added a GeoRadialGradientBrush for this in beta112. It fills a shape from its center out to the edge, so a circle (EllipseShape) gets that center glow — no image needed.

Simple two-color:

new AreaStyle(new GeoRadialGradientBrush(GeoColors.Red, GeoColors.Blue));

Or use color stops (offset 0 = center, 1 = edge) for full control of the mid-tones:

new AreaStyle(new GeoRadialGradientBrush(new List {
new GeoColorStop(0f, GeoColors.Red),
new GeoColorStop(0.5f, GeoColors.White),
new GeoColorStop(1f, GeoColors.Blue),
}));

It fits the shape’s bounding box and renders server-side through our Skia canvas, so it works in Blazor Server side as well. Pull the latest and have a try.

Thanks,
Ben

Thanks as always Ben. It works great. Let me know it will make it into 14.5.4.

James R.

You are welcome!

Yes, it will be in 14.5.4, should be around later this week or early next week.