Re: [gtk-list] Re: Displaying JPEGs



 > From gtk-list-request@redhat.com Tue Feb 16 05:24:15 1999
 > From: john@giorgio.hart.bbk.ac.uk
 >

Mike Lindahl <mlindahl@phoenix.Princeton.EDU>
> I am relatively new to GTK and am trying to get jpegs to display.  I am
> using the libjpeg library and that is not a problem.  I have successfully
> loaded the image into an array of memory.
>
> My problem comes in trying to display it.  My first idea was to use
> successive calls to gdk_draw_point.  This works, however, it takes _way_
> too long.  Since I am running on an 8-bit display, I also have to allocate
> color entries (I am not entirely sure if I am doing this correctly,
> but...).

kyto@is.s.u-tokyo.ac.jp (SAITO Jun)
> I am stuck on a similar problem. That's why I joined this list ;)
> I want to display an 8-bit gray scale image stored in an array,
> Damn that slow color allocation, huh? As a last resort, I tried what
> you did, and it was slow as hell :)

grundman@cs.uni-duesseldorf.de (Sven Grundmann)
> I also want to disaply a 8 bit greyscale image out of raw data ! If you get
> any further information please let me know .

John Cupitt (john.cupitt@ng-london.org.uk)
> If you want something that will dither an RGB image from memory into an X
> window, you need the gdk_rgb_*() functions. Take a look at testrgb in the gtk
> sources.

Thanks John, I appreciate that pointer and will follow up on it, 
The rest of us seem to share a common problem!
 
I am also very new to graphics programming and was having similiar
performance problems.  I am drawing a map from raw data and so do
not have the data in a recognizable file format to be drawn.

I set my display into Hi Color mode (16 bits 5-6-5), thinking that
I would not need a color map and therefore wouldn't incur the delays
associated with one.

My initial code constructed an entire row of rgb byte values (800 pixels
times 3 bytes) and used gdk_draw_rgb_image() to put the row on the screen.
And this took about 113 seconds to draw the whole map (600 rows worth).
I haven't tried sending over the entire image 800x600x3 yet, but I
probably will soon.

In my reading I think I've found that a pixmap is maintained and
manipulated in the server, while an image map is maintained in the
client program.  And that everytime I call a function with a _draw_
then I am sending a message through gdk and through xlib to the server.
And I believe that it is all this extra communication that is causing the
delays.

I changed the program such that before I started drawing the pixels I called
    gdk_image_init() and gdk_image_get()
and plotted the pixels with
   gdk_image_put_pixel()
and finally sent the entire image to the server with
   gdk_draw_image()

The net result is I cut display time from 113.911s to 3.987s.

Unfortunately, due to the way gdk_image_put_pixel() is written,
I now have to manipulate pixels as 5-6-5 bitmapped entities.
Not a very portable solution.

So I'm looking for a client side function which will map RGB values
into pixels on an image.  All the necessary information seems to be
in gdktypes.h in struct _GdkVisual.

Also perhaps someone can tell me, can I display an rgb image onto
an 8 bit display, will the necessary conversion take place automagicly
and quickly?

Any comments, critiques, or pointers would really be appreciated.

Larry



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