Re: gdk_imlib



On  1 Mar, Mark Toller scribbled:
->  Hi,
->  
->  This is probably the wrong place to ask this, but I guess some of you
->  may know the answer, being guile-gtk-gnome ppl :-)
->  
->  I'm playing around with a gdk_imlib app to play mpeg files (using the
->  Berkeley mpeg_play code as a library to get the frames in 24 bit RGB).
->  This all works well and good, and has the advantage that gdk_imlib
->  handles the dithering for me, so I don't have to worry about the
->  decoder dithering for a specific X Visual...
->  
->  What I want to do is place this in a GTK app, so I can provide menus/
->  control windows etc... but I can't find examples (simple ones!) of how
->  to do  this... At the minute my base code is :-
->  
->  GdkWindowAttr attr;
->  GdkWindow *win;
->  GdkImlibImage *im;
->  
->  gdk_init(&argc, &argv);
->  
->  gdk_imlib_init();
->  
->  gtk_widget_push_visual(gdk_imlib_get_visual());
->  gtk_widget_push_colormap(gdk_imlib_get_colormap());
->  
->  im = gdk_imlib_create_image_from_data(mpeg_data, NULL, width, height);
->  
->  attr.window_type = GDK_WINDOW_TOPLEVEL;
->  attr.wclass = GDK_INPUT_OUTPUT;
->  attr.event_mask = GDK_ALL_EVENTS_MASK;
->  attr.width = w;
->  attr.height = h;
->  
->  win = gdk_window_new(NULL, &attr, 0);
->  gdk_window_show(win);
->  
->  while(1)
->  {
->     GetNextFrame();
->  
->     Process any events, key strokes etc...
->     
->     /* mpeg_data is the decoded 24 bit RGB frame from GetNextFrame() */
->     im->rgb_data = mpeg_data;

OOOOOOOOOOH thats nasty..... no no.. if posible just have the mpeg_data
decoded into the im->rgb_data.
memcpy(im->rgb_data, mpeg_data);

->     gdk_imlib_changed_image(im);
->     gdk_imlib_apply_image(im, win);
->  }
->  
->  How would I go about changing this to use a gtkWidget as the main
->  window, with a menu bar at the top, and the canvas with the frame below
->  it?

use a drawing_area
area = gtk_drawing_area_new();

and pack the drawing area in - set its usize
gtk_widget_set_usize(area, 320, 240);
or whatever...

->  Any help appreciated, and sorry for being slightly off topic :-/
->  
->  Cheers,
->  
->  Mark.
->  
->  
->  

-- 
--------------- Codito, ergo sum - "I code, therefore I am" --------------------
raster@rasterman.com       /\___ /\ ___/||\___ ____/|/\___  raster@redhat.com
Carsten Haitzler           | _ //__\\ __||_ __\\ ___|| _ /  Red Hat Advanced
218/21 Conner Drive        || // __ \\_ \ | |   \ _/_|| /   Development Labs
Chapel Hill NC 27514 USA   ||\\\/  \//__/ |_|   /___/||\\   919 547 0012 ext 282
+1 (919) 929 9443, 801 4392   For pure Enlightenment   http://www.rasterman.com/

              \|/ ____ \|/  For those of you unaware. This face here is in fact
	      "@'/ ,. \@"   a Linux Kernel Error Message.
	      /_| \__/ |_\
		 \__U_/
							   



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]