Shinya Kitaoka 810553
#pragma once
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
Shinya Kitaoka 120a6e
#define CASM_NODE_HD                                                           \
Shinya Kitaoka 120a6e
  struct CASM_NODEPROC *proc;                                                  \
Shinya Kitaoka 120a6e
  char bg_flag, bad_branch;                                                    \
Shinya Kitaoka 120a6e
  ULONG mask;                                                                  \
Shinya Kitaoka 120a6e
  int label;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define CASM_UNARY_NODE_HD                                                     \
Shinya Kitaoka 120a6e
  CASM_NODE_HD                                                                 \
Shinya Kitaoka 120a6e
  CASM_NODE *arg;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define CASM_BINARY_NODE_HD                                                    \
Shinya Kitaoka 120a6e
  CASM_NODE_HD                                                                 \
Shinya Kitaoka 120a6e
  CASM_NODE *arg_dn, *arg_up;                                                  \
Shinya Kitaoka 120a6e
  int marker_dn, marker_up;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define CASM_N_ARY_NODE_HD                                                     \
Shinya Kitaoka 120a6e
  CASM_NODE_HD                                                                 \
Shinya Kitaoka 120a6e
  int num_args;                                                                \
Shinya Kitaoka 120a6e
  CASM_NODE **args;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
typedef struct CASM_NODE { CASM_NODE_HD } CASM_NODE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_TILE {
Shinya Kitaoka 120a6e
  RASTER r;
Shinya Kitaoka 120a6e
  int x1, y1, x2, y2;
Toshihiro Shimizu 890ddd
} CASM_TILE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODESIZE {
Shinya Kitaoka 120a6e
  float x1, y1, x2, y2;
Shinya Kitaoka 120a6e
  float sbx1, sby1, sbx2, sby2;
Toshihiro Shimizu 890ddd
} CASM_NODESIZE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct USR_IMAGE {
Shinya Kitaoka 120a6e
  void *buffer;
Shinya Kitaoka 120a6e
  enum img_type type;
Shinya Kitaoka 120a6e
  int wrap, lx, ly;
Shinya Kitaoka 120a6e
  struct {
Shinya Kitaoka 120a6e
    LPIXEL *buffer;
Shinya Kitaoka 120a6e
    int offset, size;
Shinya Kitaoka 120a6e
  } cmap;
Toshihiro Shimizu 890ddd
} USR_IMAGE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
enum CASM_NODE_TYPE {
Shinya Kitaoka 120a6e
  OVR_TRANSF = 0,
Shinya Kitaoka 120a6e
  ADD_TRANSF,
Shinya Kitaoka 120a6e
  BACKLIT_TRANSF,
Shinya Kitaoka 120a6e
  MATTE_TRANSF,
Shinya Kitaoka 120a6e
  WARP_TRANSF,
Shinya Kitaoka 120a6e
  BLUR_TRANSF,
Shinya Kitaoka 120a6e
  MBLUR_TRANSF,
Shinya Kitaoka 120a6e
  UDIT_TRANSF,
Shinya Kitaoka 120a6e
  READ_TRANSF,
Shinya Kitaoka 120a6e
  FLIPX_TRANSF,
Shinya Kitaoka 120a6e
  FLIPY_TRANSF,
Shinya Kitaoka 120a6e
  EXTOP_TRANSF,
Shinya Kitaoka 120a6e
  COLOR_TRANSF,
Shinya Kitaoka 120a6e
  COLORCARD_TRANSF,
Shinya Kitaoka 120a6e
  AFFINE_TRANSF,
Shinya Kitaoka 120a6e
  SHARPEN_TRANSF,
Shinya Kitaoka 120a6e
  LOCALBLUR_TRANSF,
Shinya Kitaoka 120a6e
  LOCALTRANSP_TRANSF,
Shinya Kitaoka 120a6e
  BODY_SHADOW_TRANSF,
Shinya Kitaoka 120a6e
  REFLECTION_TRANSF,
Shinya Kitaoka 120a6e
  CASM_NODE_TYPE_HOW_MANY
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
typedef int CASM_COMPUTE_FUNCTION(CASM_NODE *node, int x1, int y1, int x2,
Shinya Kitaoka 120a6e
                                  int y2, float dx, float dy, RASTER *raster,
Shinya Kitaoka 120a6e
                                  CASM_TILE *out);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
typedef void CASM_CE_FUNCTION(float *pars, int cx, int cy, RASTER *rin,
Shinya Kitaoka 120a6e
                              RASTER *rout, int shrink);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_RENDER_INFO {
Shinya Kitaoka 120a6e
  float dx, dy;
Shinya Kitaoka 120a6e
  int shrink;
Shinya Kitaoka 120a6e
  int frame;
Shinya Kitaoka 120a6e
  int column;
Toshihiro Shimizu 890ddd
} CASM_RENDER_INFO;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
typedef void CASM_CLC_FUNCTION(float *pars, CASM_RENDER_INFO *info,
Shinya Kitaoka 120a6e
                               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 {
Shinya Kitaoka 120a6e
  CASM_COMPUTE_FUNCTION *compute;
Shinya Kitaoka 120a6e
  CASM_COMPARE_FUNCTION *compare;
Shinya Kitaoka 120a6e
  CASM_WRITE_FUNCTION *write;
Shinya Kitaoka 120a6e
  int record_size;
Toshihiro Shimizu 890ddd
} CASM_NODEPROC;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_FRAME {
Shinya Kitaoka 120a6e
  struct CASM_FRAME *next;
Shinya Kitaoka 120a6e
  CASM_NODE *node;
Shinya Kitaoka 120a6e
  char *filename;
Toshihiro Shimizu 890ddd
} CASM_FRAME;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_ADD {
Shinya Kitaoka 120a6e
  CASM_BINARY_NODE_HD
Shinya Kitaoka 120a6e
  int diff_values;
Shinya Kitaoka 120a6e
  float value;
Shinya Kitaoka 120a6e
  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 {
Shinya Kitaoka 120a6e
  CASM_BINARY_NODE_HD
Shinya Kitaoka 120a6e
  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 {
Shinya Kitaoka 120a6e
  CASM_BINARY_NODE_HD
Shinya Kitaoka 120a6e
  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 {
Shinya Kitaoka 120a6e
  CASM_UNARY_NODE_HD
Shinya Kitaoka 120a6e
  float blur;
Shinya Kitaoka 120a6e
  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 {
Shinya Kitaoka 120a6e
  CASM_UNARY_NODE_HD
Shinya Kitaoka 120a6e
  double bx;
Shinya Kitaoka 120a6e
  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 {
Shinya Kitaoka 120a6e
  CASM_UNARY_NODE_HD
Shinya Kitaoka 120a6e
  TPOINT p;
Shinya Kitaoka 120a6e
  int blur;
Shinya Kitaoka 120a6e
  float transp;
Shinya Kitaoka 120a6e
  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 {
Shinya Kitaoka 120a6e
  CASM_UNARY_NODE_HD
Shinya Kitaoka 120a6e
  float stretch_x;
Shinya Kitaoka 120a6e
  float stretch_y;
Shinya Kitaoka 120a6e
  float skew;
Shinya Kitaoka 120a6e
  float blur_min;
Shinya Kitaoka 120a6e
  float blur_max;
Shinya Kitaoka 120a6e
  float transp_min;
Shinya Kitaoka 120a6e
  float transp_max;
Shinya Kitaoka 120a6e
  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 {
Shinya Kitaoka 120a6e
  CASM_UNARY_NODE_HD
Shinya Kitaoka 120a6e
  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 {
Shinya Kitaoka 120a6e
  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 {
Shinya Kitaoka 120a6e
  void *buffer;
Shinya Kitaoka 120a6e
  enum img_type type;
Shinya Kitaoka 120a6e
  int wrap, lx, ly;
Shinya Kitaoka 120a6e
  struct {
Shinya Kitaoka 120a6e
    LPIXEL *buffer;
Shinya Kitaoka 120a6e
    int offset, size;
Shinya Kitaoka 120a6e
  } cmap;
Toshihiro Shimizu 890ddd
} OLD_USR_IMAGE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_UDIT {
Shinya Kitaoka 120a6e
  CASM_N_ARY_NODE_HD
Shinya Kitaoka 120a6e
  char *keyword;
Shinya Kitaoka 120a6e
  char *op_name;
Shinya Kitaoka 120a6e
  char *type;
Shinya Kitaoka 120a6e
  int argc;
Shinya Kitaoka 120a6e
  char **argv;
Shinya Kitaoka 120a6e
  void (*op_function)(OLD_USR_IMAGE *img_in,
Shinya Kitaoka 120a6e
                      OLD_USR_IMAGE *img_out, /* only for old udit*/
Shinya Kitaoka 120a6e
                      int argc, char **argv);
Shinya Kitaoka 120a6e
  int plugin_index;
Shinya Kitaoka 120a6e
  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 {
Shinya Kitaoka 120a6e
  CASM_BINARY_NODE_HD
Shinya Kitaoka 120a6e
  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 {
Shinya Kitaoka 120a6e
  CASM_BINARY_NODE_HD
Shinya Kitaoka 120a6e
  int grid_step;
Shinya Kitaoka 120a6e
  float intensity;
Toshihiro Shimizu 890ddd
} CASM_NODE_WARP;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
typedef struct CASM_NODE_OVR { CASM_BINARY_NODE_HD } CASM_NODE_OVR;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_BACKLIT {
Shinya Kitaoka 120a6e
  CASM_BINARY_NODE_HD
Shinya Kitaoka 120a6e
  int diff_values;
Shinya Kitaoka 120a6e
  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 {
Shinya Kitaoka 120a6e
  CASM_NODE_HD
Shinya Kitaoka 120a6e
  char *filename;
Shinya Kitaoka 120a6e
  char *cmapname;
Shinya Kitaoka 120a6e
  char *op_name;
Shinya Kitaoka 120a6e
  int *no_ink, *no_paint;
Shinya Kitaoka 120a6e
  TBOOL keep_inks, keep_paints;
Shinya Kitaoka 120a6e
  int premultiply;
Shinya Kitaoka 120a6e
  int out_size;
Shinya Kitaoka 120a6e
  int argc;
Shinya Kitaoka 120a6e
  char **argv;
Shinya Kitaoka 120a6e
  void (*op_function)(OLD_USR_IMAGE *img_in, OLD_USR_IMAGE *img_out, int argc,
Shinya Kitaoka 120a6e
                      char **argv);
Shinya Kitaoka 120a6e
  enum img_type type;
Shinya Kitaoka 120a6e
  int xsize, ysize, border;
Shinya Kitaoka 120a6e
  int sbx1, sby1, sbx2, sby2;
Shinya Kitaoka 120a6e
  double h_pos;
Shinya Kitaoka 120a6e
  UCHAR patch;
Shinya Kitaoka 120a6e
  CASM_WINDOW *bg_info;
Shinya Kitaoka 120a6e
  int occurrence;
Shinya Kitaoka 120a6e
  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 {
Shinya Kitaoka 120a6e
  CASM_UNARY_NODE_HD
Shinya Kitaoka 120a6e
  char *keyword;
Shinya Kitaoka 120a6e
  int plugin_index;
Shinya Kitaoka 120a6e
  int fx_index;
Shinya Kitaoka 120a6e
  int num_pars;
Shinya Kitaoka 120a6e
  float *pars;
Toshihiro Shimizu 890ddd
} CASM_NODE_COLOR;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
typedef struct CASM_NODE_COLORCARD {
Shinya Kitaoka 120a6e
  CASM_NODE_HD
Shinya Kitaoka 120a6e
  char *keyword;
Shinya Kitaoka 120a6e
  int plugin_index;
Shinya Kitaoka 120a6e
  int fx_index;
Shinya Kitaoka 120a6e
  int num_pars;
Shinya Kitaoka 120a6e
  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 {
Shinya Kitaoka 120a6e
  CASM_UNARY_NODE_HD
Shinya Kitaoka 120a6e
  AFFINE aff;
Shinya Kitaoka 120a6e
  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 {
Shinya Kitaoka 120a6e
  CASM_UNARY_NODE_HD
Shinya Kitaoka 120a6e
  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 {
Shinya Kitaoka 120a6e
  CASM_UNARY_NODE_HD
Shinya Kitaoka 120a6e
  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 {
Shinya Kitaoka 120a6e
  CASM_UNARY_NODE_HD
Shinya Kitaoka 120a6e
  int which_ink;
Toshihiro Shimizu 890ddd
} CASM_NODE_NO_INK;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
typedef struct CASM_NODE_UNARY { CASM_UNARY_NODE_HD } CASM_NODE_UNARY;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
typedef struct CASM_NODE_BINARY { CASM_BINARY_NODE_HD } CASM_NODE_BINARY;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
typedef struct CASM_NODE_N_ARY { CASM_N_ARY_NODE_HD } CASM_NODE_N_ARY;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*----------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif