Debian Codegraph @

common/include/pcx.h

raw
1 /*
2 * Portions of this file are copyright Rebirth contributors and licensed as
3 * described in COPYING.txt.
4 * Portions of this file are copyright Parallax Software and licensed
5 * according to the Parallax license below.
6 * See COPYING.txt for license details.
7
8 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
9 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
10 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
11 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
12 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
13 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
14 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
15 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
16 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
17 COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
18 */
19 /*
20 *
21 * Routines to read/write pcx images.
22 *
23 */
24
25 #pragma once
26
27 #include "pstypes.h"
28 #include "dxxsconf.h"
29 #include "dsx-ns.h"
30 #include "fwd-gr.h"
31 #if !DXX_USE_OGL && DXX_USE_SCREENSHOT_FORMAT_LEGACY
32 #include <physfs.h>
33 #endif
34
35 namespace dcx {
36 struct palette_array_t;
37
38 enum class pcx_result
39 {
40 SUCCESS = 0,
41 ERROR_OPENING = 1,
42 ERROR_NO_HEADER = 2,
43 ERROR_WRONG_VERSION = 3,
44 ERROR_READING = 4,
45 ERROR_NO_PALETTE = 5,
46 ERROR_WRITING = 6,
47 ERROR_MEMORY = 7
48 };
49
50 // Reads filename into bitmap bmp, and fills in palette. If bmp->bm_data==NULL,
51 // then bmp->bm_data is allocated and the w,h are filled.
52 // If palette==NULL the palette isn't read in. Returns error code.
53
54 pcx_result pcx_read_bitmap(const char * filename, grs_main_bitmap &bmp, palette_array_t &palette);
55 pcx_result pcx_read_bitmap_or_default(const char * filename, grs_main_bitmap &bmp, palette_array_t &palette);
56
57 // Writes the bitmap bmp to filename, using palette. Returns error code.
58
59 #if !DXX_USE_OGL && DXX_USE_SCREENSHOT_FORMAT_LEGACY
60 unsigned pcx_write_bitmap(PHYSFS_File *, const grs_bitmap *bmp, palette_array_t &palette);
61 #endif
62
63 const char *pcx_errormsg(pcx_result error_number);
64
65 }
66
67 #ifdef DXX_BUILD_DESCENT
68 #if DXX_BUILD_DESCENT == 1
69 namespace dsx {
70 // Load bitmap for little-known 'baldguy' cheat.
71 pcx_result bald_guy_load(const char *filename, grs_main_bitmap &bmp, palette_array_t &palette);
72 }
73 #endif
74 #endif