Note
public abstract class Brush
Public MustInherit Class Brush
public ref class Brush abstract
[<AbstractClassAttribute>]
type Brush = class end
Brushes are used for filling shapes. There are several shape-filling methods in the BitmapDataExtensions class, whose names start with Fill or BeginFill. The ones that have no Brush parameter use a solid brush implicitly, created from the specified Color32 instance.
The Brush class is abstract, and you can create instances by using the static Create... methods. The created instances are immutable.
The following table enlists the available brushes and their factory methods:
Description | Image Example |
---|---|
CreateSolid: Creates a solid brush with a single color. Color32, Color64 and ColorF overloads are available, and you can also use the named Color members to cast them to Color32 implicitly. For example, Brush.CreateSolid(Color32.FromArgb(128, Color.Blue)) creates a blue solid brush with 50% transparency that can produce a similar result to the one in the image. | ![]() |
CreateLinearGradient: Creates a linear gradient brush. There are two groups of overloads: one for specifying a pair of start/end points optionally with some GradientWrapMode, and another one with an angle, which automatically stretches the gradient for the paths to fill. The top image uses specific start/end points without repeating the gradient, whereas the bottom one just specified a zero angle to create a horizontal gradient. Note that in the bottom image the start/end points are automatically adjusted to the bounds of the shape in each fill sessions. Both examples filled a single elliptic path with three different translations. See the Examples section of the GradientWrapMode enumeration and the CreateLinearGradient(Single, Color32, Color32, WorkingColorSpace) method for more image examples. | ![]() ![]() |
CreateTexture: Creates a texture brush. A TextureMapMode can be specified, which allows tiling, stretching, centering and a few other modes. The top image uses a texture with a map mode of tiling with mirroring on both axes, whereas the bottom one centers the same texture and uses no alpha blending, so where there is no texture pixel to set, the path region cuts a transparent hole in the image. Both examples filled a single elliptic path with three different translations. See the Examples section of the TextureMapMode enumeration for more image examples. | ![]() ![]() |
CreateLinearGradient(Single, Color32, Color32, WorkingColorSpace) | Creates a linear gradient Brush that blends from one color to another along a straight line. The line is specified by an angle only, whereas the actual start and end points are determined by the bounding rectangle of the current Path in each session. |
CreateLinearGradient(Single, Color64, Color64, WorkingColorSpace) |
Creates a linear gradient Brush that blends from one color to another along a straight line. The line is specified by an angle only,
whereas the actual start and end points are determined by the bounding rectangle of the current Path in each session.
See the Examples section of the CreateLinearGradient(Single, Color32, Color32, WorkingColorSpace) overload for an example with image. |
CreateLinearGradient(Single, ColorF, ColorF, WorkingColorSpace) |
Creates a linear gradient Brush that blends from one color to another along a straight line. The line is specified by an angle only,
whereas the actual start and end points are determined by the bounding rectangle of the current Path in each session.
See the Examples section of the CreateLinearGradient(Single, Color32, Color32, WorkingColorSpace) overload for an example with image. |
CreateLinearGradient(PointF, PointF, Color32, Color32, GradientWrapMode, WorkingColorSpace) |
Creates a linear gradient Brush that blends from one color to another along a straight line specified by startPoint and endPoint.
See the Examples section of the GradientWrapMode enumeration for image examples. |
CreateLinearGradient(PointF, PointF, Color64, Color64, GradientWrapMode, WorkingColorSpace) |
Creates a linear gradient Brush that blends from one color to another along a straight line specified by startPoint and endPoint.
See the Examples section of the GradientWrapMode enumeration for image examples. |
CreateLinearGradient(PointF, PointF, ColorF, ColorF, GradientWrapMode, WorkingColorSpace) |
Creates a linear gradient Brush that blends from one color to another along a straight line specified by startPoint and endPoint.
See the Examples section of the GradientWrapMode enumeration for image examples. |
CreateSolid(Color32) | Creates a solid Brush with the specified 32-bit color. |
CreateSolid(Color64) |
Creates a solid Brush with the specified 64-bit color.
See the Remarks section of the CreateSolid(Color32) overload for details. |
CreateSolid(ColorF) |
Creates a solid Brush with the specified 128-bit color.
See the Remarks section of the CreateSolid(Color32) overload for details. |
CreateTexture(IReadableBitmapData, TextureMapMode, Point, Boolean) |
Creates a texture Brush with the specified texture.
See the Examples section of the TextureMapMode enumeration for image examples. |
CreateTexture(IReadableBitmapData, Rectangle, TextureMapMode, Point, Boolean) |
Creates a texture Brush, using the specified textureBounds for the texture parameter.
See the Examples section of the TextureMapMode enumeration for image examples. |