home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD Direkt 1995 #1
/
Image.iso
/
cdd
/
winanw
/
pman
/
writepcx.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-21
|
23KB
|
474 lines
/************************************************************************\
* *
* writepcx.c *
* *
* This file is part of PICTURE MAN image file converter/processor *
* *
* 1992 Potapov WORKS, STOIK Ltd. *
* *
* This file contains source code for PCX file writer *
* *
* Compiler: MS C v.6.00A *
* *
* You may use, modify and distribute this code freely *
* *
\************************************************************************/
#include <windows.h>
#include "custconv.h"
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#define BUFSIZE 4096
typedef struct {
char manuf; /* Always =10 for Paintbrush */
char hard; /* Version information */
char encod; /* Run-length encoding (=1) */
char bitpx; /* Bits per pixel */
unsigned x1; /* Picture dimensions (incl) */
unsigned y1;
unsigned x2;
unsigned y2;
unsigned hres; /* Display horiz resolution */
unsigned vres; /* Display vert resolution */
char clrma[48]; /* Pallete */
char vmode; /* (ignored) */
char nplanes; /* Number of planes (ver 2.5=0)*/
unsigned bplin; /* Bytes per line */
unsigned palinfo; /* Palette Info (1=col, 2=gray)*/
unsigned shres; /* Scanner resolution */
unsigned svres; /* */
char xtra[54]; /* Extra space (filler) */
} PCXhdr;
typedef struct{
int file;
BOOL PCXpalette;
PAL pal;
BYTE buffer[BUFSIZE];
WORD pos;
PCXhdr hdr;
}PCXStruct;
/************************************************************************\
* *
* ROUTINE: int FAR PASCAL LibMain(HANDLE hModule, WORD wDataSeg, *
* WORD cbHeapSize, LPSTR lpszCmdLine) *
* PURPOSE: DLL entry point. *
* *
\************************************************************************/
int FAR PASCAL LibMain(HANDLE hModule, WORD wDataSeg,
WORD cbHeapSize, LPSTR lpszCmdLine)
{
return 1;
}
/************************************************************************\
* *
* ROUTINE: int FAR PASCAL WEP(int bSystemExit) *
* *
* PURPOSE: DLL exit procedure *
* *
\************************************************************************/
int FAR PASCAL WEP(int bSystemExit)
{
return 1;
}
/************************************************************************\
* *
* ROUTINE: WORD FAR PASCAL Magic(void) *
* *
* PURPOSE: Identification routine *
* RETURNS: 'Magic number' SRC_MAGIC *
* *
\************************************************************************/
WORD FAR PASCAL Magic(void)
{
return DST_MAGIC;
}
/************************************************************************\
* *
* ROUTINE: void FAR PASCAL GetDescription(LPSTR str) *
* *
* PURPOSE: Sets format name *
* *
* PARAMETERS: LPSTR str - pointer for format name storage. The length *
* name must be less than 40! *
* *
\************************************************************************/
void FAR PASCAL GetDescription(LPSTR str)
{
lstrcpy(str,"ZSoft PaintBrush PCX");
}
/************************************************************************\
* *
* ROUTINE: void FAR PASCAL GetExtension(LPSTR str) *
* *
* PURPOSE: Sets format file extension *
* *
* PARAMETERS: LPSTR str - pointer for format file extension. *
* *
\************************************************************************/
void FAR PASCAL GetExtension(LPSTR str)
{
lstrcpy(str,"PCX");
}
/************************************************************************\
* *
* ROUTINE: DWORD FAR PASCAL GetFlags(void) *
* *
* PURPOSE: Sets flag for converter capabilities *
* *
* PARAMETERS: None *
* *
* RETURNS: Flags *
* Color info bits *
* INFO_COLOR // Image is colored *
* INFO_PALETTE // Image is paletted *
* INFO_NEGATIVE // Image is negative *
* File organization bits *
* INFO_TEMPFILE // Only using temporary file *
* INFO_COMPRESSED // Image is compressed *
* INFO_FORWARD // Up to down *
* INFO_BACKWARD // Down to up *
* INFO_RANDOM // Random access is allowed *
* Row organization bits *
* INFO_PACKED // (bps < 8) bits are shifted together *
* INFO_SEPARATE // (bps !=8) bitplanes are separated *
* *
* Bits for GetFlags() *
* Destination capabilites bits *
* INFO_1BPS // Accepts 1-bit data *
* INFO_4BPS // Accepts 4-bit data *
* INFO_8BPS // Accepts 8-bit data