/**** * * Copyright (c) 1988 by Sun Microsystems, Inc. * @(#)sh_BASIS.h 5.10 88/08/13 Copyright 1988 Sun Micro * * BASIS.H - Curve basis information for user level code * (needed by shapes.h). The user does not actually know what * the BASIS object looks like. It can only be accessed via * the Xxx_Basis functions. For more detailed internal information, * see basis_int.h. * ****/ #ifndef _BASIS #include "sh_PATH.h" #define BASIS_MAX_ORDER 4 /* * Basis attributes */ typedef enum { BASIS_TYPE, /* basis type (CURVE, SURFACE) */ BASIS_FORM, /* basis form (BEZIER, BSPLINE) */ BASIS_ORDER, /* curve order */ BASIS_S_ORDER, /* S surface order */ BASIS_T_ORDER, /* T surface order */ BASIS_DIM, /* basis surface dimensions */ } BASIS_attr; #define BASIS_ATTRS ((int) BASIS_DIM) /* * Basis types */ typedef enum { BASIS_CURVE, /* curve basis */ BASIS_SURFACE, /* surface basis */ } BASIS_type; /* * Basis forms */ #define BASIS_form PATH_curve_form #define BASIS_BSPLINE PATH_CURVE_BSPLINE #define BASIS_BEZIER PATH_CURVE_BEZIER #define BASIS_OP_Destroy 0 #define BASIS_OP_Init 1 #define BASIS_OP_Get 2 #define BASIS_OP_Set 3 #define BASIS_OP_Print 4 #define BASIS_OP_Mul 5 #define BASIS_OP_Copy 6 #define BASIS_OP_Apply 7 #define BASIS_OPERS 8 /* * BASIS Create_Basis(t, f) create BASIS object * Destroy_Basis(b) destroy basis * Get_Basis(b, attr) get basis attribute * Set_Basis(b, attr, val) set basis attribute * Print_Basis(b) print basis * Copy_Basis(b1, b2) copy basis * Mul_Basis(b, src, dst) multiply control points by basis */ #define Create_Basis(t, f) ((BASIS) Create_Obj(CLASS_BASIS, t, f)) #define Temp_Basis(t, f) ((BASIS) Temp_Obj(CLASS_BASIS, t, f)) #define Destroy_Basis Destroy_Obj #define Static_Basis sh_Static_Basis #define Print_Basis(b) ((void) (*GetOper_Obj(b, BASIS_OP_Print))(b)) #define Copy_Basis(b1,b2) ((void) (*GetOper_Obj(b1, BASIS_OP_Copy))(b1,b2)) #define Mul_Basis(b,p1,p2) ((void) (*GetOper_Obj(b, BASIS_OP_Mul))(b,p1,p2)) #define Apply_Basis(b,c) (*GetOper_Obj(b, BASIS_OP_Apply))(b,c) extern BASIS sh_Static_Basis(); /* * BASIS Object Data Structure */ typedef struct class_BASIS { #include "sh_BASIS.ah" }; #define bs_T_ORDER bs_ORDER #define BASIS_CHANGED 1 /* * Get_Basis(basis, attr) * Fast way to access basis attributes. * This macro depends on the "attr" argument being a compile time constant. */ #define Get_Basis(b,a) CAT(a,get)((BASIS) (b)) #define Set_Basis(b,a,v)CAT(a,set)((BASIS) (b), v) #define BASIS_TYPEget(b) ((b)->BASIS_TYPE) #define BASIS_FORMget(b) ((b)->BASIS_FORM) #define BASIS_ORDERget(b) ((b)->BASIS_ORDER) #define BASIS_S_ORDERget(b) ((b)->BASIS_S_ORDER) #define BASIS_T_ORDERget(b) ((b)->BASIS_ORDER) #define BASIS_DIMget(b) ((b)->BASIS_DIM) #define BASIS_FORMset(b,v) ((b)->BASIS_FORM = (v)) #define BASIS_ORDERset(b,v) ((b)->BASIS_ORDER = (v)) #define _BASIS #endif