Logo Search packages:      
Sourcecode: advancecomp version File versions  Download package

mng.h

Go to the documentation of this file.
/*
 * This file is part of the Advance project.
 *
 * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Andrea Mazzoleni
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details. 
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

/** \file
 * MNG file support.
 */

#ifndef __MNG_H
#define __MNG_H

#include "png.h"

#ifdef __cplusplus
extern "C" {
#endif

/** \name ADV_MNG_CHUNK */
/*@{*/
#define ADV_MNG_CN_DHDR 0x44484452
#define ADV_MNG_CN_MHDR 0x4D484452
#define ADV_MNG_CN_MEND 0x4D454E44
#define ADV_MNG_CN_DEFI 0x44454649
#define ADV_MNG_CN_PPLT 0x50504c54
#define ADV_MNG_CN_MOVE 0x4d4f5645
#define ADV_MNG_CN_TERM 0x5445524d
#define ADV_MNG_CN_SAVE 0x53415645
#define ADV_MNG_CN_SEEK 0x5345454b
#define ADV_MNG_CN_LOOP 0x4c4f4f50
#define ADV_MNG_CN_ENDL 0x454e444c
#define ADV_MNG_CN_BACK 0x4241434b
#define ADV_MNG_CN_FRAM 0x4652414d
/*@}*/

/**
 * MNG context.
 */
00054 typedef struct adv_mng_struct {
00055       int end_flag; /**< End flag. */
00056       unsigned pixel; /**< Bytes per pixel. */
00057       unsigned char* dat_ptr; /**< Current image buffer. */
00058       unsigned dat_size; /**< Size of the buffer image. */
00059       unsigned dat_line; /**< Bytes per scanline. */
      
00061       int dat_x; /**< X position of the displayed area in the working area. */
00062       int dat_y; /**< Y position of the displayed area in the working area. */
00063       unsigned dat_width; /**< Width of the working area. */
00064       unsigned dat_height; /**< height of the working area. */

00066       unsigned char* dlt_ptr; /**< Delta buffer. */
00067       unsigned dlt_size; /**< Delta buffer size. */
00068       unsigned dlt_line; /**< Delta bufer bytes per scanline. */

00070       unsigned char pal_ptr[256*3]; /**< Palette data. */
00071       unsigned pal_size; /**< Palette data size in bytes. */

00073       unsigned frame_frequency; /**< Base frame rate. */
00074       unsigned frame_tick; /**< Ticks for a generic frame. */
00075       unsigned frame_width; /**< Frame width. */
00076       unsigned frame_height; /**< Frame height. */
} adv_mng;

adv_error adv_mng_read_signature(adv_fz* f);
adv_error adv_mng_write_signature(adv_fz* f, unsigned* count);
adv_error adv_mng_write_mhdr(
      unsigned pix_width, unsigned pix_height,
      unsigned frequency, adv_bool is_lc,
      adv_fz* f, unsigned* count
);
adv_error adv_mng_write_mend(adv_fz* f, unsigned* count);
adv_error adv_mng_write_fram(unsigned tick, adv_fz* f, unsigned* count);

/** \addtogroup VideoFile */
/*@{*/

adv_mng* adv_mng_init(adv_fz* f);
void adv_mng_done(adv_mng* mng);
adv_error adv_mng_read(
      adv_mng* mng,
      unsigned* pix_width, unsigned* pix_height, unsigned* pix_pixel,
      unsigned char** dat_ptr, unsigned* dat_size,
      unsigned char** pix_ptr, unsigned* pix_scanline,
      unsigned char** pal_ptr, unsigned* pal_size,
      unsigned* tick,
      adv_fz* f
);
adv_error adv_mng_read_done(
      adv_mng* mng,
      unsigned* pix_width, unsigned* pix_height, unsigned* pix_pixel,
      unsigned char** dat_ptr, unsigned* dat_size,
      unsigned char** pix_ptr, unsigned* pix_scanline,
      unsigned char** pal_ptr, unsigned* pal_size,
      unsigned* tick,
      adv_fz* f
);
unsigned adv_mng_frequency_get(adv_mng* mng);
unsigned adv_mng_width_get(adv_mng* mng);
unsigned adv_mng_height_get(adv_mng* mng);

/*@}*/

#ifdef __cplusplus
}
#endif

#endif


Generated by  Doxygen 1.6.0   Back to index