Re: (no subject)




On Mon, 17 Jun 2002, S. Eken wrote:



On Thu, 13 Jun 2002 John Cupitt ng-london org uk wrote:

Venkat Ramakrishnan wrote:
I have an application for UI for mediaplayer on Linux.
The application runs fine and shows all colours when
my color depth is set to 16. But when I change the colour
depth of my machine to 8 it shows only black colours
and no other colours. What could be the problem.
I am using gdk_draw_line() and gdk_draw_rgb_image()
function for drawing.

Hi Venkat, you're probably just running out of colours :-( try closing 
some other applications and trying again.

If you're using gtk1.2, you could try adding

   gdk_rgb_set_min_colors( 64 );

in your startup code. This changes the size of the cube that gdkrgb 
dithers to. Smaller values will use fewer colours, but look worse.

John


Hi there,

I experienced this problem as well and eventually figured out that a GTK
application seems to allocate all the colours it regards necessary into a
freshly allocated colormap it it doesn't find a default colormap on start
up. So an easy way to get around this could be calling

  gtk_widget_set_default_colormap (gdk_colormap_get_system ());

(or equivalent, depending on what language you use) as soon as possible
after gtk_init.

In my case this not only solved the problem of flashing colours while
changing between different applications (which is due to running out of
colours, as John correctly said), but also provided my application
with enough colours to look quite neat.

I'm not sure if this works with GTK 1.2 since I'm working
with 2.0, but I think it should be worth looking at.


Sebastian Eken
eken bfw online de



And hi again,

or rather: oops, I just found out why I had the feeling that my hint
could use a little bit more background information.

I experienced the problem mentioned above a while ago and regarded it
solved for a specific application by providing a default colormap the
way I described it.

But now, trying out some rather tricky things with pixmaps in drawing
areas, I found out that this could have an enormous impact on the time   
your application needs to initialize!!!

While calling gtk_widget_set_default_colormap on an 8 Bit system, I can
wait for up to 10 secs in a LAN (15 secs via DSL) for the application to
be in a usable state.

If I skip this, everything pops up in a fraction of a second.

On the other hand, using a 16 Bit system, it seems completely unnecessary
to set the default colormap, and even if you do so, the application will
launch before you can say "Launch!".

Now, beholding all this, I'd like to open up another thread
under a real subject, but I'm not sure if I can make it tonight since
it is already after 2 a.m. where I live.

Sebastian Eken
eken bfw-online de






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