1 /* $Id: image.hg,v 1.5 2006/04/12 11:11:24 murrayc Exp $ */
5 * Copyright (C) 1998-2002 The gtkmm Development Team
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.
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.
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
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <glibmm/object.h>
23 #include <gdkmm/visual.h>
24 #include <gdkmm/colormap.h>
25 #include <gdkmm/types.h> //For ByteOrder.
26 #include <gdk/gdkimage.h>
29 _PINCLUDE(glibmm/private/object_p.h)
35 _CC_INCLUDE(gdk/gdkenumtypes.h)
36 _WRAP_ENUM(ImageType, GdkImageType)
38 /** This represents an area for drawing graphics. It has now been superceded to a large extent by the much more flexible
39 * Gdk::Drawable RGB functions.
40 * To create an image from part of a Gdk::Window use Gdk::Drawable::get_image().
42 * The image can be manipulated with get_pixel() and put_pixel(), or alternatively by changing the actual pixel data, though
43 * manipulating the pixel data requires complicated code to cope with the different formats that may be used.
44 * To draw a Gdk::Image in a Gdk::Window or Gdk::Pixmap use Gdk::Drawable::draw_image().
46 class Image : public Glib::Object
48 _CLASS_GOBJECT(Image,GdkImage,GDK_IMAGE,Glib::Object,GObject)
49 _IGNORE(gdk_image_unref, gdk_image_ref)
52 /** Instantiate a new Gdk::Image.
54 * @param type The type of the Gdk::Image. Gdk::IMAGE_FASTEST is probably the best choice, since it will try to create a Gdk::IMAGE_SHARED image first and if that fails it will then use Gdk::IMAGE_NORMAL.
55 * @param visual The Gdk::Visual to use for the image.
56 * @param width The width of the image in pixels.
57 * @param height The height of the image in pixels.
59 Image(ImageType type, const Glib::RefPtr<Visual>& visual, int width, int height);
60 _IGNORE(gdk_image_new)
63 _WRAP_CREATE(ImageType type, const Glib::RefPtr<Visual>& visual, int width, int height)
65 //We ignore gdk_image_new_bitmap() because the documentation says that it is deprecated.
66 _IGNORE(gdk_image_new_bitmap)
68 _WRAP_METHOD(void put_pixel(int x, int y, guint32 pixel), gdk_image_put_pixel)
69 _WRAP_METHOD(guint32 get_pixel(int x, int y) const, gdk_image_get_pixel)
70 _WRAP_METHOD(void set_colormap(const Glib::RefPtr<Colormap>& colormap), gdk_image_set_colormap)
71 _WRAP_METHOD(Glib::RefPtr<Colormap> get_colormap(), gdk_image_get_colormap, refreturn)
72 _WRAP_METHOD(Glib::RefPtr<const Colormap> get_colormap() const, gdk_image_get_colormap, refreturn, constversion)
74 _MEMBER_GET(image_type, type, ImageType, GdkImageType)
75 _MEMBER_GET_GOBJECT(visual, visual, Visual, GdkVisual*)
76 _MEMBER_GET(byte_order, byte_order, ByteOrder, GdkByteOrder)
77 _MEMBER_GET(width, width, int, gint)
78 _MEMBER_GET(height, height, int, gint)
79 _MEMBER_GET(bpp, bpp, guint16, guint16)
80 _MEMBER_GET(bpl, bpl, guint16, guint16)
81 _MEMBER_GET(bits_per_pixel, bits_per_pixel, guint16, guint16)
83 //This memory block is not read-only, apparently:
84 _MEMBER_GET_PTR(mem, mem, void*, gpointer)
86 //TODO: This should be const really.
87 _MEMBER_GET(windowing_data, windowing_data, void*, gpointer)