Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

Rt2dPath
[Rt2d]


Functions

Rt2dPath Rt2dPathFill (Rt2dPath *path, Rt2dBrush *brush)
Rt2dPath Rt2dPathEmpty (Rt2dPath *path)
Rt2dPath Rt2dPathCopy (Rt2dPath *dst, const Rt2dPath *src)
Rt2dPath Rt2dPathMoveto (Rt2dPath *path, RwReal x, RwReal y)
Rt2dPath Rt2dPathLineto (Rt2dPath *path, RwReal x, RwReal y)
Rt2dPath Rt2dPathRLineto (Rt2dPath *path, RwReal x, RwReal y)
Rt2dPath Rt2dPathCurveto (Rt2dPath *path, RwReal x1, RwReal y1, RwReal x2, RwReal y2, RwReal x3, RwReal y3)
Rt2dPath Rt2dPathRCurveto (Rt2dPath *path, RwReal x1, RwReal y1, RwReal x2, RwReal y2, RwReal x3, RwReal y3)
Rt2dPath Rt2dPathClose (Rt2dPath *path)
Rt2dPath Rt2dPathRect (Rt2dPath *path, RwReal x, RwReal y, RwReal w, RwReal h)
Rt2dPath Rt2dPathRoundRect (Rt2dPath *path, RwReal x, RwReal y, RwReal w, RwReal h, RwReal radius)
Rt2dPath Rt2dPathOval (Rt2dPath *path, RwReal x, RwReal y, RwReal w, RwReal h)
const Rt2dPath Rt2dPathGetBBox (const Rt2dPath *path, Rt2dBBox *bbox)
Rt2dPath Rt2dPathInset (Rt2dPath *path, RwReal inset)
Rt2dPath Rt2dPathFlatten (Rt2dPath *path)
RwBool  Rt2dPathDestroy (Rt2dPath *path)
Rt2dPath Rt2dPathCreate (void)
Rt2dPath Rt2dPathLock (Rt2dPath *path)
Rt2dPath Rt2dPathUnlock (Rt2dPath *path)
RwUInt32  Rt2dPathStreamGetSize (Rt2dPath *path)
Rt2dPath Rt2dPathStreamWrite (Rt2dPath *path, RwStream *stream)
Rt2dPath Rt2dPathStreamRead (RwStream *stream)
Rt2dPath Rt2dPathCreateMorphResultPath (Rt2dPath *path)
Rt2dPath Rt2dPathMorph (Rt2dPath *result, Rt2dPath *source, Rt2dPath *destination, RwReal alpha)
Rt2dPath Rt2dPathStroke (Rt2dPath *path, Rt2dBrush *brush)

Detailed Description

Path functions

Rt2dPath Overview

This overview explains the basics about creating, rendering and destroying paths. Refer to the API reference for more path functions. The User Guide chapter Using the 2D Toolkit explains the Rt2d toolkit in more detail.

Creating a Path
To create a path follow these steps:
  1. Rt2dPathCreate is used to create a new path.
  2. Rt2dPathLock locks the path.
  3. Use one or more of the following functions to create the lines required:
  1. Rt2dPathUnlock unlocks the path.
Creating Rectangles and Ovals
To create rectangles or ovals follow these steps:
  1. Rt2dPathLock locks the path.
  2. Create the required object using:
  1. Rt2dPathUnlock unlocks the path.
Rendering a Path
Destroying a Path

Function Documentation

Rt2dPath* Rt2dPathClose Rt2dPath   path
 

Rt2dPathClose is used to add a line segment to the specified path that joins the current point with the first point defined for this path. This operation thus forces the path to define a closed 2D region.

The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
path  Pointer to the path.
Returns:
a pointer to the path if successful or NULL if there is an error.
See also:
Rt2dPathMoveto , Rt2dPathLineto , Rt2dPathCurveto , Rt2dPathRLineto , Rt2dPathRCurveto , Rt2dPathCreate , Rt2dPathDestroy , Rt2dPathEmpty
Rt2dPath* Rt2dPathCopy Rt2dPath   dst,
const Rt2dPath   src
 

