Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/* SDef.h: Sasa definitions.
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//#include "tmsg.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef _SDEF_H_
Toshihiro Shimizu 890ddd
#define _SDEF_H_
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//typedef   signed char  SCHAR;
Toshihiro Shimizu 890ddd
typedef unsigned char UCHAR;
Toshihiro Shimizu 890ddd
/*typedef unsigned short USHORT;
Toshihiro Shimizu 890ddd
typedef unsigned int   UINT;
Toshihiro Shimizu 890ddd
typedef unsigned long  ULONG;
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct _UC_PIXEL {
Toshihiro Shimizu 890ddd
	unsigned char b, g, r, m;
Toshihiro Shimizu 890ddd
} UC_PIXEL;
Toshihiro Shimizu 890ddd
typedef struct _US_PIXEL {
Toshihiro Shimizu 890ddd
	unsigned short b, g, r, m;
Toshihiro Shimizu 890ddd
} US_PIXEL;
Toshihiro Shimizu 890ddd
typedef struct _I_PIXEL {
Toshihiro Shimizu 890ddd
	int b, g, r, m;
Toshihiro Shimizu 890ddd
} I_PIXEL;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define ASSIGN_PIXEL(d, s) \
Toshihiro Shimizu 890ddd
	{                      \
Toshihiro Shimizu 890ddd
		(d)->r = (s)->r;   \
Toshihiro Shimizu 890ddd
		(d)->g = (s)->g;   \
Toshihiro Shimizu 890ddd
		(d)->b = (s)->b;   \
Toshihiro Shimizu 890ddd
		(d)->m = (s)->m;   \
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
#define NULL_PIXEL(d)                          \
Toshihiro Shimizu 890ddd
	{                                          \
Toshihiro Shimizu 890ddd
		(d)->r = (d)->g = (d)->b = (d)->m = 0; \
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
#define COLOR_PIXEL(d, r, g, b, m) \
Toshihiro Shimizu 890ddd
	{                              \
Toshihiro Shimizu 890ddd
		(d)->r = (r);              \
Toshihiro Shimizu 890ddd
		(d)->g = (g);              \
Toshihiro Shimizu 890ddd
		(d)->b = (b);              \
Toshihiro Shimizu 890ddd
		(d)->m = (m);              \
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct {
Toshihiro Shimizu 890ddd
	int x0, y0, x1, y1;
Toshihiro Shimizu 890ddd
} SRECT;
Toshihiro Shimizu 890ddd
typedef struct {
Toshihiro Shimizu 890ddd
	double x0, y0, x1, y1;
Toshihiro Shimizu 890ddd
} SDRECT;
Toshihiro Shimizu 890ddd
typedef struct {
Toshihiro Shimizu 890ddd
	int x0, y0, x1, y1;
Toshihiro Shimizu 890ddd
} SLINE;
Toshihiro Shimizu 890ddd
typedef struct {
Toshihiro Shimizu 890ddd
	double x0, y0, x1, y1;
Toshihiro Shimizu 890ddd
} SDLINE;
Toshihiro Shimizu 890ddd
typedef struct {
Toshihiro Shimizu 890ddd
	int x, y;
Toshihiro Shimizu 890ddd
} SPOINT;
Toshihiro Shimizu 890ddd
typedef struct {
Toshihiro Shimizu 890ddd
	double x, y;
Toshihiro Shimizu 890ddd
} SDPOINT;
Toshihiro Shimizu 890ddd
typedef struct {
Toshihiro Shimizu 890ddd
	int x, y, w;
Toshihiro Shimizu 890ddd
} SXYW;
Toshihiro Shimizu 890ddd
typedef struct {
Toshihiro Shimizu 890ddd
	int x, y;
Toshihiro Shimizu 890ddd
	double w;
Toshihiro Shimizu 890ddd
} SXYDW;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct {
Toshihiro Shimizu 890ddd
	int x, y;
Toshihiro Shimizu 890ddd
	double d;
Toshihiro Shimizu 890ddd
} SXYD;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef MIN
Toshihiro Shimizu 890ddd
#define MIN(x, y) ((x) < (y) ? (x) : (y))
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
#ifndef MAX
Toshihiro Shimizu 890ddd
#define MAX(x, y) ((x) > (y) ? (x) : (y))
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define I_ROUND(x) ((int)(((int)(-0.9F) == 0 && (x) < 0.0F) ? ((x)-0.5F) : ((x) + 0.5F)))
Toshihiro Shimizu 890ddd
#define I_ROUNDP(x) ((int)((x) + 0.5F))
Toshihiro Shimizu 890ddd
#define UC_ROUND(x) ((unsigned char)((x) + 0.5F))
Toshihiro Shimizu 890ddd
#define US_ROUND(x) ((unsigned short)((x) + 0.5F))
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define I_CUT_0_255(x) ((x) < 0 ? 0 : ((x) > 255 ? 255 : (x)))
Toshihiro Shimizu 890ddd
#define I_CUT_0_65535(x) ((x) < 0 ? 0 : ((x) > 65535 ? 65535 : (x)))
Toshihiro Shimizu 890ddd
#define D_CUT_0_255(x) ((x) < 0.0 ? 0.0 : ((x) > 255.0 ? 255.0 : (x)))
Toshihiro Shimizu 890ddd
#define D_CUT_0_65535(x) ((x) < 0.0 ? 0.0 : ((x) > 65535.0 ? 65535.0 : (x)))
Toshihiro Shimizu 890ddd
#define D_CUT_0_1(x) ((x) < 0.0 ? 0.0 : ((x) > 1.0 ? 1.0 : (x)))
Toshihiro Shimizu 890ddd
#define D_CUT(x, a, b) ((x) < (a) ? (a) : ((x) > (b) ? (b) : (x)))
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define UC_MAX 255
Toshihiro Shimizu 890ddd
#define US_MAX 65535
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define PI 3.1415926535
Toshihiro Shimizu 890ddd
#define UNDEFINED (-99999.9)
Toshihiro Shimizu 890ddd
/*
Toshihiro Shimizu 890ddd
#define FLOOR(x) ((int)(x) > (x) ? (int)(x)-1 : (int)(x))
Toshihiro Shimizu 890ddd
#define CEIL(x)  ((int)(x) < (x) ? (int)(x)+1 : (int)(x))
Toshihiro Shimizu 890ddd
#define DEG2RAD(x) ((x)*PI/180.0)
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
#define DEG2RAD(x) ((x)*0.01745329252)
Toshihiro Shimizu 890ddd
/*#define RAD2DEG(x) ((x)*180.0/PI )
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
#define RAD2DEG(x) ((x)*57.29577951472)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define TOONZ_INTERNAL_MSG
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef TOONZ_INTERNAL_MSG
Toshihiro Shimizu 890ddd
#define smsg_info tmsg_info
Toshihiro Shimizu 890ddd
#define smsg_warning tmsg_warning
Toshihiro Shimizu 890ddd
#define smsg_error tmsg_error
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define smsg_info printf
Toshihiro Shimizu 890ddd
#define smsg_warning printf
Toshihiro Shimizu 890ddd
#define smsg_error printf
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif