BrushCreateTexture(IReadableBitmapData, Rectangle, TextureMapMode, Point, Boolean) Method

Creates a texture Brush, using the specified textureBounds for the texture parameter.
See the Examples section of the TextureMapMode enumeration for image examples.

Definition

Namespace: KGySoft.Drawing.Shapes
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 10.0.0-rc.1
C#
public static Brush CreateTexture(
	IReadableBitmapData texture,
	Rectangle textureBounds,
	TextureMapMode mapMode = TextureMapMode.Tile,
	Point offset = default,
	bool hasAlphaHint = true
)

Parameters

texture  IReadableBitmapData
The texture to use for the Brush.
textureBounds  Rectangle
A Rectangle that specifies the actual bounds of the specified texture.
mapMode  TextureMapMode  (Optional)
Determines how the texture is mapped to the target area. This parameter is optional.
Default value: Tile.
offset  Point  (Optional)
Specifies an offset to apply when mapping the texture to the target area. This parameter is optional.
Default value: Point.Empty.
hasAlphaHint  Boolean  (Optional)
to indicate that the texture uses the alpha channel (has transparency); otherwise, . This parameter is optional.
Default value: .

Return Value

Brush
A Brush that uses the specified texture.

Remarks

This overload allows you to map only a smaller region of the texture bitmap for the brush. It can be useful when a single bitmap contains multiple textures.

If the pixel format of the texture has alpha channel, but the texture does not use it, you can set the hasAlphaHint parameter to to improve performance. If the pixel format of the texture does not have an alpha channel, then this parameter is ignored.

See Also