## Visuals Visuals — Low-level display hardware information |

## Functions

void | gdk_visual_get_blue_pixel_details ()
gint | gdk_visual_get_depth ()
void | gdk_visual_get_green_pixel_details ()
void | gdk_visual_get_red_pixel_details ()
GdkVisualType | gdk_visual_get_visual_type ()
GdkScreen * | gdk_visual_get_screen ()

## Types and Values

| GdkVisual
enum | GdkVisualType
enum | GdkByteOrder

## Object Hierarchy

        GObject
        ╰── GdkVisual

## Includes

    #include <gdk/gdk.h>

## Description

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.

There are several standard visuals. The visual returned by `gdk_screen_get_system_visual()` is the system’s default visual, and the visual returned by `gdk_screen_get_rgba_visual()` should be used for creating windows with an alpha channel.

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`.

## Functions

### gdk_visual_get_blue_pixel_details ()

    void
    gdk_visual_get_blue_pixel_details (GdkVisual *visual,
                                       guint32 *mask,
                                       gint *shift,
                                       gint *precision);

Obtains values that are needed to calculate blue pixel values in TrueColor and DirectColor. The “mask” is the significant bits within the pixel. The “shift” is the number of bits left we must shift a primary for it to be in position (according to the "mask"). Finally, "precision" refers to how much precision the pixel value contains for a particular primary.

#### Parameters

visual | a GdkVisual |
mask | A pointer to a guint32 to be filled in, or `NULL`. | [out][allow-none]
shift | A pointer to a gint to be filled in, or `NULL`. | [out][allow-none]
precision | A pointer to a gint to be filled in, or `NULL`. | [out][allow-none]

Since: 2.22

### gdk_visual_get_depth ()

    gint
    gdk_visual_get_depth (GdkVisual *visual);

Returns the bit depth of this visual.

#### Parameters

visual | A GdkVisual. |

#### Returns

The bit depth of this visual.

Since: 2.22

### gdk_visual_get_green_pixel_details ()

    void
    gdk_visual_get_green_pixel_details (GdkVisual *visual,
                                        guint32 *mask,
                                        gint *shift,
                                        gint *precision);

Obtains values that are needed to calculate green pixel values in TrueColor and DirectColor. The “mask” is the significant bits within the pixel. The “shift” is the number of bits left we must shift a primary for it to be in position (according to the "mask"). Finally, "precision" refers to how much precision the pixel value contains for a particular primary.

#### Parameters

visual | a GdkVisual |
mask | A pointer to a guint32 to be filled in, or `NULL`. | [out][allow-none]
shift | A pointer to a gint to be filled in, or `NULL`. | [out][allow-none]
precision | A pointer to a gint to be filled in, or `NULL`. | [out][allow-none]

Since: 2.22

### gdk_visual_get_red_pixel_details ()

    void
    gdk_visual_get_red_pixel_details (GdkVisual *visual,
                                      guint32 *mask,
                                      gint *shift,
                                      gint *precision);

Obtains values that are needed to calculate red pixel values in TrueColor and DirectColor. The “mask” is the significant bits within the pixel. The “shift” is the number of bits left we must shift a primary for it to be in position (according to the "mask"). Finally, "precision" refers to how much precision the pixel value contains for a particular primary.

#### Parameters

visual | A GdkVisual |
mask | A pointer to a guint32 to be filled in, or `NULL`. | [out][allow-none]
shift | A pointer to a gint to be filled in, or `NULL`. | [out][allow-none]
precision | A pointer to a gint to be filled in, or `NULL`. | [out][allow-none]

Since: 2.22

### gdk_visual_get_visual_type ()

    GdkVisualType
    gdk_visual_get_visual_type (GdkVisual *visual);

Returns the type of visual this is (PseudoColor, TrueColor, etc).

#### Parameters

visual | A GdkVisual. |

#### Returns

A GdkVisualType stating the type of `visual` .

Since: 2.22

### gdk_visual_get_screen ()

    GdkScreen *
    gdk_visual_get_screen (GdkVisual *visual);

Gets the screen to which this visual belongs

#### Parameters

visual | a GdkVisual |

#### Returns

the screen to which this visual belongs.

[transfer none]

Since: 2.2

## Types and Values

### GdkVisual

    typedef struct _GdkVisual GdkVisual;

A GdkVisual contains information about a particular visual.

### enum GdkVisualType

A set of values that describe the manner in which the pixel values for a visual are converted into RGB values for display.

#### Members

GDK_VISUAL_STATIC_GRAY | Each pixel value indexes a grayscale value directly. |
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. |
GDK_VISUAL_STATIC_COLOR | Each pixel value is an index into a predefined, unmodifiable color map that maps pixel values into RGB values. |
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. |
GDK_VISUAL_TRUE_COLOR | Each pixel value directly contains red, green, and blue components. Use `gdk_visual_get_red_pixel_details()`, etc, to obtain information about how the components are assembled into a pixel value. |
GDK_VISUAL_DIRECT_COLOR | Each pixel value contains red, green, and blue components as for `GDK_VISUAL_TRUE_COLOR`, but the components are mapped via a color table into the final output table instead of being converted directly. |

### enum GdkByteOrder

A set of values describing the possible byte-orders for storing pixel values in memory.

#### Members

GDK_LSB_FIRST | The values are stored with the least-significant byte first. For instance, the 32-bit value 0xffeecc would be stored in memory as 0xcc, 0xee, 0xff, 0x00. |
GDK_MSB_FIRST | The values are stored with the most-significant byte first. For instance, the 32-bit value 0xffeecc would be stored in memory as 0x00, 0xff, 0xee, 0xcc. |