Home COM GDI+ WebBrowser Data Access 

Texture Brush Functions (GDI+)

 

 

The TextureBrush object is a Brush object that contains an Image object that is used for the fill. The fill image can be transformed by using the local Matrix object contained in the Brush object.

 

Return Values

If the function succeeds, it returns Ok, which is an element of the Status enumeration.

 

If the function fails, it returns one of the other elements of the Status enumeration.

 

GdipCreateTexture

 

Description

Creates a TextureBrush object based on an image and a wrap mode. The size of the brush defaults to the size of the image, so the entire image is used by the brush.

Syntax

GpStatus WINGDIPAPI GdipCreateTexture(

    GpImage *image,

    GpWrapMode wrapmode,

    GpTexture **texture

);

PowerBASIC Syntax

DECLARE FUNCTION GdipCreateTexture ( _

    BYVAL pImage AS DWORD, _

    BYVAL wrapMode AS LONG, _

    BYREF texture AS DWORD _

) AS LONG

Parameter

 

image

[in] Pointer to the Image object.

wrapMode

[in] Element 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. The default value is WrapModeTile.

texture

[out] Pointer to a variable that receives a pointer to the new created TextureBrush object.

Remarks

An area that extends beyond the boundaries of the brush is tiled with repeated copies of the brush. A texture brush may have alternate tiles flipped in a certain direction, as specified by the wrap mode. Flipping has the effect of reversing the brush's image. For example, if the wrap mode is specified as WrapModeTileFlipX, the brush is flipped about a line that is parallel to the y-axis.

 

The texture brush is always oriented at (0, 0). If the wrap mode is specified as WrapModeClamp, no area outside of the brush is tiled. For example, suppose you create a texture brush, specifying WrapModeClamp as the wrap mode:

hStatus = GdipCreateTextureBrush(pSomeImage, %WrapModeClamp, pTexture)

Then, you paint an area with the brush. If the size of the brush has a height of 50 and the painted area is a rectangle with its upper-left corner at (0, 50), you will see no repeated copies of the brush (no tiling).

 

The default wrap mode for a texture brush is WrapModeTile, which specifies no flipping of the tile and no clamping.

 

GdipCreateTexture2

 

Description

Creates a TextureBrush object based on an image, a wrap mode, and a defining set of coordinates.

Syntax

GpStatus WINGDIPAPI GdipCreateTexture2(

    GpImage *image,

    GpWrapMode wrapmode,

    REAL x,

    REAL y,

    REAL width,

    REAL height,

    GpTexture **texture

);

PowerBASIC Syntax

DECLARE FUNCTION GdipCreateTexture2 ( _

    BYVAL pImage AS DWORD, _

    BYVAL wrapMode AS LONG, _

    BYVAL x AS SINGLE, _

    BYVAL y AS SINGLE, _

    BYVAL nWidth AS SINGLE, _

    BYVAL nHeight AS SINGLE, _

    BYREF texture AS DWORD _

) AS LONG

Parameter

 

image

[in] Pointer to the Image object.

wrapMode

[in] Element 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.

x

[in] Leftmost coordinate of the image portion to be used by this brush.

y

[in] Uppermost coordinate of the image portion to be used by this brush.

width

[in] Width of the brush and width of the image portion to be used by the brush.

height

[in] Height of the brush and height of the image portion to be used by the brush.

texture

[out] Pointer to a variable that receives a pointer to the new created TextureBrush object.

Remarks

The x, y, width, and height parameters specify a rectangle. The size of the brush is defined by width and height. The x and y parameters have no affect on the brush's size or position the brush is always oriented at (0, 0). The x, y, width, and height 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:

hStatus = GdipCreateTexture2(pSomeImage, %WrapModeTile, 12, 50, 100, 150, pTexture).

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:

hStatus = GdipCreateTexture2(pSomeImage, %WrapModeTile, 0, 0, 256, 512, pTexture).

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.

 

GdipCreateTexture2I

 

