Help Center

CGpTextureBrush.Constructorsconstructor

Creates a texture brush.

GraphicsconstructorCGpBrush.incdoc-orphan
No implementation located. This member is documented, but the source scan found no matching declaration. It is likely declared in a header this scan does not resolve, or provided by a macro.

Syntax

CONSTRUCTOR CGpTextureBrush (BYVAL pTextureBrush AS CGpTextureBrush PTR)
CONSTRUCTOR CGpTextureBrush (BYVAL pImage AS CGpImage PTR, BYVAL nWrapMode AS WrapMode = WrapModeTile)
CONSTRUCTOR CGpTextureBrush (BYVAL pImage AS CGpImage PTR, BYVAL dstRect AS GpRectF PTR, BYVAL pImageAttributes AS CGpImageAttributes PTR = NULL)
CONSTRUCTOR CGpTextureBrush (BYVAL pImage AS CGpImage PTR, BYVAL dstRect AS GpRect PTR, BYVAL pImageAttributes AS CGpImageAttributes PTR = NULL)
CONSTRUCTOR CGpTextureBrush (BYVAL pImage AS CGpImage PTR, BYVAL nWrapMode AS WrapMode, BYVAL dstRect AS GpRect PTR)
CONSTRUCTOR CGpTextureBrush (BYVAL pImage AS CGpImage PTR, BYVAL nWrapMode AS WrapMode, BYVAL dstX AS SINGLE, BYVAL dstY AS SINGLE, BYVAL dstWidth AS SINGLE, BYVAL dstHeight AS SINGLE)

Parameters

NameDescription
pImagePointer to a variable that will receive a pointer to the Image object that is defined by this texture brush.
nWrapModeElement of the WrapMode enumeration that specifies how repeated copies of an image are used to tile an area when it is painted with this texture brush.
dstXLeftmost coordinate of the image portion to be used by this brush.
dstYUppermost coordinate of the image portion to be used by this brush.
dstWidthWidth of the brush and width of the image portion to be used by the brush.
dstHeightHeight of the brush and height of the image portion to be used by the brush.
dstHeightHeight of the brush and height of the image portion to be used by the brush.

Description

Creates a texture brush.

Remarks

The dstX, dstY, dstWidth, and dstHeight parameters specify a rectangle. The size of the brush is defined by dstWidth and dstHeight. The dstX and dstY parameters have no affect on the brush's size or position — the brush is always oriented at (0, 0). The dstX, dstY, dstWidth, and dstHeight parameters define the portion of the image to be used by the brush.

For example, suppose you have an image that is stored in an Image object and is 256 ×512 (width ×height) pixels. Then you create a TextureBrush object based on this image as follows:

The brush will have a width of 100 units and a height of 150 units. The brush will use a rectangular portion of the image. This portion begins at the pixel having coordinates (12, 50). The width and height of the portion are 100 and 150, respectively, measured from the starting pixel.

Now suppose you create another TextureBrush object based on the same image and specify a different rectangle:

The brush will have width and height equal to 256 and 512, respectively. The brush will use the entire image instead of a portion of it because the rectangle specifies a starting pixel at coordinates (0, 0) and dimensions identical to those of the image.

Examples

TextureBrush(@someImage, WrapModeTile, 12, 50, 100, 150)

TextureBrush(@someImage, WrapModeTile, 0, 0, 256, 512)

Reference

  • Include file CGpBrush.inc
  • Documented in Graphics/GdiPlus Classes/CGpBrush Classes.md
  • Topic: CGpBrush Class