Re: (no subject)




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





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