20130313
[gdash.git] / src / gtk / gtkpixbuf.hpp
blobb4d19539c90ec73adcd23865646eba7ea1cccbdb
1 /*
2 * Copyright (c) 2007-2013, Czirkos Zoltan http://code.google.com/p/gdash/
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 #ifndef _GD_GTKPIXBUF
17 #define _GD_GTKPIXBUF
19 #include "config.h"
21 #include <gtk/gtk.h>
22 #include "gfx/pixbuf.hpp"
24 /**
25 * Implementation of the Pixbuf interface, using GDK-pixbuf
27 class GTKPixbuf: public Pixbuf {
28 private:
29 GdkPixbuf *pixbuf;
31 GTKPixbuf(const GTKPixbuf&); // copy ctor not implemented
32 GTKPixbuf& operator=(const GTKPixbuf&); // operator= not implemented
33 public:
34 GTKPixbuf(int length, unsigned char const *data);
35 GTKPixbuf(const char *filename);
36 GTKPixbuf(int w, int h);
37 GTKPixbuf(GdkPixbuf *pb);
39 virtual int get_width() const;
40 virtual int get_height() const;
41 virtual void blit_full(int x, int y, int w, int h, Pixbuf &dest, int dx, int dy) const;
42 virtual void copy_full(int x, int y, int w, int h, Pixbuf &dest, int dx, int dy) const;
44 virtual bool has_alpha() const;
45 virtual void fill_rect(int x, int y, int w, int h, const GdColor& c);
47 virtual unsigned char *get_pixels() const;
48 virtual int get_pitch() const;
50 /**
51 * Return the GdkPixbuf* associated with the object.
53 GdkPixbuf *get_gdk_pixbuf() { return pixbuf; }
54 /**
55 * Return the GdkPixbuf* associated with the object.
57 GdkPixbuf const *get_gdk_pixbuf() const { return pixbuf; }
59 virtual ~GTKPixbuf();
61 #endif