Rt2dPathCopy is used to duplicate the definition of the source path and store the result in the destination path. Note that the destination path is emptied before the copy is performed, therefore, the source and destination path arguments must not point to the same path. The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
dst  Pointer to the path that will receive the copy.
src  Pointer to the path that is to be copied.
Returns:
a pointer to the destination path if successful or NULL if there is an error.
See also:
Rt2dPathCreate , Rt2dPathDestroy
Rt2dPath* Rt2dPathCreate void   
 

Rt2dPathCreate is used to create a new path. The path is initially empty and locked but may be constructed using any combination of the available primitive line drawing procedures. A path may be closed or open, connected or disjoint (that is, have multiple boundaries), depending on how it has been constructed. The path should be unlocked after editing and before rendering it.

Note that the current point for a newly created path is undefined. To establish an initial current point use the function Rt2dPathMoveto.

The include file rt2d.h and the library file rt2d.lib are required to use this function.

Returns:
a pointer to the new path if successful or NULL if there is an error.
See also:
Rt2dPathDestroy , Rt2dPathMoveto , Rt2dPathLineto , Rt2dPathCurveto , Rt2dPathRLineto , Rt2dPathRCurveto , Rt2dPathRect , Rt2dPathRoundRect , Rt2dPathOval , Rt2dPathLock , Rt2dPathUnlock
Rt2dPath* Rt2dPathCreateMorphResultPath Rt2dPath   path
 

Rt2dPathCreateMorphResultPath is used to create a result path for a morphing operation. The created path will be used as a result for morph animation, allowing to apply geometrics modification of the path without the need to keep it locked

Parameters:
path  Pointer to source path
Returns:
Returns pointer to the created path if successful or NULL if there is an error.
See also:
Rt2dPathMorph , Rt2dPathLock , Rt2dPathUnlock
Rt2dPath* Rt2dPathCurveto Rt2dPath   path,
RwReal    x1,
RwReal    y1,
RwReal    x2,
RwReal    y2,
RwReal    x3,
RwReal    y3
 

Rt2dPathCurveto is used to add a curved line segment to the specified path. The curve is defined by the four control points of a cubic Bezier whose positions are given by the current point and the points passed to this function (in that order). After this function has executed, the current point is equal to the last position specified here.

Note that positions are defined in absolute coordinates. Use the function Rt2dPathRCurveto to specify coordinates relative to the current point.

Also note that the positions are subject to the current transformation matrix (CTM).

The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
path  Pointer to the path.
x1  A RwReal value equal to the x-coordinate of the second control
y1  A RwReal value equal to the y-coordinate of the second control
x2  A RwReal value equal to the x-coordinate of the third control
y2  A RwReal value equal to the y-coordinate of the third control
x3  A RwReal value equal to the x-coordinate of the fourth control
y3  A RwReal value equal to the y-coordinate of the fourth control
Returns:
a pointer to the path if successful or NULL if there is an error.
See also:
Rt2dPathRCurveto , Rt2dPathLineto , Rt2dPathRLineto , Rt2dPathMoveto
RwBool Rt2dPathDestroy Rt2dPath   path
 

Rt2dPathDestroy is used to destroy the specified path. All paths 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:
path  Pointer to the path.
Returns:
TRUE if successful or FALSE if there is an error
See also:
Rt2dPathCreate , Rt2dOpen , Rt2dClose
Rt2dPath* Rt2dPathEmpty Rt2dPath   path
 

Rt2dPathEmpty is used to delete all data describing the specified path without actually destroying it. This leaves the path empty and ready for a new path description to be constructed. The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
path  Pointer to the path.
Returns:
a pointer to the path if successful or NULL if there is an error.
See also:
Rt2dPathCreate , Rt2dPathDestroy
Rt2dPath* Rt2dPathFill Rt2dPath   path,
Rt2dBrush   brush
 

