2006-03-20 17:12:09 +00:00
|
|
|
/*
|
2014-06-01 17:55:23 +00:00
|
|
|
* Portions of this file are copyright Rebirth contributors and licensed as
|
|
|
|
* described in COPYING.txt.
|
|
|
|
* Portions of this file are copyright Parallax Software and licensed
|
|
|
|
* according to the Parallax license below.
|
|
|
|
* See COPYING.txt for license details.
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
|
|
|
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
|
|
|
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
|
|
|
|
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
|
|
|
|
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
|
|
|
|
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
|
|
|
|
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
|
|
|
|
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
|
|
|
|
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
|
|
|
|
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Routines to read/write pcx images.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-01-09 16:38:12 +00:00
|
|
|
#pragma once
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-10-26 03:40:50 +00:00
|
|
|
#include "pstypes.h"
|
2016-01-09 16:38:12 +00:00
|
|
|
#include "dxxsconf.h"
|
2016-03-19 19:08:10 +00:00
|
|
|
#include "dsx-ns.h"
|
2016-12-05 00:26:11 +00:00
|
|
|
#include "fwd-gr.h"
|
2018-02-18 00:42:42 +00:00
|
|
|
#if !DXX_USE_OGL && DXX_USE_SCREENSHOT_FORMAT_LEGACY
|
|
|
|
#include <physfs.h>
|
|
|
|
#endif
|
2012-11-11 22:12:51 +00:00
|
|
|
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dcx {
|
2013-01-06 21:11:53 +00:00
|
|
|
struct palette_array_t;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2019-07-07 22:00:02 +00:00
|
|
|
enum class pcx_result
|
|
|
|
{
|
|
|
|
SUCCESS = 0,
|
|
|
|
ERROR_OPENING = 1,
|
|
|
|
ERROR_NO_HEADER = 2,
|
|
|
|
ERROR_WRONG_VERSION = 3,
|
|
|
|
ERROR_READING = 4,
|
|
|
|
ERROR_NO_PALETTE = 5,
|
|
|
|
ERROR_WRITING = 6,
|
|
|
|
ERROR_MEMORY = 7
|
|
|
|
};
|
2015-12-13 18:00:48 +00:00
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
// Reads filename into bitmap bmp, and fills in palette. If bmp->bm_data==NULL,
|
|
|
|
// then bmp->bm_data is allocated and the w,h are filled.
|
|
|
|
// If palette==NULL the palette isn't read in. Returns error code.
|
|
|
|
|
2019-07-07 22:00:02 +00:00
|
|
|
pcx_result pcx_read_bitmap(const char * filename, grs_main_bitmap &bmp, palette_array_t &palette);
|
2020-12-26 21:17:29 +00:00
|
|
|
pcx_result pcx_read_bitmap_or_default(const char * filename, grs_main_bitmap &bmp, palette_array_t &palette);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
// Writes the bitmap bmp to filename, using palette. Returns error code.
|
|
|
|
|
2018-02-18 00:42:42 +00:00
|
|
|
#if !DXX_USE_OGL && DXX_USE_SCREENSHOT_FORMAT_LEGACY
|
2021-02-06 17:53:53 +00:00
|
|
|
unsigned pcx_write_bitmap(PHYSFS_File *, const grs_bitmap *bmp, palette_array_t &palette);
|
2018-02-18 00:42:42 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2019-07-07 22:00:02 +00:00
|
|
|
const char *pcx_errormsg(pcx_result error_number);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2015-12-13 18:00:48 +00:00
|
|
|
}
|
2019-07-07 22:00:02 +00:00
|
|
|
|
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
|
|
|
namespace dsx {
|
|
|
|
// Load bitmap for little-known 'baldguy' cheat.
|
2020-05-17 23:35:26 +00:00
|
|
|
pcx_result bald_guy_load(const char *filename, grs_main_bitmap &bmp, palette_array_t &palette);
|
2019-07-07 22:00:02 +00:00
|
|
|
}
|
|
|
|
#endif
|