Create a new surface from existing memory
#include <gf/gf.h> int gf_surface_attach( gf_surface_t* psurface, gf_dev_t gdev, int w, int h, int stride, gf_format_t format, const gf_palette_t* palette, uint8_t* ptr, unsigned flags );
gf
This function creates a new surface and attaches it to an existing area of memory. This wraps your own area of memory (or preexisting frame data, such as a previously loaded image) in a format that can be manipulated by the GF API as a regular surface (with some restrictions).
Because the driver knows nothing about the nature of the memory or how it was allocated, the hardware renderer can't target attached surfaces directly. Any rendering or blitting to or from the surface is done in software.
For the same reason, the application is responsible for deallocating the memory containing the frame data. This should be done only after all attached surfaces are done with the memory (that is, after all attached surfaces have been deallocated with gf_surface_free()).
Memory can't be shared because io-display doesn't manage it. Therefore, other processes aren't able to access attached surfaces via gf_surface_attach_by_sid().
QNX Graphics Framework
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | Yes |
gf_palette_t, gf_surface_create(), gf_surface_create_layer(), gf_surface_free(), gf_surface_reattach()