ggiBufAttach

Name

ggiBufAttach, ggiBufDetach -- Enable the LibBuf API on a LibGGI visual

Synopsis

#include <ggi/buf.h>

int ggiBufAttach(ggi_visual_t vis ggiGA_resource_list *reslist);

int ggiBufDetach(ggi_visual_t vis);

Description

ggiBufAttach extends the visual vis such that the LibBuf API may be used on the visual handle. This function must be called before using other LibBuf functions on the visual handle. The parameter reslist is a pointer to a LibGAlloc resource list kept by the application, and such an object must exist and be passed to ggiBltAttach in order to use the simple-form ggiBufCreate* functions.

ggiBufDetach cleans up all state associated with using the LibBuf API on the visual vis. The visual is stripped of any active buffers. Note, however, that the buffers are not themselves currently guaranteed to be destroyed and may still exist as objects, consuming resources. Behavior of these objects is at this point undefined. They should be destroyed before calling ggiBufDetach.

Return value

Both functions return 0 for OK, otherwise an error code.

Examples

Example 1. Activate LibBuf such that the ggiBufCreate* functions work


ggiGA_resource_list reslist;
reslist = NULL;
ggiBufInit();
ggiBufAttach(vis, &reslist);

/* Do some libbuf stuff */

ggiBufDetach(vis);
ggiBufExit();