⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 libmng_hlapi.c

📁 Linux下的基于X11的图形开发环境。
💻 C
📖 第 1 页 / 共 5 页
字号:
/* ************************************************************************** *//* *             For conditions of distribution and use,                    * *//* *                see copyright notice in libmng.h                        * *//* ************************************************************************** *//* *                                                                        * *//* * project   : libmng                                                     * *//* * file      : libmng_hlapi.c            copyright (c) 2000 G.Juyn        * *//* * version   : 1.0.2                                                      * *//* *                                                                        * *//* * purpose   : high-level application API (implementation)                * *//* *                                                                        * *//* * author    : G.Juyn                                                     * *//* * web       : http://www.3-t.com                                         * *//* * email     : mailto:info@3-t.com                                        * *//* *                                                                        * *//* * comment   : implementation of the high-level function interface        * *//* *             for applications.                                          * *//* *                                                                        * *//* * changes   : 0.5.1 - 05/06/2000 - G.Juyn                                * *//* *             - added init of iPLTEcount                                 * *//* *             0.5.1 - 05/08/2000 - G.Juyn                                * *//* *             - changed calling-convention definition                    * *//* *             - changed status-handling of display-routines              * *//* *             - added versioning-control routines                        * *//* *             - filled the write routine                                 * *//* *             - changed strict-ANSI stuff                                * *//* *             0.5.1 - 05/11/2000 - G.Juyn                                * *//* *             - added callback error-reporting support                   * *//* *             0.5.1 - 05/12/2000 - G.Juyn                                * *//* *             - changed trace to macro for callback error-reporting      * *//* *             0.5.1 - 05/13/2000 - G.Juyn                                * *//* *             - added eMNGma hack (will be removed in 1.0.0 !!!)         * *//* *             - added TERM animation object pointer (easier reference)   * *//* *             0.5.1 - 05/14/2000 - G.Juyn                                * *//* *             - added cleanup of saved-data (SAVE/SEEK processing)       * *//* *             0.5.1 - 05/16/2000 - G.Juyn                                * *//* *             - moved the actual write_graphic functionality from here   * *//* *               to it's appropriate function in the mng_write module     * *//* *                                                                        * *//* *             0.5.2 - 05/19/2000 - G.Juyn                                * *//* *             - cleaned up some code regarding mixed support             * *//* *             - added JNG support                                        * *//* *             0.5.2 - 05/24/2000 - G.Juyn                                * *//* *             - moved init of default zlib parms here from "mng_zlib.c"  * *//* *             - added init of default IJG parms                          * *//* *             0.5.2 - 05/29/2000 - G.Juyn                                * *//* *             - fixed inconsistancy with freeing global iCCP profile     * *//* *             0.5.2 - 05/30/2000 - G.Juyn                                * *//* *             - added delta-image field initialization                   * *//* *             0.5.2 - 06/06/2000 - G.Juyn                                * *//* *             - added initialization of the buffer-suspend parameter     * *//* *                                                                        * *//* *             0.5.3 - 06/16/2000 - G.Juyn                                * *//* *             - added initialization of update-region for refresh        * *//* *             - added initialization of Needrefresh parameter            * *//* *             0.5.3 - 06/17/2000 - G.Juyn                                * *//* *             - added initialization of Deltaimmediate                   * *//* *             0.5.3 - 06/21/2000 - G.Juyn                                * *//* *             - added initialization of Speed                            * *//* *             - added initialization of Imagelevel                       * *//* *             0.5.3 - 06/26/2000 - G.Juyn                                * *//* *             - changed userdata variable to mng_ptr                     * *//* *             0.5.3 - 06/29/2000 - G.Juyn                                * *//* *             - fixed initialization routine for new mng_handle type     * *//* *                                                                        * *//* *             0.9.1 - 07/06/2000 - G.Juyn                                * *//* *             - changed mng_display_resume to allow to be called after   * *//* *               a suspension return with MNG_NEEDMOREDATA                * *//* *             - added returncode MNG_NEEDTIMERWAIT for timer breaks      * *//* *             0.9.1 - 07/07/2000 - G.Juyn                                * *//* *             - implemented support for freeze/reset/resume & go_xxxx    * *//* *             0.9.1 - 07/08/2000 - G.Juyn                                * *//* *             - added support for improved timing                        * *//* *             - added support for improved I/O-suspension                * *//* *             0.9.1 - 07/14/2000 - G.Juyn                                * *//* *             - changed EOF processing behavior                          * *//* *             0.9.1 - 07/15/2000 - G.Juyn                                * *//* *             - added callbacks for SAVE/SEEK processing                 * *//* *             - added variable for NEEDSECTIONWAIT breaks                * *//* *             - added variable for freeze & reset processing             * *//* *             0.9.1 - 07/17/2000 - G.Juyn                                * *//* *             - added error cleanup processing                           * *//* *             - fixed support for mng_display_reset()                    * *//* *             - fixed suspension-buffering for 32K+ chunks               * *//* *                                                                        * *//* *             0.9.2 - 07/29/2000 - G.Juyn                                * *//* *             - fixed small bugs in display processing                   * *//* *             0.9.2 - 07/31/2000 - G.Juyn                                * *//* *             - fixed wrapping of suspension parameters                  * *//* *             0.9.2 - 08/04/2000 - G.Juyn                                * *//* *             - B111096 - fixed large-buffer read-suspension             * *//* *             0.9.2 - 08/05/2000 - G.Juyn                                * *//* *             - changed file-prefixes                                    * *//* *                                                                        * *//* *             0.9.3 - 09/07/2000 - G.Juyn                                * *//* *             - added support for new filter_types                       * *//* *             0.9.3 - 09/10/2000 - G.Juyn                                * *//* *             - fixed DEFI behavior                                      * *//* *             0.9.3 - 10/11/2000 - G.Juyn                                * *//* *             - added support for nEED                                   * *//* *             0.9.3 - 10/16/2000 - G.Juyn                                * *//* *             - added optional support for bKGD for PNG images           * *//* *             - raised initial maximum canvas size                       * *//* *             - added support for JDAA                                   * *//* *             0.9.3 - 10/17/2000 - G.Juyn                                * *//* *             - added callback to process non-critical unknown chunks    * *//* *             - fixed support for delta-images during read() / display() * *//* *             0.9.3 - 10/18/2000 - G.Juyn                                * *//* *             - added closestream() processing for mng_cleanup()         * *//* *             0.9.3 - 10/27/2000 - G.Juyn                                * *//* *             - fixed seperate read() & display() processing             * *//* *                                                                        * *//* *             0.9.4 - 11/20/2000 - G.Juyn                                * *//* *             - fixed unwanted repetition in mng_readdisplay()           * *//* *             0.9.4 - 11/24/2000 - G.Juyn                                * *//* *             - moved restore of object 0 to libmng_display              * *//* *                                                                        * *//* *             1.0.1 - 02/08/2001 - G.Juyn                                * *//* *             - added MEND processing callback                           * *//* *             1.0.1 - 02/13/2001 - G.Juyn                                * *//* *             - fixed first FRAM_MODE=4 timing problem                   * *//* *             1.0.1 - 04/21/2001 - G.Juyn                                * *//* *             - fixed bug with display_reset/display_resume (Thanks G!)  * *//* *             1.0.1 - 04/22/2001 - G.Juyn                                * *//* *             - fixed memory-leak (Thanks Gregg!)                        * *//* *             1.0.1 - 04/23/2001 - G.Juyn                                * *//* *             - fixed reset_rundata to drop all objects                  * *//* *             1.0.1 - 04/25/2001 - G.Juyn                                * *//* *             - moved mng_clear_cms to libmng_cms                        * *//* *                                                                        * *//* *             1.0.2 - 06/23/2001 - G.Juyn                                * *//* *             - added optimization option for MNG-video playback         * *//* *             - added processterm callback                               * *//* *             1.0.2 - 06/25/2001 - G.Juyn                                * *//* *             - added option to turn off progressive refresh             * *//* *                                                                        * *//* ************************************************************************** */#include "libmng.h"#include "libmng_data.h"#include "libmng_error.h"#include "libmng_trace.h"#ifdef __BORLANDC__#pragma hdrstop#endif#include "libmng_objects.h"#include "libmng_object_prc.h"#include "libmng_chunks.h"#include "libmng_memory.h"#include "libmng_read.h"#include "libmng_write.h"#include "libmng_display.h"#include "libmng_zlib.h"#include "libmng_jpeg.h"#include "libmng_cms.h"#include "libmng_pixels.h"#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)#pragma option -A                      /* force ANSI-C */#endif/* ************************************************************************** *//* *                                                                        * *//* * local routines                                                         * *//* *                                                                        * *//* ************************************************************************** */#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)mng_retcode mng_drop_chunks (mng_datap pData){  mng_chunkp       pChunk;  mng_chunkp       pNext;  mng_cleanupchunk fCleanup;#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_DROP_CHUNKS, MNG_LC_START)#endif  pChunk = pData->pFirstchunk;         /* and get first stored chunk (if any) */  while (pChunk)                       /* more chunks to discard ? */  {    pNext = ((mng_chunk_headerp)pChunk)->pNext;                                       /* call appropriate cleanup */    fCleanup = ((mng_chunk_headerp)pChunk)->fCleanup;    fCleanup (pData, pChunk);    pChunk = pNext;                    /* neeeext */  }#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_DROP_CHUNKS, MNG_LC_END)#endif  return MNG_NOERROR;}#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE *//* ************************************************************************** */#ifdef MNG_SUPPORT_DISPLAYmng_retcode mng_drop_objects (mng_datap pData,                              mng_bool  bDropaniobj){  mng_objectp       pObject;  mng_objectp       pNext;  mng_cleanupobject fCleanup;#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_DROP_OBJECTS, MNG_LC_START)#endif  pObject = pData->pFirstimgobj;       /* get first stored image-object (if any) */  while (pObject)                      /* more objects to discard ? */  {    pNext = ((mng_object_headerp)pObject)->pNext;                                       /* call appropriate cleanup */    fCleanup = ((mng_object_headerp)pObject)->fCleanup;    fCleanup (pData, pObject);    pObject = pNext;                   /* neeeext */  }  pData->pFirstimgobj = MNG_NULL;      /* clean this up!!! */  if (bDropaniobj)                     /* drop animation objects ? */  {    pObject = pData->pFirstaniobj;     /* get first stored animation-object (if any) */    while (pObject)                    /* more objects to discard ? */    {      pNext = ((mng_object_headerp)pObject)->pNext;                                       /* call appropriate cleanup */      fCleanup = ((mng_object_headerp)pObject)->fCleanup;      fCleanup (pData, pObject);      pObject = pNext;                 /* neeeext */    }    pData->pFirstaniobj = MNG_NULL;    /* clean this up!!! */  }#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_DROP_OBJECTS, MNG_LC_END)#endif  return MNG_NOERROR;}#endif /* MNG_SUPPORT_DISPLAY *//* ************************************************************************** */#ifdef MNG_SUPPORT_DISPLAYmng_retcode mng_drop_savedata (mng_datap pData){#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_DROP_SAVEDATA, MNG_LC_START)#endif  if (pData->pSavedata)                /* sanity check */  {                                    /* address it more directly */    mng_savedatap pSave = pData->pSavedata;    if (pSave->iGlobalProfilesize)     /* cleanup the profile ? */      MNG_FREEX (pData, pSave->pGlobalProfile, pSave->iGlobalProfilesize)                                       /* cleanup the save structure */    MNG_FREE (pData, pData->pSavedata, sizeof (mng_savedata))  }#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_DROP_SAVEDATA, MNG_LC_END)#endif  return MNG_NOERROR;}#endif /* MNG_SUPPORT_DISPLAY *//* ************************************************************************** */#ifdef MNG_SUPPORT_DISPLAYmng_retcode mng_reset_rundata (mng_datap pData){  drop_invalid_objects (pData);        /* drop invalidly stored objects */  mng_drop_savedata    (pData);        /* drop stored savedata */  mng_reset_objzero    (pData);        /* reset object 0 */                                       /* drop stored objects (if any) */  mng_drop_objects     (pData, MNG_FALSE);  pData->bFramedone            = MNG_FALSE;  pData->iFrameseq             = 0;    /* reset counters & stuff */  pData->iLayerseq             = 0;  pData->iFrametime            = 0;  pData->iRequestframe         = 0;  pData->iRequestlayer         = 0;  pData->iRequesttime          = 0;  pData->bSearching            = MNG_FALSE;  pData->iRuntime              = 0;  pData->iSynctime             = 0;  pData->iStarttime            = 0;  pData->iEndtime              = 0;  pData->bRunning              = MNG_FALSE;  pData->bTimerset             = MNG_FALSE;  pData->iBreakpoint           = 0;  pData->bSectionwait          = MNG_FALSE;  pData->bFreezing             = MNG_FALSE;  pData->bResetting            = MNG_FALSE;  pData->bNeedrefresh          = MNG_FALSE;  pData->iIterations           = 0;                                       /* start of animation objects! */  pData->pCurraniobj           = MNG_NULL;  pData->iUpdateleft           = 0;    /* reset region */  pData->iUpdateright          = 0;  pData->iUpdatetop            = 0;  pData->iUpdatebottom         = 0;  pData->iPLTEcount            = 0;    /* reset PLTE data */  pData->iDEFIobjectid         = 0;    /* reset DEFI data */  pData->bDEFIhasdonotshow     = MNG_FALSE;  pData->iDEFIdonotshow        = 0;  pData->bDEFIhasconcrete      = MNG_FALSE;  pData->iDEFIconcrete         = 0;  pData->bDEFIhasloca          = MNG_FALSE;  pData->iDEFIlocax            = 0;  pData->iDEFIlocay            = 0;  pData->bDEFIhasclip          = MNG_FALSE;  pData->iDEFIclipl            = 0;  pData->iDEFIclipr            = 0;  pData->iDEFIclipt            = 0;  pData->iDEFIclipb            = 0;  pData->iBACKred              = 0;    /* reset BACK data */  pData->iBACKgreen            = 0;  pData->iBACKblue             = 0;  pData->iBACKmandatory        = 0;  pData->iBACKimageid          = 0;  pData->iBACKtile             = 0;  pData->iFRAMmode             = 1;     /* default global FRAM variables */  pData->iFRAMdelay            = 1;  pData->iFRAMtimeout          = 0x7fffffffl;  pData->bFRAMclipping         = MNG_FALSE;  pData->iFRAMclipl            = 0;  pData->iFRAMclipr            = 0;  pData->iFRAMclipt            = 0;  pData->iFRAMclipb            = 0;  pData->iFramemode            = 1;     /* again for the current frame */  pData->iFramedelay           = 1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -