gtkmm: Gdk::Visual Class Reference

gtkmm 3.24.10

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gdk::Visual Class Reference

A Gdk::Visual describes a particular video hardware display format. More...

`#include <gdkmm/visual.h>`

Inheritance diagram for Gdk::Visual:
[legend]

## Public Member Functions
| Visual (Visual && src) noexcept
Visual & | operator= (Visual && src) noexcept
| ~Visual () noexcept override
GdkVisual * | gobj ()
| Provides access to the underlying C GObject.
const GdkVisual * | gobj () const
| Provides access to the underlying C GObject.
GdkVisual * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::RefPtr< Screen > | get_screen ()
| Gets the screen to which this visual belongs.
Glib::RefPtr< const Screen > | get_screen () const
| Gets the screen to which this visual belongs.
VisualType | get_visual_type () const
| Returns the type of visual this is (PseudoColor, TrueColor, etc).
int | get_depth () const
| Returns the bit depth of this visual.
ByteOrder | get_byte_order ()
| Returns the byte order of this visual.
int | get_colormap_size () const
| Returns the size of a colormap for this visual.
int | get_bits_per_rgb () const
| Returns the number of significant bits per red, green and blue value.
void | get_red_pixel_details (guint32 & mask, int &shift, int & precision) const
| Obtains values that are needed to calculate red pixel values in TrueColor and DirectColor.
void | get_green_pixel_details (guint32 & mask, int &shift, int & precision) const
| Obtains values that are needed to calculate green pixel values in TrueColor and DirectColor.
void | get_blue_pixel_details (guint32 & mask, int &shift, int & precision) const
| Obtains values that are needed to calculate blue pixel values in TrueColor and DirectColor.
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
void | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void > &&slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, sigc::slot< void > &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src)
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src)
void | remove_destroy_notify_callback (void *data) const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.
static Glib::RefPtr< Visual > | get_system ()
| Get the system’s default visual for the default GDK screen.
static Glib::RefPtr< Visual > | get_best ()
| Get the visual with the most available colors for the default GDK screen.
static Glib::RefPtr< Visual > | get_best (int depth)
| Get the best visual with depth depth for the default GDK screen.
static Glib::RefPtr< Visual > | get_best (VisualType visual_type)
| Get the best visual of the given visual_type for the default GDK screen.
static Glib::RefPtr< Visual > | get_best (int depth, VisualType visual_type)
| Combines get_best_with_depth() and get_best_with_type().
static int | get_best_depth ()
| Get the best available depth for the default GDK screen.
static VisualType | get_best_type ()
| Return the best available visual type for the default GDK screen.

