~ubuntu-branches/debian/sid/mame/sid

« back to all changes in this revision

Viewing changes to mess/src/lib/util/png.h

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Jordi Mallach, Emmanuel Kasper
  • Date: 2011-12-19 22:56:27 UTC
  • mfrom: (0.1.2)
  • Revision ID: package-import@ubuntu.com-20111219225627-ub5oga1oys4ogqzm
Tags: 0.144-1
[ Jordi Mallach ]
* Fix syntax errors in DEP5 copyright file (lintian).
* Use a versioned copyright Format specification field.
* Update Vcs-* URLs.
* Move transitional packages to the new metapackages section, and make
  them priority extra.
* Remove references to GNU/Linux and MESS sources from copyright.
* Add build variables for s390x.
* Use .xz tarballs as it cuts 4MB for the upstream sources.
* Add nplayers.ini as a patch. Update copyright file to add CC-BY-SA-3.0.

[ Emmanuel Kasper ]
* New upstream release. Closes: #651538.
* Add Free Desktop compliant png icons of various sizes taken from
  the hydroxygen iconset
* Mess is now built from a new source package, to avoid possible source
  incompatibilities between mame and the mess overlay.
* Mame-tools are not built from the mame source package anymore, but
  from the mess source package

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 
3
 
    png.h
4
 
 
5
 
    PNG file management.
6
 
 
7
 
****************************************************************************
8
 
 
9
 
    Copyright Aaron Giles
10
 
    All rights reserved.
11
 
 
12
 
    Redistribution and use in source and binary forms, with or without
13
 
    modification, are permitted provided that the following conditions are
14
 
    met:
15
 
 
16
 
        * Redistributions of source code must retain the above copyright
17
 
          notice, this list of conditions and the following disclaimer.
18
 
        * Redistributions in binary form must reproduce the above copyright
19
 
          notice, this list of conditions and the following disclaimer in
20
 
          the documentation and/or other materials provided with the
21
 
          distribution.
22
 
        * Neither the name 'MAME' nor the names of its contributors may be
23
 
          used to endorse or promote products derived from this software
24
 
          without specific prior written permission.
25
 
 
26
 
    THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
27
 
    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28
 
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29
 
    DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
30
 
    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31
 
    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32
 
    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33
 
    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34
 
    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
35
 
    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
 
    POSSIBILITY OF SUCH DAMAGE.
37
 
 
38
 
***************************************************************************/
39
 
 
40
 
#pragma once
41
 
 
42
 
#ifndef __PNG_H__
43
 
#define __PNG_H__
44
 
 
45
 
#include "osdcore.h"
46
 
#include "bitmap.h"
47
 
#include "corefile.h"
48
 
 
49
 
 
50
 
 
51
 
/***************************************************************************
52
 
    CONSTANTS
53
 
***************************************************************************/
54
 
 
55
 
#define PNG_Signature       "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A"
56
 
#define MNG_Signature       "\x8A\x4D\x4E\x47\x0D\x0A\x1A\x0A"
57
 
 
58
 
/* Chunk names */
59
 
#define PNG_CN_IHDR                     0x49484452L
60
 
#define PNG_CN_PLTE                     0x504C5445L
61
 
#define PNG_CN_IDAT                     0x49444154L
62
 
#define PNG_CN_IEND                     0x49454E44L
63
 
#define PNG_CN_gAMA                     0x67414D41L
64
 
#define PNG_CN_sBIT                     0x73424954L
65
 
#define PNG_CN_cHRM                     0x6348524DL
66
 
#define PNG_CN_tRNS                     0x74524E53L
67
 
#define PNG_CN_bKGD                     0x624B4744L
68
 
#define PNG_CN_hIST                     0x68495354L
69
 
#define PNG_CN_tEXt                     0x74455874L
70
 
#define PNG_CN_zTXt                     0x7A545874L
71
 
#define PNG_CN_pHYs                     0x70485973L
72
 
#define PNG_CN_oFFs                     0x6F464673L
73
 
