Class NinePatchImageBrush
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
sourceITextureThe texture to draw.
patchSplitThicknessThe 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
sourceITextureThe texture to draw.
areaRectangleThe region of
sourceholding the image.patchSplitThicknessThe 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
Methods
Draw(IRenderContext, in TextureRenderingOptions)
Draws a brush on the specified render surface.
public override void Draw(IRenderContext context, in TextureRenderingOptions options)
Parameters
contextIRenderContextAn instance of the render context to draw brush with..
optionsTextureRenderingOptionsOptions to draw the brush with.