Rt2dPathFill is used to fill the specified path using the colors and texture coordinates of the given brush. The path must be closed for this function to work properly. The fill color for each point within the path is determined by bilinear interpolation of the colors of the brush assuming they represent the colors of the four corners of the path's bounding-box. Hence, the fill color depends on the relative distance of each interior point from the corner points of the path's bounding-box. If the brush also specifies texture coordinates and a texture image, the path is filled with the image assuming that the bounding-box corners have the texture coordinates of the brush. The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
path  Pointer to the path.
brush  Pointer to the brush.
Returns:
a pointer to the path if successful or NULL if there is an error.
See also:
Rt2dBrushSetRGBA , Rt2dBrushSetUV , Rt2dBrushSetTexture , Rt2dPathStroke
Rt2dPath* Rt2dPathFlatten Rt2dPath   path
 

Rt2dPathFlatten is used to convert the specified path to use only straight line segments. For the curved portions of the path, the degree of flattening may be controlled with a factor specified using the function Rt2dDeviceSetFlat, which has a default value of 0.5. This factor specifies the maximum pixel error that is tolerated as the curves are tessellated.

The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
path  Pointer to the path.
Returns:
a pointer to the path if successful or NULL if there is an error.
See also:
Rt2dDeviceSetFlat
const Rt2dPath* Rt2dPathGetBBox const Rt2dPath   path,
Rt2dBBox   bbox
 

Rt2dPathGetBBox is used to determine the parameters of an axis-aligned bounding-box that completely encloses the specified path. The box determined by this function is the box before the CTM has transformed the path.

The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
path  Pointer to the path.
bbox  Pointer to a Rt2dBBox value that will receive the path's box.
Returns:
a pointer to the path if successful or NULL if there is an error.
See also:
Rt2dVisible
Rt2dPath* Rt2dPathInset Rt2dPath   path,
RwReal    inset
 

Rt2dPathInset is used to scale the specified path such that the new path is parallel to the original at every point. The perpendicular distance between the new and old paths is given by the inset; positive values result in a new path contained inside the original and vice versa.

The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
path  Pointer to the path.
inset  A RwReal value equal to the inset distance.
Returns:
a pointer to the path if successful or NULL if there is an error.
Rt2dPath* Rt2dPathLineto Rt2dPath   path,
RwReal    x,
RwReal    y
 

Rt2dPathLineto is used to add a straight line segment to the specified path that extends from the current point to a point with the given coordinates. After this function has executed the current point is equal to the point with the specified position. Note that positions are defined in absolute coordinates. Use the function Rt2dPathRLineto to specify coordinates relative to the current point.

Also note that the positions are subject to the current transformation matrix (CTM). The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
path  Pointer to the path.
x  A RwReal value equal to the x-coordinate of the line's end-point
y  A RwReal value equal to the y-coordinate of the line's end-point
Returns:
a pointer to the path if successful or NULL if there is an error.
See also:
Rt2dPathRLineto , Rt2dPathCurveto , Rt2dPathRCurveto , Rt2dPathMoveto
Rt2dPath* Rt2dPathLock Rt2dPath   path
 

Rt2dPathLock is used to lock a new path. This should be done before any modification append to the path.

The include file rt2d.h and the library file rt2d.lib are required to use this function.

Returns:
a pointer to the new path if successful or NULL if there is an error.
See also:
Rt2dPathCreate , Rt2dPathUnlock , Rt2dPathMoveto , Rt2dPathLineto , Rt2dPathCurveto , Rt2dPathRLineto , Rt2dPathRCurveto , Rt2dPathRect , Rt2dPathRoundRect , Rt2dPathOval
Rt2dPath* Rt2dPathMorph Rt2dPath   result,
Rt2dPath   source,
Rt2dPath   destination,
RwReal    alpha
 

Rt2dPathMorph is used to apply a morphing animation to two path. the result of this operation will be stored in a result path, created using Rt2dPathCreateMorphResultPath. An alpha value, indicating the degree of morphing between the source and the destination path should be provided.

  • if Alpha = 0, the result path will be equal to the source path
  • if Alpha = 1, the result path will be equal to the destination path
