Extract the image data from a widget
#include <Ap.h>
PhImage_t *ApGetImageRes(
ApDBase_t const *dbase,
char const *wgt_name );
ApGetImageRes() lets you extract images from a widget in a PhAB widget database.
The dbase argument is the widget database pointer returned from ApOpenDBase(). The wgt_name argument is the name of widget within the database that has the image you're trying to extract.
This function is mainly used to perform simple animation. You can create a series of tiles, using any widget that supports images, in a PhAB widget database; to create the animation, cycle through the tiles by pulling out the images in sequence, updating another widget that is visible within the application window.
A pointer to a PhImage_t structure, or NULL if the widget or image data couldn't be found.
![]() |
This function returns a pointer into the widget database;
don't close the database while still using the image.
If you must close the widget database, do the following first:
|
PhImage_t *image;
PtArg_t args[1];
mydbase = ApOpenDBase( ABM_mypicture );
image = ApGetImageRes( mydbase, "myimage" );
/* update the label widget with the new image */
if ( image ) {
PtSetArg( &args[0], Pt_ARG_LABEL_DATA,
image, sizeof( *image ) );
PtSetResources( ABW_label_wgt, 1, args );
}
Photon
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | No |
ApGetBitmapRes(), ApOpenDBase(), ApOpenDBaseFile(), PgDrawPhImagemx(), PhImage_t, PhReleaseImage(), PhMakeGhostBitmap(), PhMakeTransBitmap(), PxLoadImage()
"Animation" in the Raw Drawing and Animation chapter, and the Accessing PhAB Modules from Code chapter of the Photon Programmer's Guide