Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef _CASM_NODE_DEFINED_H
Toshihiro Shimizu 890ddd
#define _CASM_NODE_DEFINED_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "raster.h"
Toshihiro Shimizu 890ddd
#include "casm.h"
Toshihiro Shimizu 890ddd
#include "tmacro.h"
Toshihiro Shimizu 890ddd
#include "affine.h"
Toshihiro Shimizu 890ddd
#include "toonzproc.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define CASM_NODE_HD            \
Toshihiro Shimizu 890ddd
	struct CASM_NODEPROC *proc; \
Toshihiro Shimizu 890ddd
	char bg_flag, bad_branch;   \
Toshihiro Shimizu 890ddd
	ULONG mask;                 \
Toshihiro Shimizu 890ddd
	int label;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define CASM_UNARY_NODE_HD \
Toshihiro Shimizu 890ddd
	CASM_NODE_HD           \
Toshihiro Shimizu 890ddd
	CASM_NODE *arg;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define CASM_BINARY_NODE_HD     \
Toshihiro Shimizu 890ddd
	CASM_NODE_HD                \
Toshihiro Shimizu 890ddd
	CASM_NODE *arg_dn, *arg_up; \
Toshihiro Shimizu 890ddd
	int marker_dn, marker_up;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define CASM_N_ARY_NODE_HD \
Toshihiro Shimizu 890ddd
	CASM_NODE_HD           \
Toshihiro Shimizu 890ddd
	int num_args;          \