Parameters:
result  Pointer to the result path
source  Pointer to the source path
destination  Pointer to the destination path
alpha  an RwReal value indicating the degree of morphing
Returns:
Returns pointer to the result path if successful or NULL if there is an error.
See also:
Rt2dPathCreateMorphResultPath
Rt2dPath* Rt2dPathMoveto Rt2dPath   path,
RwReal    x,
RwReal    y
 

Rt2dPathMoveto is used to define the current point for the specified path using the given coordinates. Note that positions are defined in absolute coordinates and are subject to the current transformation matrix (CTM). The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
path  Pointer to the path.
x  A RwReal value equal to the x-coordinate of the point.
y  A RwReal value equal to the y-coordinate of the point.
Returns:
a pointer to the path if successful or NULL if there is an error.
See also:
Rt2dPathLineto , Rt2dPathCurveto , Rt2dPathRLineto , Rt2dPathRCurveto
Rt2dPath* Rt2dPathOval Rt2dPath   path,
RwReal    x,
RwReal    y,
RwReal    w,
RwReal    h
 

Rt2dPathOval is used to add an outline oval to the specified path that has the given position, width and height.

Note that positions are defined in absolute coordinates and are subject to the current transformation matrix (CTM).

The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
path  Pointer to the path.
x  A RwReal value equal to the x-coordinate of the lower-left corner the oval.
y  A RwReal value equal to the y-coordinate of the lower-left corner the oval.
w  A RwReal value equal to the width of the oval.
h  A RwReal value equal to the height of the oval.
Returns:
a pointer to the path if successful or NULL if there is an error.
See also:
Rt2dPathRect , Rt2dPathRoundRect
Rt2dPath* Rt2dPathRCurveto Rt2dPath   path,
RwReal    x1,
RwReal    y1,
RwReal    x2,
RwReal    y2,
RwReal    x3,
RwReal    y3
 

Rt2dPathRCurveto is used to add a curved line segment to the specified path. The curve is defined by the four control points of a cubic Bezier whose positions are given by the current point and the points passed to this function (in that order). After this function has executed, the current point is equal to the last position specified here.

Note that positions are defined using coordinates relative to the currrent point. Use the function Rt2dPathCurveto to specify absolute coordinates.

Also note that the positions are subject to the current transformation matrix (CTM).

The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
path  Pointer to the path.
x1  A RwReal value equal to the x-coordinate of the second control
y1  A RwReal value equal to the y-coordinate of the second control
x2  A RwReal value equal to the x-coordinate of the third control
y2  A RwReal value equal to the y-coordinate of the third control
x3  A RwReal value equal to the x-coordinate of the fourth control
y3  A RwReal value equal to the y-coordinate of the fourth control
Returns:
a pointer to the path if successful or NULL if there is an error.
See also:
Rt2dPathCurveto , Rt2dPathRLineto , Rt2dPathLineto , Rt2dPathMoveto
Rt2dPath* Rt2dPathRect Rt2dPath   path,
RwReal    x,
RwReal    y,
RwReal    w,
RwReal    h
 

Rt2dPathRect is used to add an outline rectangle to the specified path that has the given position, width and height.

Note that positions are defined in absolute coordinates and are subject to the current transformation matrix (CTM).

The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
path  Pointer to the path.
x  A RwReal value equal to the x-coordinate of the lower-left corner the rectangle.
y  A RwReal value equal to the y-coordinate of the lower-left corner the rectangle.
w  A RwReal value equal to the width of the rectangle.
h  A RwReal value equal to the height of the rectangle.
Returns:
a pointer to the path if successful or NULL if there is an error.
See also:
Rt2dPathRoundRect , Rt2dPathOval
Rt2dPath* Rt2dPathRLineto Rt2dPath   path,
RwReal    x,
RwReal    y
 

Rt2dPathRLineto is used to add a straight line segment to the specified path that extends from the current point to a point with the given coordinates. After this function has executed the current point is equal to the point with the specified position. Note that positions are defined using coordinates relative to the currrent point. Use the function Rt2dPathLineto to specify absolute coordinates.

Also note that the positions are subject to the current transformation matrix (CTM). The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
path  Pointer to the path.
x  A RwReal value equal to the x-coordinate of the line's end-point.
y  A RwReal value equal to the y-coordinate of the line's end-point.
Returns:
a pointer to the path if successful or NULL if there is an error.
See also:
Rt2dPathLineto , Rt2dPathRCurveto , Rt2dPathCurveto , Rt2dPathMoveto
Rt2dPath* Rt2dPathRoundRect Rt2dPath   path,
RwReal    x,
RwReal    y,
RwReal    w,
RwReal    h,
RwReal    radius
 

Rt2dPathRoundRect is used to add an outline rectangle with rounded corners to the specified path that has the given position, width, height and radius of curvature of the corners. The radius must be greater than zero.

Note that positions are defined in absolute coordinates and are subject to the current transformation matrix (CTM).

The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
path  Pointer to the path.
x  A RwReal value equal to the x-coordinate of the lower-left corner the rectangle.
y  A RwReal value equal to the y-coordinate of the lower-left corner the rectangle.
w  A RwReal value equal to the width of the rectangle.
h  A RwReal value equal to the height of the rectangle.
radius  A RwReal value equal to the radius of the corners.
Returns:
a pointer to the path if successful or NULL if there is an error.
See also:
Rt2dPathRect , Rt2dPathOval
RwUInt32 Rt2dPathStreamGetSize Rt2dPath   path
 

Rt2dPathStreamGetSize is used to determine the size in bytes of the binary representation of the given path. 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:
path  Pointer to the path.
Returns:
Returns a RwUInt32 value equal to the chunk size (in bytes) of the path or zero if there is an error.
See also:
Rt2dPathStreamRead , Rt2dPathStreamWrite
Rt2dPath* Rt2dPathStreamRead RwStream   stream
 

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

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

   RwStream *stream;
   Rt2dPath *newPath;
  
   stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "mybinary.xxx");
   if( stream )
   {
       if( RwStreamFindChunk(stream, rwID_2DPATH, NULL, NULL) )
       {
           newPath = Rt2dPathStreamRead(stream);
       }
  
       RwStreamClose(stream, NULL);
   }
Parameters:
stream  Pointer to the stream.
Returns:
Returns pointer to the path if successful or NULL if there is an error.
See also:
Rt2dPathStreamWrite , Rt2dPathStreamGetSize , RwStreamOpen , RwStreamClose
Rt2dPath* Rt2dPathStreamWrite Rt2dPath   path,
RwStream   stream
 

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

Parameters:
path  Pointer to the path.
stream  Pointer to the stream.
Returns:
Returns pointer to the path if successful or NULL if there is an error.
See also:
Rt2dPathStreamRead , Rt2dPathStreamGetSize , RwStreamOpen , RwStreamClose
Rt2dPath* Rt2dPathStroke Rt2dPath   path,
Rt2dBrush   brush
 

Rt2dPathStroke is used to paint the specified path using the given brush. The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
path  Pointer to the path.
brush  Pointer to the brush.
Returns:
a pointer to the path if successful or NULL if there is an error.
See also:
Rt2dBrushSetRGBA , Rt2dBrushSetUV , Rt2dBrushSetTexture , Rt2dBrushSetWidth
Rt2dPath* Rt2dPathUnlock Rt2dPath   path
 

Rt2dPathUnlock is used to unlock a previously locked path. This should be done after any modification append to the path, not doing so can highly degrade performences.

The include file rt2d.h and the library file rt2d.lib are required to use this function.

Parameters:
path  Pointer to the path.
Returns:
a pointer to the new path if successful or NULL if there is an error.
See also:
Rt2dPathCreate , Rt2dPathLock , Rt2dPathMoveto , Rt2dPathLineto , Rt2dPathCurveto , Rt2dPathRLineto , Rt2dPathRCurveto , Rt2dPathRect , Rt2dPathRoundRect , Rt2dPathOval

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