Hey All, I am trying to draw live images in Gtk::DrawingArea in the same way as they are shown in monitors at railway stations, airports, metro etc.. For current tesing purpose I have hardcoded my code.
here it is Gtkk::Drawing area width=720, height=640. I have first.pgm and second.pgm images each having 360*640 dimesions.(Yes, i rotated it for testing purpose.) These images contains one byte per pixel. 1) drawing fine when drwing single image. I just read the image into *unsigned char* buffer* of size 360*640*3. i have read it like this int bufferIndex=0; int fileIndex=0; //just assume for (int i=0; i<height; i++) { for (int j=0; j<width; j++) { //below three lines are for RGB purpose required in Gdk::Pixbuf buffer[bufferIndex++] = //File[fileIndex]; buffer[bufferIndex++] = //File[fileIndex]; buffer[bufferIndex++] = //File[fileIndex]; } } Gdk::Colorspace colorSpace = Gdk::COLORSPACE_RGB; Gdk::Colorspace colorSpace = (Gdk::Colorspace)0; bool has_alpha = false; int bits_per_sample = 8; int rowStride = 360*3; // distance between rows in bytes Glib::RefPtr<Gdk::Pixbuf> pixBuf = Gdk::Pixbuf::create_from_data((const guint8 *) buffer, colorSpace, has_alpha, bits_per_sample, 360, 640, rowStride); Glib::RefPtr<Gdk::GC> gcContext; pixBuf->render_to_drawable(drawingArea pointer, gcContext, 0, 0, 0 , 0 , 360, 640, Gdk::RGB_DITHER_MAX, 0, 0); //It prints the image in the left half of drawing area. IT IS SAME AS I EXPECTED. * REAL PROBLEM COMES WHEN I DRAW TWO IMAGES.* for that purpose I read first.pgm in buffer and after that i read second.pgm (means total [360*640*3]*2 bytes) Now i draw it as shown int the code. Glib::RefPtr<Gdk::GC>gcContext; Gdk::Colorspace colorSpace = Gdk::COLORSPACE_RGB; Gdk::Colorspace colorSpace = (Gdk::Colorspace)0; bool has_alpha = false; int bits_per_sample = 8; int rowStride = 360*3; // distance between rows in bytes Glib::RefPtr<Gdk::Pixbuf> pixBuf = Gdk::Pixbuf::create_from_data((const guint8 *) buffer, colorSpace, has_alpha, bits_per_sample, 720, 640, rowStride); pixBuf->render_to_drawable(drawingarea pointer, gcContext, 0, 0, 0 , 0 , 720, 640, Gdk::RGB_DITHER_MAX, 0, 0); Result:: In both half of the Gtk::Drwing area it prints first.pgm image only??? -- View this message in context: http://gtk.10911.n7.nabble.com/drawing-multiple-image-pgm-using-single-Ggk-Pixbuf-in-Gtk-Drawing-area-tp84746.html Sent from the Gtkmm mailing list archive at Nabble.com. _______________________________________________ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list