Description

Creates a TextureBrush object based on an image, a wrap mode, and a defining set of coordinates.

Syntax

GpStatus WINGDIPAPI GdipCreateTexture2I(

    GpImage *image,

    GpWrapMode wrapmode,

    INT x,

    INT y,

    INT width,

    INT height,

    GpTexture **texture

);

PowerBASIC Syntax

DECLARE FUNCTION GdipCreateTexture2I ( _

    BYVAL pImage AS DWORD, _

    BYVAL wrapMode AS LONG, _

    BYVAL x AS LONG, _

    BYVAL y AS LONG, _

    BYVAL nWidth AS LONG, _

    BYVAL nHeight AS LONG, _

    BYREF texture AS DWORD _

) AS LONG

Parameter

 

image

[in] Pointer to the Image object.

wrapMode

[in] Element 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.

x

[in] Leftmost coordinate of the image portion to be used by this brush.

y

[in] Uppermost coordinate of the image portion to be used by this brush.

width

[in] Width of the brush and width of the image portion to be used by the brush.

height

[in] Height of the brush and height of the image portion to be used by the brush.

texture

[out] Pointer to a variable that receives a pointer to the new created TextureBrush object.

Remarks

The x, y, width, and height parameters specify a rectangle. The size of the brush is defined by width and height. The x and y parameters have no affect on the brush's size or position the brush is always oriented at (0, 0). The x, y, width, and height 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:

hStatus = GdipCreateTexture2I(pSomeImage, %WrapModeTile, 12, 50, 100, 150, pTexture).

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:

hStatus = GdipCreateTexture2I(pSomeImage, %WrapModeTile, 0, 0, 256, 512, pTexture).

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.

 

GdipCreateTextureIA

 

Description

Creates a TextureBrush object based on an image, a defining set of coordinates, and a set of image properties.

Syntax

GpStatus WINGDIPAPI GdipCreateTextureIA(

    GpImage *image,

    GDIPCONST GpImageAttributes *imageAttributes,

    REAL x,

    REAL y,

    REAL width,

    REAL height,

    GpTexture **texture

);

PowerBASIC Syntax

DECLARE FUNCTION GdipCreateTextureIA ( _

    BYVAL pImage AS DWORD, _

    BYVAL imageAttributes AS DWORD, _

    BYVAL x AS SINGLE, _

    BYVAL y AS SINGLE, _

    BYVAL nWidth AS SINGLE, _

    BYVAL nHeight AS SINGLE, _

    BYREF texture AS DWORD _

) AS LONG

Parameter

 

image

[in] Pointer to the Image object.

imageAttributes

[in] Pointer to an ImageAttributes object that contains properties of the image. The default value is NULL.

x

[in] Leftmost coordinate of the image portion to be used by this brush.

y

[in] Uppermost coordinate of the image portion to be used by this brush.

width

[in] Width of the brush and width of the image portion to be used by the brush.

height

[in] Height of the brush and height of the image portion to be used by the brush.

texture

[out] Pointer to a variable that receives a pointer to the new created TextureBrush object.

 

GdipCreateTextureIAI

 

Description

Creates a TextureBrush object based on an image, a defining set of coordinates, and a set of image properties.

Syntax

GpStatus WINGDIPAPI GdipCreateTextureIAI(

    GpImage *image,

    GDIPCONST GpImageAttributes *imageAttributes,

    INT x,

    INT y,

    INT width,

    INT height,

    GpTexture **texture

);

PowerBASIC Syntax

DECLARE FUNCTION GdipCreateTextureIAI ( _

    BYVAL pImage AS DWORD, _

    BYVAL imageAttributes AS DWORD, _

    BYVAL x AS LONG, _

    BYVAL y AS LONG, _

    BYVAL nWidth AS LONG, _

    BYVAL nHeight AS LONG, _

    BYREF texture AS DWORD _

) AS LONG

Parameter

 

image

[in] Pointer to the Image object.

imageAttributes

