Class

# RadialGradientBrush

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Creates an image which represents a gradient of colors radiating from an origin, the center of the gradient.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                  | Type                             | Read-Only | Shared |
|-------------------------------------------------------|----------------------------------|-----------|--------|
| `EndPoint<radialgradientbrush.endpoint>`              | `Point</api/graphics/point>`     |           |        |
| `EndRadius<radialgradientbrush.endradius>`            | `Double</api/data_types/double>` |           |        |
| `GradientStops\()<radialgradientbrush.gradientstops>` | `Pair</api/language/pair>`       |           |        |
| `StartPoint<radialgradientbrush.startpoint>`          | `Point</api/graphics/point>`     |           |        |
| `StartRadius<radialgradientbrush.startradius>`        | `Double</api/data_types/double>` |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                           | Parameters                                                                                                                                                                                                                                                       | Returns | Shared |
|------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|--------|
| `Constructor<radialgradientbrush.constructor>` | startPoint As `Point</api/graphics/point>`, endPoint As `Point</api/graphics/point>`, startRadius As `Double</api/data_types/double>`, endRadius As `Double</api/data_types/double>`, stops() As `Pair</api/language/pair>`                                      |         |        |
|                                                | startPoint As `Point</api/graphics/point>`, endPoint As `Point</api/graphics/point>`, startRadius As `Double</api/data_types/double>`, endRadius As `Double</api/data_types/double>`, `ParamArray</api/language/paramarray>` stops As `Pair</api/language/pair>` |         |        |

## Property descriptions

<div id="radialgradientbrush.endpoint">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RadialGradientBrush.EndPoint

**EndPoint** As `Point</api/graphics/point>`

> The distance from the `StartPoint<radialgradientbrush.startpoint>` to the point at which the gradient will end.

<div id="radialgradientbrush.endradius">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RadialGradientBrush.EndRadius

**EndRadius** As `Double</api/data_types/double>`

> The position within the `Graphics</api/graphics/graphics>` object where the gradient will end.
>
> <div class="warning">
>
> <div class="title">
>
> Warning
>
> </div>
>
> Windows does not support the `StartRadius<radialgradientbrush.startradius>`. Therefore, if the `StartPoint<radialgradientbrush.startpoint>` and `EndPoint<radialgradientbrush.endpoint>` are not the same and the `StartRadius<radialgradientbrush.startradius>` is greater than 0, an `InvalidArgumentException</api/exceptions/invalidargumentexception>` will occur.
>
> </div>
>
> If the EndRadius does not reach the edge of the drawing, the color of the last GradientStop will be use to fill the remaining area.

<div id="radialgradientbrush.gradientstops">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RadialGradientBrush.GradientStops

**GradientStops**() As `Pair</api/language/pair>`

> An array of values indicating the locations where the gradient changes color.
>
> Each element of the array is a `Pair</api/language/pair>` where the left value is a position and the right, a `Color</api/data_types/color>`. The position is the percentage of the area to be drawn with the `Color</api/data_types/color>` passed.
>
> This example (in the `Paint<desktopcanvas.paint>` event of a `Canvas</api/user_interface/desktop/desktopcanvas>` control) draws an oval with a gradient. The GradientStops property is used to add gradients at 0%, 50%, and 80%. In this example, `red<color.red>` will be used from 0% to 50% of the drawing area:
>
> ``` xojo
> Var radialBrush As New RadialGradientBrush
> radialBrush.StartPoint = New Point(g.width/2, g.height/2)
> radialBrush.EndPoint = radialBrush.StartPoint
> radialBrush.GradientStops.Add(New Pair(0, Color.Red))
> radialBrush.GradientStops.Add(New Pair(0.5, Color.Blue))
> radialBrush.GradientStops.Add(New Pair(0.8, Color.Green))
> radialBrush.StartRadius = 0
> radialBrush.EndRadius = 500
> g.Brush = radialBrush
> g.FillOval(0, 0, g.Width, g.Height)
> ```

<div id="radialgradientbrush.startpoint">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RadialGradientBrush.StartPoint

**StartPoint** As `Point</api/graphics/point>`

> The position within the `Graphics</api/graphics/graphics>` object where the gradient will begin.

