[gtkmm] Error creating a pixbuf from an image
- From: Don Scorgie <DonScorgie Blueyonder co uk>
- To: gtkmm <gtkmm-list gnome org>
- Subject: [gtkmm] Error creating a pixbuf from an image
- Date: Thu, 26 Feb 2004 15:48:03 +0000
hi,
I am trying to create a Gdk::Pixbuf from a Gdk::Image using
Gdk::Pixbuf::create(const Glib::RefPtr<Image>&,
const Glib::RefPtr<Colormap>&, int src_x, int src_y, int dest_x,
int dest_y, int width, int height)
Unfortunately, whenever I try, it seg faults.
Each variable, I am taking to mean:
src_x/y: The upper left corner of the image (i.e. 0,0)
dest_x/y: The upper left corner of the destination(i.e. 0,0)
If I am wrong, please let me know.
Attached is the smallest example I can create. Any help would be much
appreciated.
Cheers
Don
#include <gtkmm.h>
#include <gdkmm.h>
#include <iostream>
class nWindow: public Gtk::Window
{
public:
nWindow();
private:
Glib::RefPtr<Gdk::Visual> vis;
Glib::RefPtr<Gdk::Image> image;
};
nWindow::nWindow()
{
vis = Gdk::Visual::get_system();
image = Gdk::Image::create(Gdk::IMAGE_FASTEST, vis, 100, 100);
Glib::RefPtr<Gdk::Colormap> colorm = image->get_colormap();
std::cout<<"Got the colormap"<<std::endl;
Glib::RefPtr<Gdk::Pixbuf> p =
Gdk::Pixbuf::create (image, colorm, 0, 0, 0, 0, 100, 100);
std::cout<<"Got the Pixbuf"<<std::endl;
}
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
nWindow window;
Gtk::Main::run(window);
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]