Toshihiro Shimizu 890ddd
	CASM_NODE **args;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE {
Toshihiro Shimizu 890ddd
	CASM_NODE_HD
Toshihiro Shimizu 890ddd
} CASM_NODE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_TILE {
Toshihiro Shimizu 890ddd
	RASTER r;
Toshihiro Shimizu 890ddd
	int x1, y1, x2, y2;
Toshihiro Shimizu 890ddd
} CASM_TILE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODESIZE {
Toshihiro Shimizu 890ddd
	float x1, y1, x2, y2;
Toshihiro Shimizu 890ddd
	float sbx1, sby1, sbx2, sby2;
Toshihiro Shimizu 890ddd
} CASM_NODESIZE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct USR_IMAGE {
Toshihiro Shimizu 890ddd
	void *buffer;
Toshihiro Shimizu 890ddd
	enum img_type type;
Toshihiro Shimizu 890ddd
	int wrap, lx, ly;
Toshihiro Shimizu 890ddd
	struct {
Toshihiro Shimizu 890ddd
		LPIXEL *buffer;
Toshihiro Shimizu 890ddd
		int offset, size;
Toshihiro Shimizu 890ddd
	} cmap;
Toshihiro Shimizu 890ddd
} USR_IMAGE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
enum CASM_NODE_TYPE {
Toshihiro Shimizu 890ddd
	OVR_TRANSF = 0,
Toshihiro Shimizu 890ddd
	ADD_TRANSF,
Toshihiro Shimizu 890ddd
	BACKLIT_TRANSF,
Toshihiro Shimizu 890ddd
	MATTE_TRANSF,
Toshihiro Shimizu 890ddd
	WARP_TRANSF,
Toshihiro Shimizu 890ddd
	BLUR_TRANSF,
Toshihiro Shimizu 890ddd
	MBLUR_TRANSF,
Toshihiro Shimizu 890ddd
	UDIT_TRANSF,
Toshihiro Shimizu 890ddd
	READ_TRANSF,
Toshihiro Shimizu 890ddd
	FLIPX_TRANSF,
Toshihiro Shimizu 890ddd
	FLIPY_TRANSF,
Toshihiro Shimizu 890ddd
	EXTOP_TRANSF,
Toshihiro Shimizu 890ddd
	COLOR_TRANSF,
Toshihiro Shimizu 890ddd
	COLORCARD_TRANSF,
Toshihiro Shimizu 890ddd
	AFFINE_TRANSF,
Toshihiro Shimizu 890ddd
	SHARPEN_TRANSF,
Toshihiro Shimizu 890ddd
	LOCALBLUR_TRANSF,
Toshihiro Shimizu 890ddd
	LOCALTRANSP_TRANSF,
Toshihiro Shimizu 890ddd
	BODY_SHADOW_TRANSF,
Toshihiro Shimizu 890ddd
	REFLECTION_TRANSF,
Toshihiro Shimizu 890ddd
	CASM_NODE_TYPE_HOW_MANY
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef int CASM_COMPUTE_FUNCTION(CASM_NODE *node,
Toshihiro Shimizu 890ddd
								  int x1, int y1, int x2, int y2,
Toshihiro Shimizu 890ddd
								  float dx, float dy,
Toshihiro Shimizu 890ddd
								  RASTER *raster, CASM_TILE *out);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef void CASM_CE_FUNCTION(float *pars, int cx, int cy,
Toshihiro Shimizu 890ddd
							  RASTER *rin, RASTER *rout, int shrink);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_RENDER_INFO {
Toshihiro Shimizu 890ddd
	float dx, dy;
Toshihiro Shimizu 890ddd
	int shrink;
Toshihiro Shimizu 890ddd
	int frame;
Toshihiro Shimizu 890ddd
	int column;
Toshihiro Shimizu 890ddd
} CASM_RENDER_INFO;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef void CASM_CLC_FUNCTION(float *pars, CASM_RENDER_INFO *info, RASTER *rout);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef int CASM_COMPARE_FUNCTION(CASM_NODE *n1, CASM_NODE *n2);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef void CASM_WRITE_FUNCTION(CASM_NODE *node, T_CHAN fp);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODEPROC {
Toshihiro Shimizu 890ddd
	CASM_COMPUTE_FUNCTION *compute;
Toshihiro Shimizu 890ddd
	CASM_COMPARE_FUNCTION *compare;
Toshihiro Shimizu 890ddd
	CASM_WRITE_FUNCTION *write;
Toshihiro Shimizu 890ddd
	int record_size;
Toshihiro Shimizu 890ddd
} CASM_NODEPROC;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_FRAME {
Toshihiro Shimizu 890ddd
	struct CASM_FRAME *next;
Toshihiro Shimizu 890ddd
	CASM_NODE *node;
Toshihiro Shimizu 890ddd
	char *filename;
Toshihiro Shimizu 890ddd
} CASM_FRAME;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_ADD {
Toshihiro Shimizu 890ddd
	CASM_BINARY_NODE_HD
Toshihiro Shimizu 890ddd
	int diff_values;
Toshihiro Shimizu 890ddd
	float value;
Toshihiro Shimizu 890ddd
	TBOOL is_add, dont_use_matte;
Toshihiro Shimizu 890ddd
} CASM_NODE_ADD;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_LOCALBLUR {
Toshihiro Shimizu 890ddd
	CASM_BINARY_NODE_HD
Toshihiro Shimizu 890ddd
	float value;
Toshihiro Shimizu 890ddd
} CASM_NODE_LOCALBLUR;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_LOCALTRANSP {
Toshihiro Shimizu 890ddd
	CASM_BINARY_NODE_HD
Toshihiro Shimizu 890ddd
	float value;
Toshihiro Shimizu 890ddd
} CASM_NODE_LOCALTRANSP;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_BLUR {
Toshihiro Shimizu 890ddd
	CASM_UNARY_NODE_HD
Toshihiro Shimizu 890ddd
	float blur;
Toshihiro Shimizu 890ddd
	int backlit;
Toshihiro Shimizu 890ddd
} CASM_NODE_BLUR;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_MBLUR {
Toshihiro Shimizu 890ddd
	CASM_UNARY_NODE_HD
Toshihiro Shimizu 890ddd
	double bx;
Toshihiro Shimizu 890ddd
	double by;
Toshihiro Shimizu 890ddd
} CASM_NODE_MBLUR;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_BODY_SHADOW {
Toshihiro Shimizu 890ddd
	CASM_UNARY_NODE_HD
Toshihiro Shimizu 890ddd
	TPOINT p;
Toshihiro Shimizu 890ddd
	int blur;
Toshihiro Shimizu 890ddd
	float transp;
Toshihiro Shimizu 890ddd
	TBOOL is_highlight;
Toshihiro Shimizu 890ddd
} CASM_NODE_BODY_SHADOW;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_REFLECTION {
Toshihiro Shimizu 890ddd
	CASM_UNARY_NODE_HD
Toshihiro Shimizu 890ddd
	float stretch_x;
Toshihiro Shimizu 890ddd
	float stretch_y;
Toshihiro Shimizu 890ddd
	float skew;
Toshihiro Shimizu 890ddd
	float blur_min;
Toshihiro Shimizu 890ddd
	float blur_max;
Toshihiro Shimizu 890ddd
	float transp_min;
Toshihiro Shimizu 890ddd
	float transp_max;
Toshihiro Shimizu 890ddd
	TBOOL is_shadow;
Toshihiro Shimizu 890ddd
} CASM_NODE_REFLECTION;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_SHARPEN {
Toshihiro Shimizu 890ddd
	CASM_UNARY_NODE_HD
Toshihiro Shimizu 890ddd
	int value;
Toshihiro Shimizu 890ddd
} CASM_NODE_SHARPEN;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_PREMULTIPLY {
Toshihiro Shimizu 890ddd
	CASM_UNARY_NODE_HD
Toshihiro Shimizu 890ddd
} CASM_NODE_PREMULTIPLY;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct OLD_USR_IMAGE {
Toshihiro Shimizu 890ddd
	void *buffer;
Toshihiro Shimizu 890ddd
	enum img_type type;
Toshihiro Shimizu 890ddd
	int wrap, lx, ly;
Toshihiro Shimizu 890ddd
	struct {
Toshihiro Shimizu 890ddd
		LPIXEL *buffer;
Toshihiro Shimizu 890ddd
		int offset, size;
Toshihiro Shimizu 890ddd
	} cmap;
Toshihiro Shimizu 890ddd
} OLD_USR_IMAGE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_UDIT {
Toshihiro Shimizu 890ddd
	CASM_N_ARY_NODE_HD
Toshihiro Shimizu 890ddd
	char *keyword;
Toshihiro Shimizu 890ddd
	char *op_name;
Toshihiro Shimizu 890ddd
	char *type;
Toshihiro Shimizu 890ddd
	int argc;
Toshihiro Shimizu 890ddd
	char **argv;
Toshihiro Shimizu 890ddd
	void (*op_function)(OLD_USR_IMAGE *img_in, OLD_USR_IMAGE *img_out, /* only for old udit*/
Toshihiro Shimizu 890ddd
						int argc, char **argv);
Toshihiro Shimizu 890ddd
	int plugin_index;
Toshihiro Shimizu 890ddd
	int fx_index;
Toshihiro Shimizu 890ddd
} CASM_NODE_UDIT;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_MATTE {
Toshihiro Shimizu 890ddd
	CASM_BINARY_NODE_HD
Toshihiro Shimizu 890ddd
	int revert;
Toshihiro Shimizu 890ddd
} CASM_NODE_MATTE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_WARP {
Toshihiro Shimizu 890ddd
	CASM_BINARY_NODE_HD
Toshihiro Shimizu 890ddd
	int grid_step;
Toshihiro Shimizu 890ddd
	float intensity;
Toshihiro Shimizu 890ddd
} CASM_NODE_WARP;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_OVR {
Toshihiro Shimizu 890ddd
	CASM_BINARY_NODE_HD
Toshihiro Shimizu 890ddd
} CASM_NODE_OVR;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_BACKLIT {
Toshihiro Shimizu 890ddd
	CASM_BINARY_NODE_HD
Toshihiro Shimizu 890ddd
	int diff_values;
Toshihiro Shimizu 890ddd
	float value;
Toshihiro Shimizu 890ddd
} CASM_NODE_BACKLIT;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_READ {
Toshihiro Shimizu 890ddd
	CASM_NODE_HD
Toshihiro Shimizu 890ddd
	char *filename;
Toshihiro Shimizu 890ddd
	char *cmapname;
Toshihiro Shimizu 890ddd
	char *op_name;
Toshihiro Shimizu 890ddd
	int *no_ink, *no_paint;
Toshihiro Shimizu 890ddd
	TBOOL keep_inks, keep_paints;
Toshihiro Shimizu 890ddd
	int premultiply;
Toshihiro Shimizu 890ddd
	int out_size;
Toshihiro Shimizu 890ddd
	int argc;
Toshihiro Shimizu 890ddd
	char **argv;
Toshihiro Shimizu 890ddd
	void (*op_function)(OLD_USR_IMAGE *img_in,
Toshihiro Shimizu 890ddd
						OLD_USR_IMAGE *img_out,
Toshihiro Shimizu 890ddd
						int argc, char **argv);
Toshihiro Shimizu 890ddd
	enum img_type type;
Toshihiro Shimizu 890ddd
	int xsize, ysize, border;
Toshihiro Shimizu 890ddd
	int sbx1, sby1, sbx2, sby2;
Toshihiro Shimizu 890ddd
	double h_pos;
Toshihiro Shimizu 890ddd
	UCHAR patch;
Toshihiro Shimizu 890ddd
	CASM_WINDOW *bg_info;
Toshihiro Shimizu 890ddd
	int occurrence;
Toshihiro Shimizu 890ddd
	int full_read;
Toshihiro Shimizu 890ddd
} CASM_NODE_READ;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_COLOR {
Toshihiro Shimizu 890ddd
	CASM_UNARY_NODE_HD
Toshihiro Shimizu 890ddd
	char *keyword;
Toshihiro Shimizu 890ddd
	int plugin_index;
Toshihiro Shimizu 890ddd
	int fx_index;
Toshihiro Shimizu 890ddd
	int num_pars;
Toshihiro Shimizu 890ddd
	float *pars;
Toshihiro Shimizu 890ddd
} CASM_NODE_COLOR;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_COLORCARD {
Toshihiro Shimizu 890ddd
	CASM_NODE_HD
Toshihiro Shimizu 890ddd
	char *keyword;
Toshihiro Shimizu 890ddd
	int plugin_index;
Toshihiro Shimizu 890ddd
	int fx_index;
Toshihiro Shimizu 890ddd
	int num_pars;
Toshihiro Shimizu 890ddd
	float *pars;
Toshihiro Shimizu 890ddd
} CASM_NODE_COLORCARD;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_AFFINE {
Toshihiro Shimizu 890ddd
	CASM_UNARY_NODE_HD
Toshihiro Shimizu 890ddd
	AFFINE aff;
Toshihiro Shimizu 890ddd
	enum CASM_RESAMPLE_TYPE resample_type;
Toshihiro Shimizu 890ddd
} CASM_NODE_AFFINE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_S_FLIP {
Toshihiro Shimizu 890ddd
	CASM_UNARY_NODE_HD
Toshihiro Shimizu 890ddd
	double c;
Toshihiro Shimizu 890ddd
} CASM_NODE_S_FLIP;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_EXTOP {
Toshihiro Shimizu 890ddd
	CASM_UNARY_NODE_HD
Toshihiro Shimizu 890ddd
	char *op_filename, *format_in, *format_out, *arguments;
Toshihiro Shimizu 890ddd
} CASM_NODE_EXTOP;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_NO_INK {
Toshihiro Shimizu 890ddd
	CASM_UNARY_NODE_HD
Toshihiro Shimizu 890ddd
	int which_ink;
Toshihiro Shimizu 890ddd
} CASM_NODE_NO_INK;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_UNARY {
Toshihiro Shimizu 890ddd
	CASM_UNARY_NODE_HD
Toshihiro Shimizu 890ddd
} CASM_NODE_UNARY;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_BINARY {
Toshihiro Shimizu 890ddd
	CASM_BINARY_NODE_HD
Toshihiro Shimizu 890ddd
} CASM_NODE_BINARY;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_N_ARY {
Toshihiro Shimizu 890ddd
	CASM_N_ARY_NODE_HD
Toshihiro Shimizu 890ddd
} CASM_NODE_N_ARY;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif