gtk.gdk.Visual — an object containing hardware display information
class gtk.gdk.Visual( |
Functionsdef gtk.gdk.list_visuals()
def gtk.gdk.visual_get_best()
def gtk.gdk.visual_get_best_depth()
def gtk.gdk.visual_get_best_type()
def gtk.gdk.visual_get_best_with_depth(
depth
)def gtk.gdk.visual_get_best_with_type(
type
)def gtk.gdk.visual_get_system(
)
def gtk.gdk.query_depths(
)
def gtk.gdk.query_visual_types(
)
|
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
.
gtk.gdk.Visual(depth
, visual_type
)
| a bit depth |
| 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:
| Each pixel value indexes a grayscale value directly. |
| 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. |
| Each pixel value is an index into a predefined, unmodifiable color map that maps pixel values into RGB values. |
| 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. |
| 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. |
| 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. |
def 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.
def 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.
def 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.
def 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.
def 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.
def gtk.gdk.visual_get_best_with_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
.
def gtk.gdk.visual_get_best_with_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:
| Each pixel value indexes a grayscale value directly. |
| 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. |
| Each pixel value is an index into a predefined, unmodifiable color map that maps pixel values into RGB values. |
| 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. |
| 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. |
| 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. |
def gtk.gdk.visual_get_system()
The gtk.gdk.visual_get_system
() function
returns the default gtk.gdk.Visual
for
the system's default screen.
def gtk.gdk.query_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.
def gtk.gdk.query_visual_types()
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:
| Each pixel value indexes a grayscale value directly. |
| 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. |
| Each pixel value is an index into a predefined, unmodifiable color map that maps pixel values into RGB values. |
| 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. |
| 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. |
| 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. |