Table of Contents

Class NinePatchImageBrush

Namespace
Icy.Rendering.Brushes
Assembly
IcyUI.dll

Represents an image brush specialized for the controls drawing.

public class NinePatchImageBrush : ImageBrush, IImage, IBrush
Inheritance
NinePatchImageBrush
Implements
Inherited Members
Extension Methods

Remarks

When drawing, the image is split into 9 patches by PatchSplitPadding: the corners keep their size, the edges stretch along one axis, and the center stretches along both. That lets one small image frame a control of any size, such as a button background with rounded corners.

The padding is measured in source pixels. The destination patches are recomputed on every draw, so the brush follows the element as it moves or resizes.

Constructors

NinePatchImageBrush(ITexture, Thickness)

Initializes a new instance of the NinePatchImageBrush class over a whole texture.

public NinePatchImageBrush(ITexture source, Thickness patchSplit)

Parameters

source ITexture

The texture to draw.

patchSplit Thickness

The width of each border band, in source pixels.

NinePatchImageBrush(ITexture, Rectangle, Thickness)

Initializes a new instance of the NinePatchImageBrush class over a region of a texture.

public NinePatchImageBrush(ITexture source, Rectangle area, Thickness patchSplit)

Parameters

source ITexture

The texture to draw.

area Rectangle

The region of source holding the image.

patchSplit Thickness

The width of each border band, in source pixels.

Properties

PatchSplitPadding

Gets or sets the width of each border band, in source pixels: the left, top, right and bottom bands keep their size when drawn, and the center stretches.

public Thickness PatchSplitPadding { get; set; }

Property Value

Thickness

Methods

Draw(IRenderContext, in TextureRenderingOptions)

Draws a brush on the specified render surface.

public override void Draw(IRenderContext context, in TextureRenderingOptions options)

Parameters

context IRenderContext

An instance of the render context to draw brush with..

options TextureRenderingOptions

Options to draw the brush with.