gtk.gdk.Visual an object containing hardware display information Synopsis gtk.gdk.Visual gobject.GObject gtk.gdk.Visual depth visual_type get_screen Functions gtk.gdk.list_visuals gtk.gdk.visual_get_best gtk.gdk.visual_get_best_depth gtk.gdk.visual_get_best_type gtk.gdk.visual_get_best_with_depth depth gtk.gdk.visual_get_best_with_type type gtk.gdk.visual_get_system gtk.gdk.query_depths gtk.gdk.query_visual_types Ancestry +-- gobject.GObject +-- gtk.gdk.Visual Attributes
"bits_per_rgb" Read The number of significant bits per red, green, or blue when specifying colors for this visual. (For instance, for the gtk.gdk.Colormap.alloc_color() method) "blue_mask" Read A mask giving the bits in a pixel value that correspond to the blue field. "blue_prec" Read See above. "blue_shift" Read The blue_shift and blue_prec give an alternate presentation of the information in blue_mask. "byte_order" Read The byte-order for this visual - either: gtk.gdk.LSB_FIRST or gtk.gdk.MSB_FIRST. "colormap_size" Read The number of entries in the colormap, for visuals of type gtk.gdk.VISUAL_PSEUDO_COLOR or gtk.gdk.VISUAL_GRAY_SCALE. For other visual types, it is the number of possible levels per color component. If the visual has different numbers of levels for different components, the value of this field is undefined. "depth" Read The number of bits per pixel. "green_mask" Read A mask giving the bits in a pixel value that correspond to the green field. "green_prec" Read See above. "green_shift" Read The green_shift and green_prec give an alternate presentation of the information in green_mask. "red_mask" Read A mask giving the bits in a pixel value that correspond to the red field. Significant only for gtk.gdk.VISUAL_PSEUDOCOLOR and gtk.gdk.VISUAL_DIRECTCOLOR. "red_prec" Read See above. "red_shift" Read The red_shift and red_prec give an alternate presentation of the information in red_mask. red_mask is a contiguous sequence of red_prec bits starting at bit number red_shift. "type" Read The type of this visual - one of: gtk.gdk.VISUAL_STATIC_GRAY, gtk.gdk.VISUAL_GRAYSCALE, gtk.gdk.VISUAL_STATIC_COLOR, gtk.gdk.VISUAL_PSEUDO_COLOR, gtk.gdk.VISUAL_TRUE_COLOR, gtk.gdk.VISUAL_DIRECT_COLOR
Description A gtk.gdk.Visual 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 PyGTK. Visuals are useful to interpret the contents of a gtk.gdk.Image, but you should avoid gtk.gdk.Image precisely because its contents depend on the display hardware; use gtk.gdk.Pixbuf instead, for all but the most low-level purposes. Also, anytime you provide a gtk.gdk.Colormap, the visual is implied as part of the colormap (see the gtk.gdk.Colormap.get_visual() method), so you won't have to provide a visual in addition. There are several standard visuals. The visual returned by the gtk.gdk.visual_get_system() function is the system's default visual. The gtk.gdk.rgb_get_visual() function returns 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 the gtk.gdk.rgb_get_colormap() function). 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, gtk.gdk.VISUAL_PSEUDO_COLOR is preferred at 8bpp, otherwise, the visual types are ranked in the order of (highest to lowest) gtk.gdk.VISUAL_DIRECT_COLOR, gtk.gdk.VISUAL_TRUE_COLOR, gtk.gdk.VISUAL_PSEUDO_COLOR, gtk.gdk.VISUAL_STATIC_COLOR, gtk.gdk.VISUAL_GRAYSCALE, then gtk.gdk.VISUAL_STATIC_GRAY. Constructor gtk.gdk.Visual depth visual_type depth : a bit depth visual_type : a visual type Returns : the best gtk.gdk.Visual with both depth and visual_type, or None if none Creates a new gtk.gdk.Visual that is the best choice for the specified depth and visual_type. Color visuals and visuals with mutable colormaps are preferred over grayscale or fixed-colormap visuals and visuals with higher color depths are considered better. The value of visual_type must be one of: gtk.gdk.VISUAL_STATIC_GRAY Each pixel value indexes a grayscale value directly. gtk.gdk.VISUAL_GRAYSCALE Each pixel is an index into a color map that maps pixel values into grayscale values. The color map can be changed by an application. gtk.gdk.VISUAL_STATIC_COLOR Each pixel value is an index into a predefined, unmodifiable color map that maps pixel values into RGB values. gtk.gdk.VISUAL_PSEUDO_COLOR Each pixel is an index into a color map that maps pixel values into rgb values. The color map can be changed by an application. gtk.gdk.VISUAL_TRUE_COLOR Each pixel value directly contains red, green, and blue components. The red_mask, green_mask, and blue_mask fields of the gtk.gdk.Visual structure describe how the components are assembled into a pixel value. gtk.gdk.VISUAL_DIRECT_COLOR Each pixel value contains red, green, and blue components as for gtk.gdk.TRUE_COLOR, but the components are mapped via a color table into the final output table instead of being converted directly. Methods gtk.gdk.Visual.get_screen get_screen Returns : the screen that this visual belongs to. This method is available in PyGTK 2.2 and above. The get_screen() method returns the gtk.gdk.Screen that this visual belongs to. Functions gtk.gdk.list_visuals gtk.gdk.list_visuals Returns : a list of gtk.gdk.Visual objects The gtk.gdk.list_visuals() function returns a list containing the available gtk.gdk.Visual objects for the default screen. gtk.gdk.visual_get_best gtk.gdk.visual_get_best Returns : the best gtk.gdk.Visual for the default screen The gtk.gdk.visual_get_best() function returns the visual with the most available colors for the default screen. gtk.gdk.visual_get_best_depth gtk.gdk.visual_get_best_depth Returns : the best available depth. The gtk.gdk.visual_get_best_depth() function returns the best available depth for the default GDK screen. "Best" means "largest," i.e. 32 preferred over 24 preferred over 8 bits per pixel. gtk.gdk.visual_get_best_type gtk.gdk.visual_get_best_type Returns : the gtk.gdk.Visual with the best type for the default screen The gtk.gdk.visual_get_best_type() function returns the best available gtk.gdk.Visual type for the default screen. gtk.gdk.visual_get_best_with_depth gtk.gdk.visual_get_best_with_depth depth depth : the number of bits per pixel Returns : the best gtk.gdk.Visual for the specified depth The gtk.gdk.visual_get_best_with_depth() function returns the best gtk.gdk.Visual with the specified depth. gtk.gdk.visual_get_best_with_type gtk.gdk.visual_get_best_with_type type type : a visual type Returns : the best gdkVisual for the visual type specified by type The gtk.gdk.visual_get_best_with_type() function returns the best gtk.gdk.Visual for the visual type specified by type. The value of visual_type must be one of: gtk.gdk.VISUAL_STATIC_GRAY Each pixel value indexes a grayscale value directly. gtk.gdk.VISUAL_GRAYSCALE Each pixel is an index into a color map that maps pixel values into grayscale values. The color map can be changed by an application. gtk.gdk.VISUAL_STATIC_COLOR Each pixel value is an index into a predefined, unmodifiable color map that maps pixel values into RGB values. gtk.gdk.VISUAL_PSEUDO_COLOR Each pixel is an index into a color map that maps pixel values into rgb values. The color map can be changed by an application. gtk.gdk.VISUAL_TRUE_COLOR Each pixel value directly contains red, green, and blue components. The red_mask, green_mask, and blue_mask fields of the gtk.gdk.Visual structure describe how the components are assembled into a pixel value. gtk.gdk.VISUAL_DIRECT_COLOR Each pixel value contains red, green, and blue components as for gtk.gdk.TRUE_COLOR, but the components are mapped via a color table into the final output table instead of being converted directly. gtk.gdk.visual_get_system gtk.gdk.visual_get_system Returns : the system gtk.gdk.Visual The gtk.gdk.visual_get_system() function returns the default gtk.gdk.Visual for the system's default screen. gtk.gdk.query_depths gtk.gdk.query_depths Returns : a tuple containing the unique supported visual depths This function is available in PyGTK 2.4 and above. The gtk.gdk.query_depths() function returns a tuple containing the unique supported visual depths for the default screen. It's equivalent to listing the visuals (see the gtk.gdk.list_visuals() function) and then looking at the depth field in each visual, removing duplicates. gtk.gdk.query_visual_types gtk.gdk.query_visual_types Returns : the system gtk.gdk.Visual The gtk.gdk.query_visual_types() function returns a tuple containing the unique visual types supported by the default screen.It's equivalent to listing the visuals (see the gtk.gdk.list_visuals() function) and then looking at the type field in each visual, removing duplicates. The returned value will be one of: gtk.gdk.VISUAL_STATIC_GRAY Each pixel value indexes a grayscale value directly. gtk.gdk.VISUAL_GRAYSCALE Each pixel is an index into a color map that maps pixel values into grayscale values. The color map can be changed by an application. gtk.gdk.VISUAL_STATIC_COLOR Each pixel value is an index into a predefined, unmodifiable color map that maps pixel values into RGB values. gtk.gdk.VISUAL_PSEUDO_COLOR Each pixel is an index into a color map that maps pixel values into rgb values. The color map can be changed by an application. gtk.gdk.VISUAL_TRUE_COLOR Each pixel value directly contains red, green, and blue components. The red_mask, green_mask, and blue_mask fields of the gtk.gdk.Visual structure describe how the components are assembled into a pixel value. gtk.gdk.VISUAL_DIRECT_COLOR Each pixel value contains red, green, and blue components as for gtk.gdk.VISUAL_TRUE_COLOR, but the components are mapped via a color table into the final output table instead of being converted directly.