next up previous contents index
Next: Shapes Up: Shape Previous: Related file (external) types   Contents   Index


Functions Summary

The following is a description of all the functions related to the Shape type. The list is in alphabetical order.

$ \bigcirc$Name


mw_change_shape - Create a Shape structure if necessary




$ \bigcirc$Summary


Shape mw_change_shape(sh)

Shape sh;




$ \bigcirc$Description


This function creates a Shape structure if sh is not already defined. The fields are initialized to 0 or NULLvalue. The function returns the address of the structure, or NULL if not enough memory is available.




$ \bigcirc$Example

Shape sh=NULL;

/*
  Define the structure
*/
sh = mw_change_shape(sh);
if (!sh) mwerror(FATAL,1,"Not enough memory to define the shape !\n");

/* 
  At that time, the shape is empty.
*/

$ \bigcirc$Name


mw_delete_shape - Free the memory allocated for a Shape structure




$ \bigcirc$Summary


void mw_delete_shape(sh)

Shape sh;




$ \bigcirc$Description


This function deletes the pixels array, the boundary Flist, the data array (if needed), and the structure itself.




$ \bigcirc$Example

Shape sh;

/*
  Define the structure
*/
sh = mw_new_shape();
if (!sh) mwerror(FATAL,1,"Not enough memory to define the shape !\n");

/*
    ...(computation of the shape)...
*/

/* 
  Free the shape, including data field. 
*/
mw_delete_shape(sh);

$ \bigcirc$Name


mw_get_first_child_shape - Return the first child of a shape in the tree




$ \bigcirc$Summary


Shape mw_get_first_child_shape(sh)

Shape sh;




$ \bigcirc$Description


This function returns the first child of the shape sh, skipping removed shapes (field removed). This is equivalent to sh->child if this shape is not removed.

$ \bigcirc$Name


mw_get_next_sibling_shape - Return the next sibling of a shape in the tree




$ \bigcirc$Summary


Shape mw_get_next_sibling_shape(sh)

Shape sh;




$ \bigcirc$Description


This function returns the next sibling (shape sharing the same parent) of the shape sh, skipping removed shapes (field removed). This is equivalent to sh->next_sibling if this shape is not removed.

$ \bigcirc$Name


mw_get_not_removed_shape - Return the first shape not removed in subtree




$ \bigcirc$Summary


Shape mw_get_not_removed_shape(sh)

Shape sh;




$ \bigcirc$Description


This function returns sh if this shape is not removed (field removed), else it is equivalent to mw_get_first_child(sh) that is, it returns the first child, skipping removed shapes.

$ \bigcirc$Name


mw_get_parent_shape - Return the parent of the shape in the tree




$ \bigcirc$Summary


Shape mw_get_parent_shape(sh)

Shape sh;




$ \bigcirc$Description


This function returns the parent of the shape sh, skipping removed shapes (field removed). This is equivalent to sh->parent if this shape is not removed.

$ \bigcirc$Name


mw_get_smallest_shape - Return the smallest shape containing a given pixel




$ \bigcirc$Summary


Shape mw_get_smallest_shape(shs,x,y)

Shapes shs; int x,y;




$ \bigcirc$Description


This function returns the smallest shape containing the pixel at position (x, y), ignoring removed shapes (field removed). This is equivalent to shs->smallest_shape[y*shs->ncol+x] provided this shape is not removed.

$ \bigcirc$Name


mw_new_shape - Create a Shape structure




$ \bigcirc$Summary


Shape mw_new_shape()




$ \bigcirc$Description


This function creates a new Shape structure. The fields are initialized to 0 or NULLvalue. The function returns the address of the new structure, or NULL if not enough memory is available.




$ \bigcirc$Example

Shape sh;

/*
  Define the structure
*/
sh = mw_new_shape();
if (!sh) mwerror(FATAL,1,"Not enough memory to define the shape !\n");

/* 
  At that time, the shape is empty.
*/


next up previous contents index
Next: Shapes Up: Shape Previous: Related file (external) types   Contents   Index
mw 2004-05-05