Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

Rt2dBrush
[Rt2d]


Functions

Rt2dBrush Rt2dBrushCreate (void)
RwBool  Rt2dBrushDestroy (Rt2dBrush *brush)
Rt2dBrush Rt2dBrushSetRGBA (Rt2dBrush *brush, RwRGBA *col0, RwRGBA *col1, RwRGBA *col2, RwRGBA *col3)
Rt2dBrush Rt2dBrushSetUV (Rt2dBrush *brush, RwV2d *uv0, RwV2d *uv1, RwV2d *uv2, RwV2d *uv3)
Rt2dBrush Rt2dBrushSetTexture (Rt2dBrush *brush, RwTexture *texture)
RwUInt32  Rt2dBrushStreamGetSize (Rt2dBrush *brush)
Rt2dBrush Rt2dBrushStreamWrite (Rt2dBrush *brush, RwStream *stream)
Rt2dBrush Rt2dBrushStreamRead (RwStream *stream)
Rt2dBrush Rt2dBrushSetWidth (Rt2dBrush *brush, RwReal width)
RwReal  Rt2dBrushGetWidth (Rt2dBrush *brush)

Detailed Description

Brush functions

Function Documentation

Rt2dBrush* Rt2dBrushCreate void   
 

Rt2dBrushCreate is used to create a new brush for painting and filling paths. Note that the primitive resulting from a painted path is topologically equivalent to a rectangle.

A newly created brush has a number of default properties but these can be defined by an application using the available API functions.

Relevant properties are:

Brush width
Used only when painting a path; width is measured perpendicular to path and the path lies at the center of the painted primitive. Default: 1.0.
Brush colors
Four colors are required: For painting they define the colors at the corners of the resulting primitive; for filling they define the colors at the corners of the path's bounding-box. In both cases, the corner colors are ordered anticlockwise and interior colors are determined by bilinear interpolation. Default: All colors are opaque white.
Brush texture coordinates
Four (u, v) pairs are required: For painting they define the texture coordinates at the corners of the resulting primitive; for filling they define the texture coordinates at the corners of the path's bounding-box. In both cases, corner texture coordinates are ordered anticlockwise and interior coordinates are determined by bilinear interpolation. Default: All texture coordinates are zero.
Brush texture image
Image used for texturing; texture coordinates must also be properly defined. Default:NULL.
The include file rt2d.h and the library file rt2d.lib are required to use this function.
Returns:
a pointer to the new brush if successful or NULL if there is an error.
See also:
Rt2dBrushDestroy , Rt2dBrushSetWidth , Rt2dBrushSetRGBA , Rt2dBrushSetUV , Rt2dBrushSetTexture
RwBool Rt2dBrushDestroy Rt2dBrush   brush
 

Rt2dBrushDestroy is used to destroy the specified brush. All brushes created by an application must be destroyed before the application closes down. The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
brush  Pointer to the brush
Returns:
TRUE if successful or FALSE if there is an error
See also:
Rt2dBrushCreate , Rt2dOpen , Rt2dClose
RwReal Rt2dBrushGetWidth Rt2dBrush   brush
 

Rt2dBrushGetWidth is used to retrieve the width of the specified brush. The width is used only when painting a path; it is measured perpendicular to path and the path lies at the center of the painted primitive. A newly created brush has a unit width. The include file rt2d.h and the library file rt2d.lib are required to use this function.

Note that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.

Parameters:
brush  Pointer to the brush.
Returns:
a RwReal value equal to the width of the brush if successful or zero if there is an error.
See also:
Rt2dBrushSetWidth , Rt2dBrushSetRGBA , Rt2dBrushSetUV , Rt2dBrushSetTexture , Rt2dBrushCreate
Rt2dBrush* Rt2dBrushSetRGBA Rt2dBrush   brush,
RwRGBA   col0,
RwRGBA   col1,
RwRGBA   col2,
RwRGBA   col3
 

Rt2dBrushSetRGBA is used to define the color of the specified brush. Four colors are required: For painting they define the colors at the corners of the resulting primitive; for filling they define the colors at the corners of the path's bounding-box. In both cases, corner colors are ordered anticlockwise and interior colors are determined by bilinear interpolation. By default all colors are opaque white. The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
brush  Pointer to the brush.
col0  Pointer to the first color.
col1  Pointer to the second color.
col2  Pointer to the third color.
col3  Pointer to the fourth color.
Returns:
pointer to the brush if successful or NULL if there is an error.
See also:
Rt2dBrushSetWidth , Rt2dBrushSetUV , Rt2dBrushSetTexture , Rt2dBrushCreate , Rt2dPathStroke , Rt2dPathFill
Rt2dBrush* Rt2dBrushSetTexture Rt2dBrush   brush,
RwTexture   texture
 

