README.md edited online with Bitbucket
[gdash.git] / src / gtk / gtkpixbuf.hpp
blob8f4b91600d694cc36d79774848838999c927f8bf
1 /*
2 * Copyright (c) 2007-2013, Czirkos Zoltan http://code.google.com/p/gdash/
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
19 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
20 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 #ifndef GTKPIXBUF_HPP_INCLUDED
24 #define GTKPIXBUF_HPP_INCLUDED
26 #include "config.h"
28 #include <gtk/gtk.h>
29 #include "gfx/pixbuf.hpp"
31 /**
32 * Implementation of the Pixbuf interface, using GDK-pixbuf
34 class GTKPixbuf: public Pixbuf {
35 private:
36 GdkPixbuf *pixbuf;
38 GTKPixbuf(const GTKPixbuf &); // copy ctor not implemented
39 GTKPixbuf &operator=(const GTKPixbuf &); // operator= not implemented
41 public:
42 /** This constructor adopts the pixbuf. it does not increase ref count! */
43 explicit GTKPixbuf(GdkPixbuf *pb);
44 GTKPixbuf(int w, int h);
45 virtual ~GTKPixbuf();
47 virtual int get_width() const;
48 virtual int get_height() const;
49 virtual void blit_full(int x, int y, int w, int h, Pixbuf &dest, int dx, int dy) const;
50 virtual void copy_full(int x, int y, int w, int h, Pixbuf &dest, int dx, int dy) const;
51 virtual void fill_rect(int x, int y, int w, int h, const GdColor &c);
53 virtual unsigned char *get_pixels() const;
54 virtual int get_pitch() const;
56 /** Return the GdkPixbuf* associated with the object. */
57 GdkPixbuf *get_gdk_pixbuf() {
58 return pixbuf;
60 /** Return the GdkPixbuf* associated with the object. */
61 GdkPixbuf const *get_gdk_pixbuf() const {
62 return pixbuf;
65 #endif