Skip to content

BrushFactory

JaykeBird edited this page Feb 21, 2023 · 7 revisions

Back to home | Back to Reference | View raw text

BrushFactory class

Description

A class that creates various brushes conveniently.

Diagram

  flowchart LR
  classDef interfaceStyle stroke-dasharray: 5 5;
  classDef abstractStyle stroke-width:4px
  subgraph SolidShineUi
  SolidShineUi.BrushFactory[[BrushFactory]]
  end
Loading

Members

Methods

Public Static methods

Returns Name
SolidColorBrush Create(...)
Create a brush based upon a single color.
DrawingBrush CreateCheckerboardBrush(...)
Create a brush with a checkerboard pattern, where the size and colors of the squares are customizable.
ImageBrush CreateFromImage(...)
Create a brush based upon an image.

Details

Summary

A class that creates various brushes conveniently.

Methods

Create [1/3]

public static SolidColorBrush Create(Color color)
Arguments
Type Name Description
Color color The color to use.
Summary

Create a brush based upon a single color.

Returns

A SolidColorBrush that includes the color.

Create [2/3]

public static SolidColorBrush Create(string hex)
Arguments
Type Name Description
string hex The hex value of the color to use.
Summary

Create a brush based upon a single color.

Returns

A SolidColorBrush that includes the color.

Create [3/3]

public static LinearGradientBrush Create(Color col1, Color col2, double angle)
Arguments
Type Name Description
Color col1 The first color.
Color col2 The second color.
double angle The angle of the gradient to be made.
Summary

Create a brush based upon two colors, made into a linear gradient.

Returns

A LinearGradientBrush that includes the two colors.

CreateFromImage [1/4]

public static ImageBrush CreateFromImage(ImageSource image)
Arguments
Type Name Description
ImageSource image The image to use.
Summary

Create a brush based upon an image.

Returns

An ImageBrush containing this image.

CreateFromImage [2/4]

public static ImageBrush CreateFromImage(Uri location)
Arguments
Type Name Description
Uri location The location, such as a web address or file location, of the image to use.
Summary

Create a brush based upon an image.

Returns

An ImageBrush containing this image.

CreateFromImage [3/4]

public static ImageBrush CreateFromImage(ImageSource image, TileMode tile)
Arguments
Type Name Description
ImageSource image The image to use.
TileMode tile The tiling mode to use for tiling this image.
Summary

Create a brush based upon an image, with tiling.

Returns

An ImageBrush containing this image.

CreateFromImage [4/4]

public static ImageBrush CreateFromImage(Uri location, TileMode tile)
Arguments
Type Name Description
Uri location The location, such as a web address or file location, of the image to use.
TileMode tile The tiling mode to use for tiling this image.
Summary

Create a brush based upon an image, with tiling.

Returns

An ImageBrush containing this image.

CreateCheckerboardBrush [1/2]

public static DrawingBrush CreateCheckerboardBrush(double squareSize, Color color1, Color color2)
Arguments
Type Name Description
double squareSize The size of each square in the pattern. A size of 4 will create a pattern of 4x4 squares, each of alternating colors.
Color color1 The color to use for the first set of squares.
Color color2 The color to use for the second, alternating set of squares.
Summary

Create a brush with a checkerboard pattern, where the size and colors of the squares are customizable.

CreateCheckerboardBrush [2/2]

public static DrawingBrush CreateCheckerboardBrush(double squareSize, Brush brush1, Brush brush2)
Arguments
Type Name Description
double squareSize The size of each square in the pattern. A size of 4 will create a pattern of 4x4 squares, each of alternating colors.
Brush brush1 The brush to use for the first set of squares.
Brush brush2 The brush to use for the second, alternating set of squares.
Summary

Create a brush with a checkerboard pattern, where the size and colors of the squares are customizable.

Generated with ModularDoc

Clone this wiki locally