<div id="radialgradientbrush.startradius">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RadialGradientBrush.StartRadius

**StartRadius** As `Double</api/data_types/double>`

> The distance from the `StartPoint<radialgradientbrush.startpoint>` to the point at which the gradient will start.
>
> <div class="warning">
>
> <div class="title">
>
> Warning
>
> </div>
>
> Windows does not support the `StartRadius<radialgradientbrush.startradius>`. Therefore, if the `StartPoint<radialgradientbrush.startpoint>` and `EndPoint<radialgradientbrush.endpoint>` are not the same and the `StartRadius<radialgradientbrush.startradius>` is greater than 0, an `InvalidArgumentException</api/exceptions/invalidargumentexception>` will occur.
>
> </div>

## Method descriptions

<div id="radialgradientbrush.constructor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RadialGradientBrush.Constructor

**Constructor**(startPoint As `Point</api/graphics/point>`, endPoint As `Point</api/graphics/point>`, startRadius As `Double</api/data_types/double>`, endRadius As `Double</api/data_types/double>`, stops() As `Pair</api/language/pair>`)

**Constructor**(startPoint As `Point</api/graphics/point>`, endPoint As `Point</api/graphics/point>`, startRadius As `Double</api/data_types/double>`, endRadius As `Double</api/data_types/double>`, `ParamArray</api/language/paramarray>` stops As `Pair</api/language/pair>`)

> Creates the <span class="title-ref">RadialGradientBrush</span> from the parameters passed.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> The new <span class="title-ref">RadialGradientBrush</span> created will be passed copies of the `Points</api/graphics/point>` and `Pairs</api/language/pair>` parameters.
>
> </div>

## Notes

A radial gradient is made up of two concentric circles where the gradient begins at the inner circle (as defined by the `StartPoint<radialgradientbrush.startpoint>`) and ends at the outer circle (as defined by the `EndPoint<radialgradientbrush.endpoint>`).

To create the effect of the radial gradient progressing out from the center of the drawing, set the `StartPoint<radialgradientbrush.startpoint>` and the `EndPoint<radialgradientbrush.endpoint>` to the center of the drawing.

<div class="warning">

<div class="title">

Warning

</div>

Windows does not support the `StartRadius<radialgradientbrush.startradius>`. Therefore, if the `StartPoint<radialgradientbrush.startpoint>` and `EndPoint<radialgradientbrush.endpoint>` are not the same and the `StartRadius<radialgradientbrush.startradius>` is greater than 0, an `InvalidArgumentException</api/exceptions/invalidargumentexception>` will occur.

</div>

<div class="note">

<div class="title">

Note

</div>

On Windows, if the `StartPoint<radialgradientbrush.startpoint>` and `EndPoint<radialgradientbrush.endpoint>` are the same, the greater of the `StartRadius<radialgradientbrush.startradius>`/`EndRadius<radialgradientbrush.endradius>` is used.

</div>

If the `EndRadius<radialgradientbrush.endradius>` does not reach the edge of the drawing, the color of the last GradientStop will be use to fill the remaining area.

## Sample code

This example code in the `Paint<desktopcanvas.paint>` event of a `Canvas</api/user_interface/desktop/desktopcanvas>` draws an oval filled with a radial gradient:

``` xojo
Var radialBrush As New RadialGradientBrush
radialBrush.StartPoint = New Point(g.Width / 2, g.Height / 2)
radialBrush.EndPoint = radialBrush.StartPoint
radialBrush.GradientStops.Add(New Pair(0, Color.Red))
radialBrush.GradientStops.Add(New Pair(0.5, Color.Blue))
radialBrush.GradientStops.Add(New Pair(0.8, Color.Green))
radialBrush.StartRadius = 0
radialBrush.EndRadius = 500
g.Brush = radialBrush
g.FillOval(0, 0, g.Width, g.Height)
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`GraphicsBrush</api/graphics/graphicsbrush>` parent class; `Graphics.Brush<graphics.brush>` property, `LinearGradientBrush</api/graphics/lineargradientbrush>`, `PictureBrush</api/graphics/picturebrush>`, and `ShadowBrush</api/graphics/shadowbrush>` classes.

</div>
