Low-level display hardware information
Class GdkVisual
A GdkVisual describes a particular video hardware display format. It includes information about the number of bits used for each color, the way the bits are translated into an RGB value for display, and the way the bits are stored in memory. For example, a piece of display hardware might support 24-bit color, 16-bit color, or 8-bit color; meaning 24/16/8-bit pixel sizes. For a given pixel size, pixels can be in different formats; for example the "red" element of an RGB pixel may be in the top 8 bits of the pixel, or may be in the lower 4 bits.
Usually you can avoid thinking about visuals in GTK+. Visuals are useful to interpret the contents of a GdkImage, but you should avoid GdkImage precisely because its contents depend on the display hardware; use GdkPixbuf instead, for all but the most low-level purposes. Also, anytime you provide a GdkColormap, the visual is implied as part of the colormap (gdk_colormap_get_visual()), so you won't have to provide a visual in addition.
There are several standard visuals. The visual returned by gdk_visual_get_system() is the system's default visual. gdk_rgb_get_visual() return the visual most suited to displaying full-color image data. If you use the calls in GdkRGB, you should create your windows using this visual (and the colormap returned by gdk_rgb_get_colormap()).
A number of functions are provided for determining the "best" available visual. For the purposes of making this determination, higher bit depths are considered better, and for visuals of the same bit depth, GDK_VISUAL_PSEUDO_COLOR is preferred at 8bpp, otherwise, the visual types are ranked in the order of (highest to lowest) GDK_VISUAL_DIRECT_COLOR, GDK_VISUAL_TRUE_COLOR, GDK_VISUAL_PSEUDO_COLOR, GDK_VISUAL_STATIC_COLOR, GDK_VISUAL_GRAYSCALE, then GDK_VISUAL_STATIC_GRAY
[...]
Methods | |
get_best | Get the visual with the most available colors for the default GDK screen. |
get_best_depth | Get the best available depth for the default GDK screen. |
get_best_type | Return the best available visual type for the default GDK screen. |
get_best_with_both | Combines gdk_visual_get_best_with_depth() and gdk_visual_get_best_with_type(). |
get_best_with_depth | Get the best visual with depth depth for the default GDK screen. |
get_best_with_type | Get the best visual of the given visual_type for the default GDK screen. |
get_screen | Gets the screen to which this visual belongs |
get_system | Get the system's default visual for the default GDK screen. |
list_visuals | Lists the available visuals for the default screen. |
query_depths | This function returns the available bit depths for the default screen. |
query_visual_types | This function returns the available visual types for the default screen. |
Get the visual with the most available colors for the default GDK screen.
GdkVisual.get_best()
Return | Best visual. |
Get the best available depth for the default GDK screen.
GdkVisual.get_best_depth()
Return | best available depth |
"Best" means "largest," i.e. 32 preferred over 24 preferred over 8 bits per pixel.
Return the best available visual type for the default GDK screen.
GdkVisual.get_best_type()
Return | best visual type |
Combines gdk_visual_get_best_with_depth() and gdk_visual_get_best_with_type().
GdkVisual.get_best_with_both( depth, visual_type )
depth | a bit depth |
visual_type | a visual type |
Return | best visual. |
Get the best visual with depth depth for the default GDK screen.
GdkVisual.get_best_with_depth( depth )
depth | a bit depth |
Return | best visual for the given depth. |
Color visuals and visuals with mutable colormaps are preferred over grayscale or fixed-colormap visuals. Nil may be returned if no visual supports depth.
Get the best visual of the given visual_type for the default GDK screen.
GdkVisual.get_best_with_type( visual_type )
visual_type | a visual type |
Return | best visual of the given type |
Visuals with higher color depths are considered better. Nil may be returned if no visual has type visual_type.
Gets the screen to which this visual belongs
GdkVisual.get_screen()
Return | the screen to which this visual belongs (GdkScreen) |
Get the system's default visual for the default GDK screen.
GdkVisual.get_system()
Return | System GdkVisual. |
This is the visual for the root window of the display.
Lists the available visuals for the default screen.
GdkVisual.list_visuals()
Return | An array of available visuals. |
(See gdk_screen_list_visuals()) A visual describes a hardware image data format. For example, a visual might support 24-bit color, or 8-bit color, and might expect pixels to be in a certain format.
This function returns the available bit depths for the default screen.
GdkVisual.query_depths()
Return | An array of available depths. |
It's equivalent to listing the visuals (gdk_list_visuals()) and then looking at the depth field in each visual, removing duplicates.
This function returns the available visual types for the default screen.
GdkVisual.query_visual_types()
Return | An array of available visual types. |
It's equivalent to listing the visuals (gdk_list_visuals()) and then looking at the type field in each visual, removing duplicates.