#define PNG_CN_tIME                     0x74494D45L
74
 
#define PNG_CN_sCAL                     0x7343414CL
75
 
 
76
 
/* MNG Chunk names */
77
 
#define MNG_CN_MHDR                     0x4D484452L
78
 
#define MNG_CN_MEND                     0x4D454E44L
79
 
#define MNG_CN_TERM                     0x5445524DL
80
 
#define MNG_CN_BACK                     0x4241434BL
81
 
 
82
 
/* Prediction filters */
83
 
#define PNG_PF_None                     0
84
 
#define PNG_PF_Sub                      1
85
 
#define PNG_PF_Up                       2
86
 
#define PNG_PF_Average          3
87
 
#define PNG_PF_Paeth            4
88
 
 
89
 
/* Error types */
90
 
enum _png_error
91
 
{
92
 
        PNGERR_NONE,
93
 
        PNGERR_OUT_OF_MEMORY,
94
 
        PNGERR_UNKNOWN_FILTER,
95
 
        PNGERR_FILE_ERROR,
96
 
        PNGERR_BAD_SIGNATURE,
97
 
        PNGERR_DECOMPRESS_ERROR,
98
 
        PNGERR_FILE_TRUNCATED,
99
 
        PNGERR_FILE_CORRUPT,
100
 
        PNGERR_UNKNOWN_CHUNK,
101
 
        PNGERR_COMPRESS_ERROR,
102
 
        PNGERR_UNSUPPORTED_FORMAT
103
 
};
104
 
typedef enum _png_error png_error;
105
 
 
106
 
 
107
 
 
108
 
/***************************************************************************
109
 
    TYPE DEFINITIONS
110
 
***************************************************************************/
111
 
 
112
 
typedef struct _png_text png_text;
113
 
struct _png_text
114
 
{
115
 
        png_text *              next;
116
 
        const char *    keyword;                /* this is allocated */
117
 
        const char *    text;                   /* this points to a part of keyword */
118
 
};
119
 
 
120
 
 
121
 
typedef struct _png_info png_info;
122
 
struct _png_info
123
 
{
124
 
        UINT8 *                 image;
125
 
        UINT32                  width, height;
126
 
        UINT32                  xres, yres;
127
 
        rectangle               screen;
128
 
        double                  xscale, yscale;
129
 
        double                  source_gamma;
130
 
        UINT32                  resolution_unit;
131
 
        UINT8                   bit_depth;
132
 
        UINT8                   color_type;
133
 
        UINT8                   compression_method;
134
 
        UINT8                   filter_method;
135
 
        UINT8                   interlace_method;
136
 
 
137
 
        UINT8 *                 palette;
138
 
        UINT32                  num_palette;
139
 
 
140
 
        UINT8 *                 trans;
141
 
        UINT32                  num_trans;
142
 
 
143
 
        png_text *              textlist;
144
 
};
145
 
 
146
 
 
147
 
 
148
 
/***************************************************************************
149
 
    FUNCTION PROTOTYPES
150
 
***************************************************************************/
151
 
 
152
 
void png_free(png_info *pnginfo);
153
 
 
154
 
png_error png_read_file(core_file *fp, png_info *pnginfo);
155
 
png_error png_read_bitmap(core_file *fp, bitmap_t **bitmap);
156
 
png_error png_expand_buffer_8bit(png_info *p);
157
 
 
158
 
png_error png_add_text(png_info *pnginfo, const char *keyword, const char *text);
159
 
png_error png_write_bitmap(core_file *fp, png_info *info, bitmap_t *bitmap, int palette_length, const UINT32 *palette);
160
 
 
161
 
png_error mng_capture_start(core_file *fp, bitmap_t *bitmap, double rate);
162
 
png_error mng_capture_frame(core_file *fp, png_info *info, bitmap_t *bitmap, int palette_length, const UINT32 *palette);
163
 
png_error mng_capture_stop(core_file *fp);
164
 
 
165
 
#endif  /* __PNG_H__ */