ggiGAAdd

Name

ggiGAAdd, ggiGAAddMode -- Add a resource given properties to a LibGAlloc request list

Synopsis

#include <ggi/galloc.h>

int ggiGAAdd(ggiGA_resource_list *list, struct ggiGA_ResourceProperties *props, enum ggiGA_resource_type t, ggiGA_resource_handle *handle);

intggiGAAddMode(ggi_visual_tvis, ggiGA_resource_list *list, struct ggiGA_ResourceProperties *props, ggi_mode *mode, ggi_directbuffer *db, ggiGA_resource_handle *handle);

Description

ggiGAAdd places a resource of type t with a copy of the properties pointed to by *props at the end of a request list. If not NULL, the parameter res contains a handle to the resource in the request list, for use retreiving information from it later.

Usually instead of ggiGAAdd, extensions will provide their own function to add a request for the type of objects that they manage.

ggiGAAddMode places a resource of type GA_RT_FRAME with a copy of the ggi_mode pointed to by *mode at the end of a request list. If not NULL, the paramter res is set to a handle to the framebuffer resource in the request list, for use retreiving information from it later.

An optional ggi_directbuffer may be supplied to ggiAddMode via the pointer db. If db is not NULL, the contents of that structure will also be copied into the resource. Doing so constitutes the initiation of advanced mode layout negotiation, so don't do that unless you really want to negotiate mode layout. (Note: LibGAlloc currently does not allow use of the GGI "extended" pixelformat, which noone seems to be using anyway.)

Return value

Returns GALLOC_OK (== 0) on success, or an error code if the addition fails or the supplied parameters are invalid.

Examples

Example 1. ggiGAAdd/ggiGAAddMode Example


        ggi_visual_t vis;
	ggiGA_resource_list request, result;
	ggiGA_ResourceProperties props;
	ggi_mode mode;
	ggiGA_resource_handle res;
        ggiInit();
        vis = ggiOpen(NULL);
        ggiGAAttach(vis);

	ggiCheckMode(vis, 640, 480, 640, 480, &mode);

	props.size.area.x     = 320;
	props.size.area.y     = 200;
	props.sub.tank.graphtype  = GT_AUTO;

	ggiGAAdd(&request, &props, GA_RT_SPRITE_SPRITE, &res);
	ggiGAAddMode(vis, &request, mode, NULL, NULL);

	if (ggiGACheck(vis, request, &result)) {
   	      print("Check failed\n");
	      autopsy(result);
	}
	else if (ggiGASet(vis, request, &result)) {
   	      print("Unexpected failure to Set\n");
	      autopsy(result);
        }
	ggiGADetach(vis);
	ggiGAExit();
	ggiExit();