[in] Pointer to an ImageAttributes object that contains properties of the image. The default value is NULL.

x

[in] Leftmost coordinate of the image portion to be used by this brush.

y

[in] Uppermost coordinate of the image portion to be used by this brush.

width

[in] Width of the brush and width of the image portion to be used by the brush.

height

[in] Height of the brush and height of the image portion to be used by the brush.

texture

[out] Pointer to a variable that receives a pointer to the new created TextureBrush object.

 

GdipGetTextureImage

 

Description

Gets a pointer to the Image object that is defined by this texture brush.

Syntax

GpStatus WINGDIPAPI GdipGetTextureImage(

    GpTexture *brush,

    GpImage **image

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetTextureImage ( _

    BYVAL brush AS DWORD, _

    BYREF pImage AS DWORD _

) AS LONG

Parameter

 

brush

[in] Pointer to the TextureBrush object.

image

[out] Pointer to a variable that receives a pointer to the Image object that is defined by this texture brush.

 

GdipGetTextureTransform

 

Description

Gets the transformation matrix of this texture brush.

Syntax

GpStatus WINGDIPAPI GdipGetTextureTransform(

    GpTexture *brush,

    GpMatrix *matrix

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetTextureTransform ( _

    BYVAL brush AS DWORD, _

    BYREF matrix AS DWORD _

) AS LONG

Parameter

 

brush

[in] Pointer to the TextureBrush object.

matrix

[out] Pointer to a Matrix object that receives the transformation matrix.

 

GdipGetTextureWrapMode

 

Description

Gets the wrap mode currently set for this texture brush.

Syntax

GpStatus WINGDIPAPI GdipGetTextureWrapMode(

    GpTexture *brush,

    GpWrapMode *wrapmode

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetTextureWrapMode ( _

    BYVAL brush AS DWORD, _

    BYREF wrapMode AS LONG _

) AS LONG

Parameter

 

brush

[in] Pointer to the TextureBrush object.

wrapMode

[out] Pointer to a variable that receives the wrap mode currently set for this texture brush. The value returned is one of the elements of the WrapMode enumeration.

 

GdipMultiplyTextureTransform

 

Description

Updates this brush's transformation matrix with the product of itself and another matrix.

Syntax

GpStatus WINGDIPAPI GdipMultiplyTextureTransform(

    GpTexture* brush,

    GDIPCONST GpMatrix *matrix,

    GpMatrixOrder order

);

PowerBASIC Syntax

DECLARE FUNCTION GdipMultiplyTextureTransform ( _

    BYVAL brush AS DWORD, _

    BYVAL matrix AS DWORD, _

    BYVAL order AS LONG _

) AS LONG

Parameter

 

brush

[in] Pointer to the TextureBrush object.

matrix

[in] Pointer to the matrix to be multiplied by this brush's current transformation matrix.

order

[in] Element of the MatrixOrder enumeration that specifies the order of multiplication. MatrixOrderPrepend specifies that the passed matrix is on the left, and MatrixOrderAppend specifies that the passed matrix is on the right. The default value is MatrixOrderPrepend.

 

GdipResetTextureTransform

 

Description

Resets the transformation matrix of this texture brush to the identity matrix. This means that no transformation takes place.

Syntax

GpStatus WINGDIPAPI GdipResetTextureTransform(

    GpTexture* brush

);

PowerBASIC Syntax

DECLARE FUNCTION GdipResetTextureTransform ( _

    BYVAL brush AS DWORD _

) AS LONG

Parameter

 

brush

[in] Pointer to the TextureBrush object.

 

GdipRotateTextureTransform

 

Description

Resets the transformation matrix of this texture brush to the identity matrix. This means that no transformation takes place.

Syntax

GpStatus WINGDIPAPI GdipRotateTextureTransform(

    GpTexture* brush,

    REAL angle,

    GpMatrixOrder order

);

PowerBASIC Syntax

DECLARE FUNCTION GdipRotateTextureTransform ( _

    BYVAL brush AS DWORD, _

    BYVAL angle AS SINGLE, _

    BYVAL order AS LONG _

) AS LONG

Parameter

 

brush

[in] Pointer to the TextureBrush object.

angle

[in] Single precision value that specifies the angle, in degrees, of rotation.

order

[in] Element of the MatrixOrder enumeration that specifies the order of the multiplication. MatrixOrderPrepend specifies that the rotation matrix is on the left, and MatrixOrderAppend specifies that the rotation matrix is on the right. The default value is MatrixOrderPrepend.

 

GdipScaleTextureTransform

 

Description

Updates this texture brush's current transformation matrix with the product of itself and a scaling matrix.

Syntax

GpStatus WINGDIPAPI GdipScaleTextureTransform(

    GpTexture* brush,

    REAL sx,

    REAL sy,

    GpMatrixOrder order

);

PowerBASIC Syntax

DECLARE FUNCTION GdipScaleTextureTransform ( _

    BYVAL brush AS DWORD, _

    BYVAL sx AS SINGLE, _

    BYVAL sy AS SINGLE, _

    BYVAL order AS LONG _

) AS LONG

Parameter

 

brush

[in] Pointer to the TextureBrush object.

sx

[in] Single precision value that specifies the amount to scale in the x direction.

sy

[in] Single precision value that specifies the amount to scale in the y direction.

order

[in] Element of the MatrixOrder enumeration that specifies the order of the multiplication. MatrixOrderPrepend specifies that the rotation matrix is on the left, and MatrixOrderAppend specifies that the rotation matrix is on the right. The default value is MatrixOrderPrepend.

 

GdipSetTextureTransform

 

Description

Sets the transformation matrix of this texture brush.

Syntax

GpStatus WINGDIPAPI GdipSetTextureTransform(

    GpTexture *brush,

    GDIPCONST GpMatrix *matrix

);

PowerBASIC Syntax

DECLARE FUNCTION GdipSetTextureTransform ( _

    BYVAL brush AS DWORD, _

    BYVAL matrix AS DWORD _

) AS LONG

Parameter

 

brush

[in] Pointer to the TextureBrush object.

matrix

[in] Pointer to a Matrix object that specifies the transformation matrix to use.

 

GdipSetTextureWrapMode

 

Description

Sets the transformation matrix of this texture brush.

Syntax

GpStatus WINGDIPAPI GdipSetTextureWrapMode(

    GpTexture *brush,

    GpWrapMode wrapmode

);

PowerBASIC Syntax

DECLARE FUNCTION GdipSetTextureWrapMode ( _

    BYVAL brush AS DWORD, _

    BYVAL wrapMode AS LONG _

) AS LONG

Parameter

 

brush

[in] Pointer to the TextureBrush object.

wrapMode

[in] Element 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.

 

GdipTranslateTextureTransform

 

Description

Updates this brush's current transformation matrix with the product of itself and a translation matrix.

Syntax

GpStatus WINGDIPAPI GdipTranslateTextureTransform(

    GpTexture* brush,

    REAL dx,

    REAL dy,

    GpMatrixOrder order

);

PowerBASIC Syntax

DECLARE FUNCTION GdipTranslateTextureTransform ( _

    BYVAL brush AS DWORD, _

    BYVAL dx AS SINGLE, _

    BYVAL dy AS SINGLE, _

    BYVAL order AS LONG _

) AS LONG

Parameter

 

brush

[in] Pointer to the TextureBrush object.

dx

[in] Single precision value that specifies the horizontal component of the translation.

dy

[in] Single precision value that specifies the vertical component of the translation.

order

[in] Element of the MatrixOrder enumeration that specifies the order of the multiplication. MatrixOrderPrepend specifies that the translation matrix is on the left, and MatrixOrderAppend specifies that the translation matrix is on the right. The default value is MatrixOrderPrepend.

 

Page last updated on Monday, 11 December 2006 11:01:16 +0100