Image Lists


  typedef struct ImageList  ImageList;

  struct ImageList {
    int             num_images;         /* list of images */
    Image **        images;


  ImageList * new_image_list(void);
  void  del_image_list(ImageList *imglist);
  void  append_to_image_list(ImageList *imglist, Image *img);


An ImageList is simply a dynamically allocated array of image. It grows as Images are appended to it.

The new_image_list function allocates memory for an empty image list. The function returns NULL if there is insufficient memory to create the structure.

The del_image_list function is used to deallocate the image list structure and all the images which have been added to the list. Therefore, images should only be added to the list if they will not be deleted elsewhere.

The append_to_image_list function appends an image to the list, after first reallocating the list to be large enough.