Laxkit  0.0.7.1
laximages.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-2010 by Tom Lechner
22 //
23 #ifndef _LAX_LAXIMAGES_H
24 #define _LAX_LAXIMAGES_H
25 
26 #include <lax/anobject.h>
27 #include <sys/times.h>
28 
29 #define LAX_IMAGE_NULL 0
30 #define LAX_IMAGE_BUFFER 1
31 #define LAX_IMAGE_XIMAGE 2
32 #define LAX_IMAGE_PIXMAP 3
33 #define LAX_IMAGE_IMLIB 4
34 #define LAX_IMAGE_CAIRO 5
35 #define LAX_IMAGE_ANTIGRAIN 6
36 #define LAX_IMAGE_GL 7
37 #define LAX_IMAGE_FIRST_USER_TYPE 1000
38 
39 #define LAX_IMAGE_METRICS (1<<0)
40 #define LAX_IMAGE_PREVIEW (1<<1)
41 #define LAX_IMAGE_WHOLE (1<<2)
42 #define LAX_IMAGE_HAS_FILE (1<<3)
43 #define LAX_IMAGE_HAS_PREVIEW (1<<4)
44 
45 namespace Laxkit {
46 
47 
48 class aDrawable;
49 
50 
51 //--------------------------- LaxImage --------------------------------------
52 class LaxImage : public anObject
53 {
54  public:
55  char delpreview;
56  char *filename;
57  char *previewfile;
58  clock_t lastaccesstime;
59  LaxImage(const char *fname);
60  virtual ~LaxImage();
61  virtual int imagetype()=0;
62  virtual unsigned int imagestate()=0;
63  virtual void doneForNow() {}
64  virtual int w()=0;
65  virtual int h()=0;
66  virtual int dataw()=0;
67  virtual int datah()=0;
68  virtual void clear()=0;
69 
70  virtual unsigned char *getImageBuffer() = 0;
71  virtual int doneWithBuffer(unsigned char *buffer) = 0;
72 
73  //virtual int MaxMemoryUsed();
74  //virtual int dec_count();
75 };
76 
77 
78 //--------------------------- LaxImage utils --------------------------------------
79 
81 extern DefaultImageTypeFunc default_image_type;
82 
83 //---------------- image_out_*
84 
85 typedef void (*ImageOutFunc)(LaxImage *image, aDrawable *win, int ulx, int uly);
86 typedef void (*ImageOutRotatedFunc)(LaxImage *image, aDrawable *win, int ulx,int uly, int urx,int ury);
87 typedef void (*ImageOutSkewedFunc)(LaxImage *image, aDrawable *win, int ulx,int uly, int urx,int ury, int llx, int lly);
88 typedef void (*ImageOutMatrixFunc)(LaxImage *image, aDrawable *win, double *m);
89 
90 extern ImageOutFunc image_out;
94 
95 
96 //---------------- base preview creation
97 typedef int (*GeneratePreviewFunc)(const char *original_file,
98  const char *to_preview_file,
99  const char *format,int width, int height, int fit);
100 extern GeneratePreviewFunc generate_preview_image;
101 
102 
103 //---------------- load_image
104 
105 typedef LaxImage *(*CreateNewImageFunc)(int w, int h);
106 typedef LaxImage *(*ImageFromBufferFunc)(unsigned char *buffer, int w, int h, int stride);
107 typedef LaxImage *(*LoadImageFunc)(const char *filename);
108 typedef LaxImage *(*LoadImageWithPreviewFunc)(const char *filename,const char *previewfile,
109  int maxx,int maxy,char delpreview);
110 
111 extern CreateNewImageFunc create_new_image;
112 extern ImageFromBufferFunc image_from_buffer;
114 extern LoadImageWithPreviewFunc load_image_with_preview;
115 
116 
117 
118 } //namespace Laxkit
119 
120 #endif
121 

Mon Feb 17 2014 11:52:56, Laxkit