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


Functions Summary

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

$ \bigcirc$Name


mw_change_ccmovie - Define the movie structure, if not defined




$ \bigcirc$Summary


Ccmovie mw_change_ccmovie(movie)

Ccmovie movie;




$ \bigcirc$Description


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

The function mw_change_ccmovie 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

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

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

$ \bigcirc$Name


mw_delete_ccmovie - Deallocate all the movie




$ \bigcirc$Summary


void mw_delete_ccmovie(movie)

Ccmovie movie;




$ \bigcirc$Description


This function deallocates all the memory used by a Ccmovie structure: it deallocates the color planes 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_ccmovie function: when a memory allocation fails for mw_change_ccimage, all the previously memory allocations are freed by the call to mw_delete_ccmovie(movie).

$ \bigcirc$Name


mw_new_ccmovie - Create a new Ccmovie




$ \bigcirc$Summary


Ccmovie mw_new_ccmovie();




$ \bigcirc$Description


This function creates a new Ccmovie 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) */

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

movie = mw_new_ccmovie();
if (movie == NULL) mwerror(FATAL,1,"Not enough memory.\n");
for (l=1;l<=10;l++)
 {
   if ((image = mw_change_ccimage(NULL,100,100)) == NULL)
    {
      mw_delete_ccmovie(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: Float movies Up: Color Char movies Previous: Related file (external) types   Contents   Index
mw 2004-05-05