pSave->iDEFIobjectid        = pData->iDEFIobjectid; pSave->iDEFIdonotshow       = pData->iDEFIdonotshow; pSave->iDEFIconcrete        = pData->iDEFIconcrete; pSave->bDEFIhasloca         = pData->bDEFIhasloca; pSave->iDEFIlocax           = pData->iDEFIlocax; pSave->iDEFIlocay           = pData->iDEFIlocay; pSave->bDEFIhasclip         = pData->bDEFIhasclip; pSave->iDEFIclipl           = pData->iDEFIclipl; pSave->iDEFIclipr           = pData->iDEFIclipr; pSave->iDEFIclipt           = pData->iDEFIclipt; pSave->iDEFIclipb           = pData->iDEFIclipb;
mng_retcode save_state (mng_datap pData){  mng_savedatap pSave;  mng_imagep    pImage;#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_SAVE_STATE, MNG_LC_START)#endif  if (pData->pSavedata)                /* sanity check */    MNG_ERROR (pData, MNG_INTERNALERROR)                                       /* get a buffer for saving */  MNG_ALLOC (pData, pData->pSavedata, sizeof (mng_savedata))  pSave = pData->pSavedata;            /* address it more directly */                                       /* and copy global data from the main struct */#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)  pSave->bHasglobalPLTE       = pData->bHasglobalPLTE;  pSave->bHasglobalTRNS       = pData->bHasglobalTRNS;  pSave->bHasglobalGAMA       = pData->bHasglobalGAMA;  pSave->bHasglobalCHRM       = pData->bHasglobalCHRM;  pSave->bHasglobalSRGB       = pData->bHasglobalSRGB;  pSave->bHasglobalICCP       = pData->bHasglobalICCP;  pSave->bHasglobalBKGD       = pData->bHasglobalBKGD;#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */  pSave->iDEFIobjectid        = pData->iDEFIobjectid;  pSave->iDEFIdonotshow       = pData->iDEFIdonotshow;  pSave->iDEFIconcrete        = pData->iDEFIconcrete;  pSave->bDEFIhasloca         = pData->bDEFIhasloca;  pSave->iDEFIlocax           = pData->iDEFIlocax;  pSave->iDEFIlocay           = pData->iDEFIlocay;  pSave->bDEFIhasclip         = pData->bDEFIhasclip;  pSave->iDEFIclipl           = pData->iDEFIclipl;  pSave->iDEFIclipr           = pData->iDEFIclipr;  pSave->iDEFIclipt           = pData->iDEFIclipt;  pSave->iDEFIclipb           = pData->iDEFIclipb;  pSave->iBACKred             = pData->iBACKred;  pSave->iBACKgreen           = pData->iBACKgreen;  pSave->iBACKblue            = pData->iBACKblue;  pSave->iBACKmandatory       = pData->iBACKmandatory;  pSave->iBACKimageid         = pData->iBACKimageid;  pSave->iBACKtile            = pData->iBACKtile;  pSave->iFRAMmode            = pData->iFRAMmode;  pSave->iFRAMdelay           = pData->iFRAMdelay;  pSave->iFRAMtimeout         = pData->iFRAMtimeout;  pSave->bFRAMclipping        = pData->bFRAMclipping;  pSave->iFRAMclipl           = pData->iFRAMclipl;  pSave->iFRAMclipr           = pData->iFRAMclipr;  pSave->iFRAMclipt           = pData->iFRAMclipt;  pSave->iFRAMclipb           = pData->iFRAMclipb;  pSave->iGlobalPLTEcount     = pData->iGlobalPLTEcount;  MNG_COPY (pSave->aGlobalPLTEentries, pData->aGlobalPLTEentries, sizeof (mng_rgbpaltab))  pSave->iGlobalTRNSrawlen    = pData->iGlobalTRNSrawlen;  MNG_COPY (pSave->aGlobalTRNSrawdata, pData->aGlobalTRNSrawdata, 256)  pSave->iGlobalGamma         = pData->iGlobalGamma;  pSave->iGlobalWhitepointx   = pData->iGlobalWhitepointx;  pSave->iGlobalWhitepointy   = pData->iGlobalWhitepointy;  pSave->iGlobalPrimaryredx   = pData->iGlobalPrimaryredx;  pSave->iGlobalPrimaryredy   = pData->iGlobalPrimaryredy;  pSave->iGlobalPrimarygreenx = pData->iGlobalPrimarygreenx;  pSave->iGlobalPrimarygreeny = pData->iGlobalPrimarygreeny;  pSave->iGlobalPrimarybluex  = pData->iGlobalPrimarybluex;  pSave->iGlobalPrimarybluey  = pData->iGlobalPrimarybluey;  pSave->iGlobalRendintent    = pData->iGlobalRendintent;  pSave->iGlobalProfilesize   = pData->iGlobalProfilesize;  if (pSave->iGlobalProfilesize)       /* has a profile ? */  {                                    /* then copy that ! */    MNG_ALLOC (pData, pSave->pGlobalProfile, pSave->iGlobalProfilesize)    MNG_COPY (pSave->pGlobalProfile, pData->pGlobalProfile, pSave->iGlobalProfilesize)  }  pSave->iGlobalBKGDred       = pData->iGlobalBKGDred;  pSave->iGlobalBKGDgreen     = pData->iGlobalBKGDgreen;  pSave->iGlobalBKGDblue      = pData->iGlobalBKGDblue;                                       /* freeze current image objects */  pImage = (mng_imagep)pData->pFirstimgobj;  while (pImage)  {                                    /* freeze the object AND it's buffer */    pImage->bFrozen          = MNG_TRUE;    pImage->pImgbuf->bFrozen = MNG_TRUE;                                       /* neeeext */    pImage = (mng_imagep)pImage->sHeader.pNext;  }#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_SAVE_STATE, MNG_LC_END)#endif  return MNG_NOERROR;}