Rt2dBrushSetTexture is used to define a texture for the specified brush using the given image. For texturing to work properly, appropriate texture coordinates must also be defined. The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
brush  Pointer to the brush.
texture  Pointer to the texture.
Returns:
pointer to the brush if successful or NULL if there is an error.
See also:
Rt2dBrushSetUV , Rt2dBrushSetRGBA , Rt2dBrushSetWidth , Rt2dBrushCreate
Rt2dBrush* Rt2dBrushSetUV Rt2dBrush   brush,
RwV2d   uv0,
RwV2d   uv1,
RwV2d   uv2,
RwV2d   uv3
 

Rt2dBrushSetUV is used to define the texture coordinates for the specified brush. Four (u, v) pairs are required: For painting they define the texture coordinates at the corners of the resulting primitive; for filling they define the texture coordinates at the corners of the path's bounding-box. In both cases, corner texture coordinates are ordered anticlockwise and interior coordinates are determined by bilinear interpolation. By default all texture coordinates are zero. The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
brush  Pointer to the brush.
uv0  Pointer to the first texture coordinates.
uv1  Pointer to the second texture coordinates.
uv2  Pointer to the third texture coordinates.
uv3  Pointer to the fourth texture coordinates.
Returns:
pointer to the brush if successful or NULL if there is an error.
See also:
Rt2dBrushSetTexture , Rt2dBrushSetRGBA , Rt2dBrushSetWidth , Rt2dBrushCreate
Rt2dBrush* Rt2dBrushSetWidth Rt2dBrush   brush,
RwReal    width
 

Rt2dBrushSetWidth is used to define the width of the specified brush. The width is used only when painting a path; it is measured perpendicular to path and the path lies at the center of the painted primitive. A newly created brush has a unit width. The include file rt2d.h and the library file rt2d.lib are required to use this function.

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
brush  Pointer to the brush.
width  A RwReal value equal to the width of the brush.
Returns:
pointer to the brush if successful or NULL if there is an error.
See also:
Rt2dBrushGetWidth , Rt2dBrushSetRGBA , Rt2dBrushSetUV , Rt2dBrushSetTexture , Rt2dBrushCreate
RwUInt32 Rt2dBrushStreamGetSize Rt2dBrush   brush
 

Rt2dBrushStreamGetSize is used to determine the size in bytes of the binary representation of the given brush. This is used in the binary chunk header to indicate the size of the chunk. The size does include the size of the chunk header.

Parameters:
brush  Pointer to the brush.
Returns:
Returns a RwUInt32 value equal to the chunk size (in bytes) of the brush or zero if there is an error.
See also:
Rt2dBrushStreamRead , Rt2dBrushStreamWrite
Rt2dBrush* Rt2dBrushStreamRead RwStream   stream
 

Rt2dBrushStreamRead is used to read a brush object from the specified binary stream. Note that prior to this function call a brush chunk must be found in the stream using the RwStreamFindChunk API function.

The sequence to locate and read a brush from a binary stream is as follows:

   RwStream  *stream;
   Rt2dBrush *newBrush;

   stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "mybinary.xxx");
   if( stream )
   {
       if( RwStreamFindChunk(stream, rwID_2DBRUSH, NULL, NULL) )
       {
           newBrush = Rt2dBrushStreamRead(stream);
       }

       RwStreamClose(stream, NULL);
   }
Parameters:
stream  Pointer to the stream.
Returns:
Returns pointer to the brush if successful or NULL if there is an error.
See also:
Rt2dBrushStreamWrite , Rt2dBrushStreamGetSize , RwStreamOpen , RwStreamClose
Rt2dBrush* Rt2dBrushStreamWrite Rt2dBrush   brush,
RwStream   stream
 

Rt2dBrushStreamWrite is used to write the specified brush to the given binary stream. Note that the stream will have been opened prior to this function call.

Parameters:
brush  Pointer to the brush.
stream  Pointer to the stream.
Returns:
Returns pointer to the brush if successful or NULL if there is an error.
See also:
Rt2dBrushStreamRead , Rt2dBrushStreamGetSize , RwStreamOpen , RwStreamClose

Criterion Software © 1993-2003 Criterion Software Limited. All rights reserved. Built Tue Apr 22 12:46:47 2003. Send Feedback
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)