Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

Rt2dShape
[Rt2d]


Functions

Rt2dObject Rt2dShapeCreate (void)
RwBool  Rt2dShapeDestroy (Rt2dObject *shape)
Rt2dObject Rt2dShapeAddNode (Rt2dObject *shape, RwUInt32 flag, Rt2dPath *path, Rt2dBrush *brush)
RwInt32  Rt2dShapeGetNodeCount (Rt2dObject *shape)
Rt2dObject Rt2dShapeRender (Rt2dObject *object)
Rt2dObject Rt2dShapeStreamWrite (Rt2dObject *shape, RwStream *stream)
RwUInt32  Rt2dShapeStreamGetSize (Rt2dObject *shape)
Rt2dObject Rt2dShapeStreamRead (RwStream *stream)
Rt2dObject Rt2dShapeLock (Rt2dObject *shape)
Rt2dObject Rt2dShapeUnlock (Rt2dObject *shape)

Detailed Description

Shapes

Rt2dShape Overview

Shapes are collections of brushes and paths which are added together using nodes. Shapes can be saved and added to scenes.

Creating Shapes
  1. Rt2dShapeCreate creates the shape.
  2. Rt2dShapeAddNode adds the shape, path, brushes together.
Adding Shapes to Scenes
  1. Rt2dSceneLock locks the scene.
  2. Rt2dSceneAddChild adds the shape to the scene.
  3. Rt2dSceneUnlock unlocks the scene.

Function Documentation

Rt2dObject* Rt2dShapeAddNode Rt2dObject   shape,
RwUInt32    flag,
Rt2dPath   path,
Rt2dBrush   brush
 

Rt2dShapeAddNode adds the shape, path and brush together. The property of the particular path node, such as solid or outline, is defined by the flag parameter. See Rt2dShapeNodeFlag. Shapes with color-gradient brushes do not support dynamic update of colors

Parameters:
shape  Pointer to the shape object.
flag  Shape's property flag.
path  Pointer to the path object.
brush  Pointer to the brush object.
Returns:
Returns pointer to a shape, NULL otherwise.
See also:
Rt2dShapeCreate , Rt2dShapeGetNewPath , Rt2dShapeGetNodeCount
Rt2dObject* Rt2dShapeCreate void   
 

Rt2dShapeCreate is used to create and initialize a new shape object. To create a new shape:

  1. Rt2dShapeCreate creates the shape.
  2. Rt2dShapeAddNode adds the shape, path, brushes together.
Returns:
Returns a pointer to the new shape object if successful, NULL otherwise.
See also:
Rt2dShapeAddNode , Rt2dShapeDestroy
RwBool Rt2dShapeDestroy Rt2dObject   object
 

Rt2dShapeDestroy is called to destroy the specified shape.

Note:
If a shape has been added to a scene the scene takes ownership of the shape and the shape can only be destroyed as part of the scene using Rt2dSceneDestroy.
Parameters:
object  Pointer to the shape object to destroy.
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
Rt2dShapeCreate , Rt2dSceneCreate , Rt2dSceneDestroy
RwInt32 Rt2dShapeGetNodeCount Rt2dObject   shape
 

Rt2dShapeGetNodeCount is used to determine the number of nodes in a shape.

Parameters:
shape  Pointer to a shape.
Returns:
Returns the number of nodes in a shape.
See also:
Rt2dShapeCreate , Rt2dShapeAddNode
Rt2dObject* Rt2dShapeLock Rt2dObject   shape
 

Rt2dShapeLock locks a shape for editing. A locked shape can not be streamed or rendered and is provided only for editing purposes. When a shape is locked, Rt2dPath and Rt2dBrush can be added or removed.

Parameters:
shape  Pointer to the shape
Returns:
Returns a pointer to the shape if successful, NULL otherwise.
See also:
Rt2dShapeAddNode , Rt2dShapeCreate , Rt2dShapeUnLock
Rt2dObject* Rt2dShapeRender Rt2dObject   shape
 

Rt2dShapeRender renders a 2d shape. Shapes can be rendered individually. If a shape is part of a scene, the Rt2dSceneRender renders all visible objects.

Parameters:
shape  Pointer to the shape object to render
Returns:
Returns shape object if successful, NULL otherwise
See also:
Rt2dShapeCreate , Rt2dSceneRender
RwUInt32 Rt2dShapeStreamGetSize Rt2dObject   shape
 

Rt2dShapeStreamGetSize is used to determine the size in bytes of the binary representation of the given shape. This value 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:
shape  Pointer to the shape object.
Returns:
Returns a RwUInt32 value equal to the chunk size (in bytes) of the shape, NULL otherwise.
See also:
Rt2dShapeStreamRead , Rt2dShapeStreamWrite
Rt2dObject* Rt2dShapeStreamRead RwStream   stream
 

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

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

   RwStream   *stream;
   Rt2dObject *newShape;
  
   stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "mybinary.xxx");
   if( stream )
   {
       if( RwStreamFindChunk(stream, rwID_2DSHAPE, NULL, NULL) )
       {
           newShape = Rt2dShapeStreamRead(stream);
       }
  
       RwStreamClose(stream, NULL);
   }
Parameters:
stream  Pointer to the stream
Returns:
Returns a pointer to the shape if successful, NULL otherwise.
See also:
Rt2dShapeStreamWrite , Rt2dShapeStreamGetSize , RwStreamOpen , RwStreamClose , RwStreamFindChunk
Rt2dObject* Rt2dShapeStreamWrite Rt2dObject   shape,
RwStream   stream
 

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

Parameters:
shape  Pointer to the shape to stream.
stream  Pointer to the stream.
Returns:
Returns a pointer to the shape if successful, NULL otherwise.
See also:
Rt2dShapeStreamRead , Rt2dShapeStreamGetSize , RwStreamOpen , RwStreamClose
Rt2dObject* Rt2dShapeUnlock Rt2dObject   shape
 

Rt2dShapeUnlock unlocks a shape. An unlocked shape may be streamed and rendered. The shape is triangulated at this point. Any curves within the shape are flatten for triangulation using the current flattening criteria.

Parameters:
shape  Pointer to the shape
Returns:
Returns a pointer to the shape if successful, NULL otherwise.
See also:
Rt2dShapeAddNode , Rt2dShapeCreate , Rt2dShapeLock

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