23 #ifndef _LAX_PATCHINTERFACE_H
24 #define _LAX_PATCHINTERFACE_H
26 #include <lax/interfaces/aninterface.h>
27 #include <lax/interfaces/somedata.h>
28 #include <lax/interfaces/linestyle.h>
29 #include <lax/screencolor.h>
34 namespace LaxInterfaces {
36 typedef enum _PatchControls {
46 void getPolyT(
double *N,
double n,
double t0);
48 void printG(
const char *ch,
double *G);
49 void getScaledI(
double *I,
double a,
double b,
double c,
double d);
51 void m_times_m(
double *a,
double *b,
double *m);
52 void m_times_v(
double *m,
double *b,
double *v);
53 double dot(
double *a,
double *b);
54 void getT(
double *v,
double t) ;
65 unsigned char *buffer;
66 int bufferwidth,bufferheight;
76 #define PATCH_SMOOTH (1<<0)
89 PatchControls controls;
93 PatchData(
double xx,
double yy,
double ww,
double hh,
int nr,
int nc,
unsigned int stle);
95 virtual const char *whattype() {
return "PatchData"; }
108 virtual void resolveToSubpatch(
double s,
double t,
int &c,
double &ss,
int &r,
double &tt);
110 virtual void getGt(
double *G,
int roffset,
int coffset,
int isfory);
111 virtual int inSubPatch(
flatpoint p,
int *r_ret,
int *c_ret,
double *t_ret,
double *s_ret,
double d);
118 virtual void Set(
double xx,
double yy,
double ww,
double hh,
int nr,
int nc,
unsigned int stle);
121 virtual int subdivide(
int r,
double rt,
int c,
double ct);
122 virtual int subdivide(
int xn=2,
int yn=2);
123 virtual void grow(
int where,
double *tr);
124 virtual void collapse(
int rr,
int cc);
132 virtual int renderToBuffer(
unsigned char *buffer,
int bufw,
int bufh,
int bufstride,
int bufdepth,
int bufchannels);
135 double s1,
double t1,
double s2,
double t2,
int which);
147 enum PatchInterfaceActions {
162 PATCHA_SubdivideRows,
163 PATCHA_SubdivideCols,
167 PATCHA_SelectCorners,
169 PATCHA_SelectEdgeMids,
170 PATCHA_SelectVerticalEdgeMids,
171 PATCHA_SelectHorizontalEdgeMids,
172 PATCHA_SelectAllVertically,
173 PATCHA_SelectMoreVertically,
174 PATCHA_SelectAllHorizontally,
175 PATCHA_SelectMoreHorizontally,
183 double movetransform[6];
187 double cutatct, cutatrt;
192 int bx,by,mx,my,constrain;
194 void getG(
double *G,
int roffset,
int coffset,
int isfory);
203 virtual int PerformAction(
int action);
206 enum PatchDecorations {
217 unsigned long rimcolor,handlecolor,gridcolor;
218 int xs,ys, rdiv,cdiv;
219 unsigned long controlcolor;
231 virtual const char *IconId() {
return "Patch"; }
232 virtual const char *Name();
233 virtual const char *whattype() {
return "PatchInterface"; }
234 virtual const char *whatdatatype() {
return "PatchData"; }
236 virtual int UseThisObject(ObjectContext *oc);
238 virtual int UseThis(
int id,
int ndata);
239 virtual void Clear(SomeData *d=NULL);
240 virtual int InterfaceOn();
242 virtual ObjectContext *Context() {
return poc; }
243 virtual int LBDown(
int x,
int y,
unsigned int state,
int count,
const Laxkit::LaxMouse *d);
249 virtual void drawpatch(
int roff,
int coff);
254 virtual PatchData *
newPatchData(
double xx,
double yy,
double ww,
double hh,
int nr,
int nc,
unsigned int stle);
256 virtual int scan(
int x,
int y);