home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 July / CMCD0704.ISO / Software / Freeware / Utilitare / VisualBoyAdvance-1.7.2 / win32 / include / cximage / ximamng.h < prev    next >
C/C++ Source or Header  |  2004-02-29  |  3KB  |  103 lines

  1. /*
  2.  * File:    ximamng.h
  3.  * Purpose:    Declaration of the MNG Image Class
  4.  * Author:    Davide Pizzolato - www.xdp.it
  5.  * Created:    2001
  6.  */
  7. /* === C R E D I T S  &  D I S C L A I M E R S ==============
  8.  * CxImageMNG (c) 07/Aug/2001 Davide Pizzolato - www.xdp.it
  9.  * Permission is given by the author to freely redistribute and include
  10.  * this code in any program as long as this credit is given where due.
  11.  *
  12.  * CxImage version 5.99a 08/Feb/2004
  13.  * See the file history.htm for the complete bugfix and news report.
  14.  *
  15.  * Special thanks to Frank Haug <f.haug(at)jdm(dot)de> for suggestions and code.
  16.  *
  17.  * original mng.cpp code created by Nikolaus Brennig, November 14th, 2000. <virtualnik(at)nol(dot)at>
  18.  *
  19.  * LIBMNG Copyright (c) 2000,2001 Gerard Juyn (gerard@libmng.com)
  20.  *
  21.  * COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
  22.  * OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
  23.  * THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
  24.  * OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
  25.  * CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
  26.  * THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
  27.  * SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
  28.  * PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
  29.  * THIS DISCLAIMER.
  30.  *
  31.  * Use at your own risk!
  32.  * ==========================================================
  33.  */
  34.  
  35. #if !defined(__ximaMNG_h)
  36. #define __ximaMNG_h
  37.  
  38. #include "ximage.h"
  39.  
  40. #if CXIMAGE_SUPPORT_MNG
  41.  
  42. //#define MNG_NO_CMS
  43. #define MNG_SUPPORT_DISPLAY
  44. #define MNG_SUPPORT_READ
  45. #define    MNG_SUPPORT_WRITE
  46. #define MNG_ACCESS_CHUNKS
  47. #define MNG_STORE_CHUNKS
  48.  
  49. extern "C" {
  50. #include "../mng/libmng.h"
  51. #include "../mng/libmng_data.h"
  52. }
  53.  
  54. //unsigned long _stdcall RunMNGThread(void *lpParam);
  55.  
  56. typedef struct tagmngstuff 
  57. {
  58.     CxFile        *file;
  59.     BYTE        *image;
  60.     HANDLE        thread;
  61.     mng_uint32    delay;
  62.     mng_uint32  width;
  63.     mng_uint32  height;
  64.     mng_uint32  effwdt;
  65.     mng_int16    bpp;
  66.     mng_bool    animation;
  67.     mng_bool    animation_enabled;
  68.     float        speed;
  69.     long        nBkgndIndex;
  70.     RGBQUAD        nBkgndColor;
  71. } mngstuff;
  72.  
  73. class CxImageMNG: public CxImage
  74. {
  75. public:
  76.     CxImageMNG();
  77.     ~CxImageMNG();
  78.  
  79.     bool Load(const char * imageFileName);
  80.     bool Save(const char * imageFileName){ return CxImage::Save(imageFileName,CXIMAGE_FORMAT_MNG);}
  81.  
  82.     bool Decode(CxFile * hFile);
  83.     bool Decode(FILE *hFile) { CxIOFile file(hFile); return Decode(&file); }
  84.  
  85. #if CXIMAGE_SUPPORT_ENCODE
  86.     bool Encode(CxFile * hFile);
  87.     bool Encode(FILE *hFile) { CxIOFile file(hFile); return Encode(&file); }
  88. #endif // CXIMAGE_SUPPORT_ENCODE
  89.  
  90.     long Resume();
  91.     void SetSpeed(float speed);
  92.     
  93.     mng_handle hmng;
  94.     mngstuff mnginfo;
  95. protected:
  96.     void WritePNG(mng_handle hMNG, int Frame, int FrameCount );
  97.     void SetCallbacks(mng_handle mng);
  98. };
  99.  
  100. #endif
  101.  
  102. #endif
  103.