Laxkit  0.0.7.1
laximages-imlib.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) 2010 by Tom Lechner
22 //
23 
24 #ifndef _LAX_LAXIMAGES_IMLIB_H
25 #define _LAX_LAXIMAGES_IMLIB_H
26 
27 #include <lax/laximages.h>
28 #include <Imlib2.h>
29 
30 namespace Laxkit {
31 
32 //--------------------------- LaxImlibImage --------------------------------------
33 class LaxImlibImage : public LaxImage
34 {
35  protected:
37  public:
38  Imlib_Image image;
41  LaxImlibImage(const char *fname,Imlib_Image img=0,const char *npreviewfile=NULL,
42  int maxx=0,int maxy=0,char del=0);
43  virtual ~LaxImlibImage();
44  virtual Imlib_Image Image(int which=0);
45  virtual void doneForNow();
46  virtual unsigned int imagestate();
47  virtual int imagetype() { return LAX_IMAGE_IMLIB; }
48  virtual int w() { return width; }
49  virtual int h() { return height; }
50  virtual int dataw() { return dwidth; } //often smaller image used for preview purposes..
51  virtual int datah() { return dheight; }
52  virtual void clear();
53 
54  virtual unsigned char *getImageBuffer();
55  virtual int doneWithBuffer(unsigned char *buffer);
56 };
57 
58 
59 //----------------- LaxImlibImage utils
60 
61  //-----extra utility functions
62 void laximlib_usealpha(int yes);
63 void laximlib_update_alpha(int alpha);
64 void laximlib_alternate_drawable(Drawable drawable);
65 
66  //----------default image function replacements
68 
69 void laximlib_image_out(LaxImage *image, aDrawable *win, int ulx, int uly);
70 void laximlib_image_out_rotated(LaxImage *image, aDrawable *win, int ulx,int uly, int urx,int ury);
71 void laximlib_image_out_skewed(LaxImage *image, aDrawable *win, int ulx,int uly, int urx,int ury, int llx, int lly);
72 void laximlib_image_out_matrix(LaxImage *image, aDrawable *win, double *m);
73 LaxImage *load_imlib_image(const char *filename);
74 LaxImage *load_imlib_image_with_preview(const char *filename,const char *previewfile,int maxx,int maxy,char del);
75 int laximlib_generate_preview(const char *original_file, const char *to_preview_file, const char *format,int maxw, int maxh, int fit);
76 LaxImage *image_from_buffer_imlib(unsigned char *buffer, int w, int h, int stride);
77 LaxImage *create_new_imlib_image(int w, int h);
78 
79 } //namespace Laxkit
80 
81 #endif
82 

Mon Feb 17 2014 11:52:56, Laxkit