Laxkit  0.0.7.1
imagepatchinterface.h
1 //
2 //
3 // The Laxkit, a windowing toolkit
4 // Please consult http://laxkit.sourceforge.net about where to send any
5 // correspondence about this software.
6 //
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Library General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Library General Public License for more details.
16 //
17 // You should have received a copy of the GNU Library General Public
18 // License along with this library; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 //
21 // Copyright (C) 2004-2011 by Tom Lechner
22 //
23 #ifndef _LAX_IMAGEPATCHINTERFACE_H
24 #define _LAX_IMAGEPATCHINTERFACE_H
25 
26 #include <lax/interfaces/patchinterface.h>
27 #include <lax/screencolor.h>
28 
29 namespace LaxInterfaces {
30 
31 
32 //------------------------------------- ImagePatchData ------------------------
33 class ImagePatchData : public PatchData
34 {
35  protected:
36 
37  public:
38  char *filename;
39 
40  unsigned long *idata; //array of screen ready color
41  double im[6];
44 
45  ImagePatchData(int iwidth, int iheight, unsigned long *ndata,int disl,
46  double nscale,unsigned int stle);
47  //ImagePatchData(double xx,double yy,double ww,double hh,int nr,int nc,unsigned int stle);
48  ImagePatchData(const char *file=NULL);
49  virtual ~ImagePatchData();
50  virtual const char *whattype() { return "ImagePatchData"; }
51  virtual SomeData *duplicate(SomeData *dup);
52  virtual void dump_out(FILE *f,int indent,int what,Laxkit::anObject *context);
53  virtual void dump_in_atts(LaxFiles::Attribute *att,int flag,Laxkit::anObject *context);
54 
55  virtual unsigned long WhatColorLong(double s,double t);
56  virtual int WhatColor(double s,double t,Laxkit::ScreenColor *color_ret);
57  virtual int hasColorData();
58 
59  virtual void zap(); // zap to image
60  virtual int SetImage(const char *fname);
61 
62 };
63 
64 
65 //------------------------------ ImagePatchInterface -------------------------------
66 
67 #define IMGPATCHI_POPUP_INFO 1
68 
70 {
71  protected:
72  ImagePatchData *ipdata;
73  virtual void runImageDialog();
74  virtual int PerformAction(int action);
75  public:
77  virtual ~ImagePatchInterface();
78  virtual Laxkit::ShortcutHandler *GetShortcuts();
79  virtual const char *IconId() { return "ImagePatch"; }
80  virtual const char *Name();
81  virtual const char *whattype() { return "ImagePatchInterface"; }
82  virtual const char *whatdatatype() { return "ImagePatchData"; }
83  virtual anInterface *duplicate(anInterface *dup);
84  virtual int UseThisObject(ObjectContext *oc);
85  virtual int UseThis(anObject *newdata,unsigned int mask=0);
86  virtual int UseThis(int id,int ndata);
87  virtual int DrawData(anObject *ndata,anObject *a1=NULL,anObject *a2=NULL,int info=0);
88  virtual int LBDown(int x,int y,unsigned int state,int count,const Laxkit::LaxMouse *d);
89  virtual int CharInput(unsigned int ch,const char *buffer,int len,unsigned int state,const Laxkit::LaxKeyboard *d);
90 
91  virtual PatchData *newPatchData(double xx,double yy,double ww,double hh,int nr,int nc,unsigned int stle);
92  virtual void drawpatch(int roff,int coff);
93  virtual void patchpoint(PatchRenderContext *context, double s0,double ds,double t0,double dt,int n);
94 };
95 
96 } //namespace LaxInterfaces
97 
98 #endif
99 
100 

Mon Feb 17 2014 11:52:56, Laxkit