## Protected Member Functions
| Visual ()
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gdk::Visual > | wrap (GdkVisual * object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Additional Inherited Members
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

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

There are several standard visuals. The visual returned by Gdk::Screen::get_system_visual() is the system's default visual.

A number of methods 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.

## Constructor & Destructor Documentation

## ◆ Visual() [1/2]

Gdk::Visual::Visual | ( | Visual && | src | ) |
| noexcept

## ◆ ~Visual()

Gdk::Visual::~Visual | ( |  | ) |
| overridenoexcept

## ◆ Visual() [2/2]

Gdk::Visual::Visual | ( |  | ) |
| protected

## Member Function Documentation

## ◆ get_best() [1/4]

Glib::RefPtr< Visual > Gdk::Visual::get_best | ( |  | ) |
| static

Get the visual with the most available colors for the default GDK screen.

The return value should not be freed.

Deprecated: 3.22: Visual selection should be done using Gdk::Screen::get_system_visual() and Gdk::Screen::get_rgba_visual()

Deprecated
  Visual selection should be done using Gdk::Screen::get_system_visual() and Gdk::Screen::get_rgba_visual().

Returns
  Best visual.

## ◆ get_best() [2/4]

Glib::RefPtr< Visual > Gdk::Visual::get_best | ( | int | depth | ) |
| static

Get the best visual with depth depth for the default GDK screen.

Color visuals and visuals with mutable colormaps are preferred over grayscale or fixed-colormap visuals. The return value should not be freed. nullptr may be returned if no visual supports depth.

Deprecated: 3.22: Visual selection should be done using Gdk::Screen::get_system_visual() and Gdk::Screen::get_rgba_visual()

Deprecated
  Visual selection should be done using Gdk::Screen::get_system_visual() and Gdk::Screen::get_rgba_visual().

Parameters

  depth | A bit depth.

Returns
  Best visual for the given depth.

## ◆ get_best() [3/4]

Glib::RefPtr< Visual > Gdk::Visual::get_best | ( | int | depth,
|  | VisualType | visual_type )
| static

Combines get_best_with_depth() and get_best_with_type().

Deprecated: 3.22: Visual selection should be done using Gdk::Screen::get_system_visual() and Gdk::Screen::get_rgba_visual()

Deprecated
  Visual selection should be done using Gdk::Screen::get_system_visual() and Gdk::Screen::get_rgba_visual().

Parameters

  depth | A bit depth.
  visual_type | A visual type.

Returns
  Best visual with both depth and visual_type, or nullptr if none.

## ◆ get_best() [4/4]

Glib::RefPtr< Visual > Gdk::Visual::get_best | ( | VisualType | visual_type | ) |
| static

Get the best visual of the given visual_type for the default GDK screen.

Visuals with higher color depths are considered better. The return value should not be freed. nullptr may be returned if no visual has type visual_type.

Deprecated: 3.22: Visual selection should be done using Gdk::Screen::get_system_visual() and Gdk::Screen::get_rgba_visual()

Deprecated
  Visual selection should be done using Gdk::Screen::get_system_visual() and Gdk::Screen::get_rgba_visual().

Parameters

  visual_type | A visual type.

Returns
  Best visual of the given type.

## ◆ get_best_depth()

int Gdk::Visual::get_best_depth | ( |  | ) |
| static

Get the best available depth for the default GDK screen.

“Best” means “largest,” i.e. 32 preferred over 24 preferred over 8 bits per pixel.

Deprecated: 3.22: Visual selection should be done using Gdk::Screen::get_system_visual() and Gdk::Screen::get_rgba_visual()

Deprecated
  Visual selection should be done using Gdk::Screen::get_system_visual() and Gdk::Screen::get_rgba_visual().

Returns
  Best available depth.

## ◆ get_best_type()

VisualType Gdk::Visual::get_best_type | ( |  | ) |
| static

Return the best available visual type for the default GDK screen.

Deprecated: 3.22: Visual selection should be done using Gdk::Screen::get_system_visual() and Gdk::Screen::get_rgba_visual()

Deprecated
  Visual selection should be done using Gdk::Screen::get_system_visual() and Gdk::Screen::get_rgba_visual().

Returns
  Best visual type.

## ◆ get_bits_per_rgb()

int Gdk::Visual::get_bits_per_rgb | ( |  | ) | const

Returns the number of significant bits per red, green and blue value.

Not all GDK backend provide a meaningful value for this function.

Since gtkmm 2.22

Deprecated: 3.22. Use get_red_pixel_details() and its variants to learn about the pixel layout of TrueColor and DirectColor visuals

Deprecated
  Use get_red_pixel_details() and its variants to learn about the pixel layout of TrueColor and DirectColor visuals.

Returns
  The number of significant bits per color value for visual.

## ◆ get_blue_pixel_details()

void Gdk::Visual::get_blue_pixel_details | ( | guint32 & | mask,
|  | int & | shift,
|  | int & | precision ) const

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.

Since gtkmm 2.22

Parameters

  mask | A pointer to a #guint32 to be filled in, or nullptr.
  shift | A pointer to a int to be filled in, or nullptr.
  precision | A pointer to a int to be filled in, or nullptr.

## ◆ get_byte_order()

ByteOrder Gdk::Visual::get_byte_order | ( |  | ) |

Returns the byte order of this visual.

The information returned by this function is only relevant when working with XImages, and not all backends return meaningful information for this.

Since gtkmm 2.22

Deprecated: 3.22: This information is not useful

Deprecated
  This information is not useful.

Returns
  A Gdk::ByteOrder stating the byte order of visual.

## ◆ get_colormap_size()

int Gdk::Visual::get_colormap_size | ( |  | ) | const

Returns the size of a colormap for this visual.

You have to use platform-specific APIs to manipulate colormaps.

Since gtkmm 2.22

Deprecated: 3.22: This information is not useful, since GDK does not provide APIs to operate on colormaps.

Deprecated
  This information is not useful, since GDK does not provide APIs to operate on colormaps.

Returns
  The size of a colormap that is suitable for visual.

## ◆ get_depth()

int Gdk::Visual::get_depth | ( |  | ) | const

Returns the bit depth of this visual.

Since gtkmm 2.22

Returns
  The bit depth of this visual.

## ◆ get_green_pixel_details()

void Gdk::Visual::get_green_pixel_details | ( | guint32 & | mask,
|  | int & | shift,
|  | int & | precision ) const

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.

Since gtkmm 2.22

Parameters

  mask | A pointer to a #guint32 to be filled in, or nullptr.
  shift | A pointer to a int to be filled in, or nullptr.
  precision | A pointer to a int to be filled in, or nullptr.

## ◆ get_red_pixel_details()

void Gdk::Visual::get_red_pixel_details | ( | guint32 & | mask,
|  | int & | shift,
|  | int & | precision ) const

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.

Since gtkmm 2.22

Parameters

  mask | A pointer to a #guint32 to be filled in, or nullptr.
  shift | A pointer to a int to be filled in, or nullptr.
  precision | A pointer to a int to be filled in, or nullptr.

## ◆ get_screen() [1/2]

Glib::RefPtr< Screen > Gdk::Visual::get_screen | ( |  | ) |

Gets the screen to which this visual belongs.

Since gtkmm 2.2

Returns
  The screen to which this visual belongs.

## ◆ get_screen() [2/2]

Glib::RefPtr< const Screen > Gdk::Visual::get_screen | ( |  | ) | const

Gets the screen to which this visual belongs.

Since gtkmm 2.2

Returns
  The screen to which this visual belongs.

## ◆ get_system()

Glib::RefPtr< Visual > Gdk::Visual::get_system | ( |  | ) |
| static

Get the system’s default visual for the default GDK screen.

This is the visual for the root window of the display. The return value should not be freed.

Deprecated: 3.22: Use gdk_screen_get_system_visual (Gdk::Screen::get_default()).

Deprecated
  Use Gdk::Screen::get_system_visual() (and Gdk::Screen::get_default()) instead.

Returns
  System visual.

## ◆ get_type()

GType Gdk::Visual::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ get_visual_type()

VisualType Gdk::Visual::get_visual_type | ( |  | ) | const

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

Since gtkmm 2.22

Returns
  A Gdk::VisualType stating the type of visual.

## ◆ gobj() [1/2]

GdkVisual * Gdk::Visual::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GdkVisual * Gdk::Visual::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GdkVisual * Gdk::Visual::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ operator=()

Visual & Gdk::Visual::operator= | ( | Visual && | src | ) |
| noexcept

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gdk::Visual > wrap | ( | GdkVisual * | object,
|  | bool | take_copy = false )
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.