|
Shinya Kitaoka |
810553 |
#pragma once
|
|
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 |
|
|
Shinya Kitaoka |
120a6e |
// 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 |
|
|
Shinya Kitaoka |
120a6e |
typedef struct _UC_PIXEL { unsigned char b, g, r, m; } UC_PIXEL;
|
|
Shinya Kitaoka |
120a6e |
typedef struct _US_PIXEL { unsigned short b, g, r, m; } US_PIXEL;
|
|
Shinya Kitaoka |
120a6e |
typedef struct _I_PIXEL { int b, g, r, m; } I_PIXEL;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
#define ASSIGN_PIXEL(d, s) \
|
|
Shinya Kitaoka |
120a6e |
{ \
|
|
Shinya Kitaoka |
120a6e |
(d)->r = (s)->r; \
|
|
Shinya Kitaoka |
120a6e |
(d)->g = (s)->g; \
|
|
Shinya Kitaoka |
120a6e |
(d)->b = (s)->b; \
|
|
Shinya Kitaoka |
120a6e |
(d)->m = (s)->m; \
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
#define NULL_PIXEL(d) \
|
|
Shinya Kitaoka |
120a6e |
{ (d)->r = (d)->g = (d)->b = (d)->m = 0; }
|
|
Shinya Kitaoka |
120a6e |
#define COLOR_PIXEL(d, r, g, b, m) \
|
|
Shinya Kitaoka |
120a6e |
{ \
|
|
Shinya Kitaoka |
120a6e |
(d)->r = (r); \
|
|
Shinya Kitaoka |
120a6e |
(d)->g = (g); \
|
|
Shinya Kitaoka |
120a6e |
(d)->b = (b); \
|
|
Shinya Kitaoka |
120a6e |
(d)->m = (m); \
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
typedef struct { int x0, y0, x1, y1; } SRECT;
|
|
Shinya Kitaoka |
120a6e |
typedef struct { double x0, y0, x1, y1; } SDRECT;
|
|
Shinya Kitaoka |
120a6e |
typedef struct { int x0, y0, x1, y1; } SLINE;
|
|
Shinya Kitaoka |
120a6e |
typedef struct { double x0, y0, x1, y1; } SDLINE;
|
|
Shinya Kitaoka |
120a6e |
typedef struct { int x, y; } SPOINT;
|
|
Shinya Kitaoka |
120a6e |
typedef struct { double x, y; } SDPOINT;
|
|
Shinya Kitaoka |
120a6e |
typedef struct { int x, y, w; } SXYW;
|
|
Shinya Kitaoka |
120a6e |
typedef struct {
|
|
Shinya Kitaoka |
120a6e |
int x, y;
|
|
Shinya Kitaoka |
120a6e |
double w;
|
|
Toshihiro Shimizu |
890ddd |
} SXYDW;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
typedef struct {
|
|
Shinya Kitaoka |
120a6e |
int x, y;
|
|
Shinya Kitaoka |
120a6e |
double d;
|
|
Toshihiro Shimizu |
890ddd |
} SXYD;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#define I_ROUND(x) \
|
|
Shinya Kitaoka |
120a6e |
((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
|