
25.10.0.3 The image package declaration
The package is initialized in the following way:
Xv_pkg image_pkg = {
"Image", /* package name */
ATTR_PKG_IMAGE, /* package ID */
sizeof(Image_public), /* size of the public struct */
SERVER_IMAGE, /* subclassed from the server image */
image_init,
image_set,
image_get,
image_destroy,
image_find
};
25.10.1 The Image Initialize Method
The task of the initialize routine for the image class is primarily to initialize the private data
of the image object and to create and/or add to the linked list of the private data types. The
routine is defined as follows:
image_init(owner, image_public, avlist)
Xv_Screen owner;
Image_public *image_public;
Attr_avlist avlist; /* ignored here */
{
Attr_attribute *attrs;
Image_private *image_private = xv_alloc(Image_private);
Image_private *list; /* linked list of image instances */
Xv_Screen screen = owner? owner : xv_default_screen;
if (!image_private || !screen)
return XV_ERROR;
/* link the public to the private and vice-versa */
image_public->private_data = (Xv_opaque)image_private;
image_private->public_self = (Xv_opaque)image_public;
for (attrs = avlist; *attrs; attrs = attr_next(attrs))
if (attrs[0] == SERVER_IMAGE_BITMAP_FILE)
/* you might also want to check that image_private->filename is NULL*/
image_private->filename =
strcpy(malloc(strlen(attrs[1 ])+1), attrs[1 ]);
image_private->next = (Image_private *)NULL;
image_private->screen