Re: Question..



Michael O'Reilly wrote:
> 
> Some dumb questions:
> 
> #1. What is a visual? I'm having trouble finding any documentation on
> the details of such things.
> 

A visual is defined in the Xlib programming manual as:

"The specifications for color handling for a drawable, including visual
class, depth, RGB/Pixel, etc., are collectively referred to as a
visual..."  Ok, so what this mess means is that a visual is the
representation of two really big things: a visual class and the color
depth.

The visual class is a description of the hardware.  Basically, the
visual class answers two questions:

o Is the display grayscale, have a single index for color, or have a
decomposed index for color?

o Is the colormap read-only or is it read/write?

The color depth is something you're probably more familiar with; It's
how many colors are supported on a particular display expressed as
planes, from 1 to 24, I think.

A single display has at least one visual but can also support more than
one.

> #2. What exactly does the following code do?
> 
>   gnomefe_depth = gdk_visual_get_best_depth();
>   gnomefe_visual = gdk_visual_get_best_with_depth(gnomefe_depth);
> 
>   gtk_widget_set_default_visual(gnomefe_visual);
> 

This code basically says "get me the best available depth for my
display".  Because displays can handle more than one depth, you want the
best one.  Then it says "get the best visual class with said depth." 
You want the best visual class for that depth as well.  Remember that
you can have different visuals at different depths.  Then it sets the
default visual for the toolkit with the information that it has gathered
from the previous calls.

> #3. Why is this code better/different/worse than the above?
> 
>   gtk_widget_push_visual(gdk_imlib_get_visual());
>   gtk_widget_push_colormap(gdk_imlib_get_colormap());
> 

Honestly, I don't know.  Raster?  Is there any difference?  Does imlib
play any heuristical games to choose a better colormap/visual than the
best?

--Chris

-- 

------------
Christopher Blizzard
http://odin.appliedtheory.com/
------------



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