next up previous contents index
Next: Color Char movies Up: Char movies Previous: Related file (external) types   Contents   Index


Functions Summary

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

$ \bigcirc$Name


mw_change_cmovie - Define the movie structure, if not defined




$ \bigcirc$Summary


Cmovie mw_change_cmovie(movie)

Cmovie movie;




$ \bigcirc$Description


This function returns a movie structure if the input movie = NULL. It is provided despite the mw_new_cmovie function for global coherence with other memory types.

The function mw_change_cmovie returns NULL if not enough memory is available to define the structure. Your code should check this return value to send an error message in the NULL case, and do appropriate statement.

Since the MegaWave2 compiler allocates structures for input and output objects (See Volume one: ``MegaWave2 User's Guide''), this function is normally used only for internal objects. Do not forget to deallocate the internal structures before the end of the module.

Images have to be allocated using the appropriate functions (See the example below).




$ \bigcirc$Example

Cmovie movie=NULL; /* Internal use: no Input neither Output of module */

movie = mw_change_cmovie(movie);
if (movie == NULL) mwerror(FATAL,1,"Not enough memory.\n");
...
(End of this example as for the mw_new_cmovie function).

$ \bigcirc$Name


mw_delete_cmovie - Deallocate all the movie




$ \bigcirc$Summary


void mw_delete_cmovie(movie)

Cmovie movie;




$ \bigcirc$Description


This function deallocates all the memory used by a Cmovie structure: it deallocates the gray plane of all images, the image structures and the movie structure itself.

You should set movie = NULL after this call since the address pointed by movie is no longer valid.




$ \bigcirc$Example

See the example of the mw_new_cmovie function: when a memory allocation fails for mw_change_cimage, all the previously memory allocations are freed by the call to mw_delete_cmovie(movie).

$ \bigcirc$Name


mw_new_cmovie - Create a new Cmovie




$ \bigcirc$Summary


Cmovie mw_new_cmovie();




$ \bigcirc$Description


This function creates a new Cmovie structure. It returns NULL if not enough memory is available to create the structure. Your code should check this value to send an error message in the NULL case, and do appropriate statement.

Since the MegaWave2 compiler allocates structures for input and output objects (See Volume one: ``MegaWave2 User's Guide''), this function is normally used only for internal objects. Do not forget to deallocate the internal structures before the end of the module.

Images have to be allocated using the appropriate functions (See the example below).




$ \bigcirc$Example

/* Create a movie with 10 images of size (100,100) */

Cmovie movie;  /* Internal use: no Input neither Output of module */
Cimage image,image_prev; /* Internal use */

movie = mw_new_cmovie();
if (movie == NULL) mwerror(FATAL,1,"Not enough memory.\n");
for (l=1;l<=10;l++)
 {
   if ((image = mw_change_cimage(NULL,100,100)) == NULL)
    {
      mw_delete_cmovie(movie);
      mwerror(FATAL,1,"Not enough memory.");
    }
    if (l == 1) movie->first = image;
    else
      {
        image_prev->next = image;
        image->previous = image_prev;
       }
     image_prev = image;
 }


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