ftp.nice.ch/pub/next/graphics/viewer/ToyViewer.2.6a.s.tar.gz#/ToyViewer2.6a/src/common.h

This is common.h in view mode; [Download] [Up]

/*
	common.h	image independent information
*/

#ifndef _COMMON_h_
#define _COMMON_h_

#include <appkit/graphics.h>
#include <stdio.h>

#define  Err_OPEN	1
#define  Err_FORMAT	2
#define  Err_MEMORY	3
#define  Err_SHORT	4
#define  Err_ILLG	5
#define  Err_IMPLEMENT	6
#define  Err_SAVE	7
#define  Err_SAV_IMPL	8
#define  Err_EPS_IMPL	9
#define  Err_EPS_ONLY	10
#define  Err_OPR_IMPL	11
#define  Err_NOFILE	12
#define  Err_FLT_EXEC	13

#define  Type_none	-1
#define  Type_other	0	/* Filter service */
#define  Type_tiff	1
#define  Type_eps	2
#define  Type_gif	3
#define  Type_bmp	4
#define  Type_ppm	5
#define  Type_pcd	6
#define  Type_user	0x11	/* User-specified pipe */
#define  Type_pcx	0x12
#define  Type_mag	0x13
#define  Type_jpg	0x14
#define  Type_xbm	0x15
#define  Type_jbg	0x16
#define  Type_png	0x17
#define  viaPipe(t)	((t) > 0 && (0xf0 & (t)))

#define  isAlphaOpaque(x)	((x) >= 255)
#define  isAlphaTransp(x)	((x) < 255)
#define  AlphaOpaque		255
#define  AlphaTransp		0
#define  Bright255(r, g, b)	(((r)*30 + (g)*59 + (b)*11 + 50) / 100)

#define  toyviewerTAB	"filters"
#define  toyviewerRC	".toyviewerrc"

#define  RED	0
#define  GREEN	1
#define  BLUE	2
#define  ALPHA	3
#define  FIXcount	256
#define  MAXPLANE	5

/* Operations */
#define  NoOperation	0
#define  Rotation	1
#define  Horizontal	2
#define  Vertical	3
#define  Clip		4
#define  Negative	5
#define  NewBitmap	6
#define  Monochrome	7
#define  Gray2Bits	8
#define  BiLevel	9
#define  Brightness	10
#define  ColorTone	11
#define  Reduction	12
#define  ColorChange	13
#define  Enhance	14
#define  Emboss		15
#define  RandomPttn	16
#define  ResizeEPS	17
#define  SoftFrame	18
#define  Posterize	19
#define  CutDown	20

#define  MAXWidth	4096	/* 画像の横幅の想定最大値 */
#define  MAX_COMMENT	256
#define	 MAXFILENAMELEN	512

typedef unsigned char	paltype[3];

typedef struct {
	int	width, height;
	short	xbytes;		/* バイト数/line */
	short	palsteps;	/* colors of palette */
	unsigned char	type;	/* Type_??? */
	unsigned char	bits;
	unsigned char	numcolors;	/* color elements without alpha */
	BOOL	isplanar, alpha;
	NXColorSpace	cspace;
	paltype	*palette;
	unsigned char	memo[MAX_COMMENT];
} commonInfo;
/* If ( commonInfo.alpha == YES && commonInfo.palette != NULL) then
   the image has one transparent entry in the palette as GIF.
   The index of transparence should be the last of the palette.
 */
/* Rule for "memo" string:
    memo  :=  Dim [Kind] Attr{[,] Attr} : COMMENT
	Dim	Ex. "560 x 300" or "560x300"
	Kind	Ex. "jpg", "EPS", "GIF87a"
	Attr	Ex. "16colors", "gray", "alpha", ...
    Don't use ':' in Dim ,Kind, or Attr.
    Format of comments in pnm, pxo, or pao:
	[Attr{[,] Attr}] : COMMENT
*/

extern int get_short(FILE *);
extern long get_long(FILE *);
extern void put_short(int, FILE *);
extern void put_long(long, FILE *);
extern int byte_length(int, int);
extern void errAlert(const char *, int);
extern void warnAlert(const char *, int);
extern void timedAlert(BOOL);

extern int optimalBits(unsigned char *, int);
extern int howManyBits(paltype *, int);
extern BOOL isGray(paltype *, int);
extern int allocImage(unsigned char **, int, int, int, int);
extern void expandImage(unsigned char **,
	unsigned char *, paltype const *, int, int, BOOL, int);
extern void packImage(unsigned char *, unsigned char *, int, int);
extern void packWorkingImage(const commonInfo *, int,
	unsigned char **, unsigned char **);
extern paltype *copyPalette(paltype *, int);

#endif /* _COMMON_h_ */

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.