Klasse Gdk


public class Gdk extends Package
  • Konstruktordetails

    • Gdk

      public Gdk()
  • Methodendetails

    • getClassHandler

      public static ClassHandler getClassHandler()
    • cairoDrawFromGl

      @Deprecated public static void cairoDrawFromGl(@Nonnull Context cr, @Nonnull Surface surface, int source, int source_type, int buffer_scale, int x, int y, int width, int height)
      Veraltet.
      Draws GL content onto a cairo context.

      It takes a render buffer ID (@source_type == GL_RENDERBUFFER) or a texture
      id (@source_type == GL_TEXTURE) and draws it onto @cr with an OVER operation,
      respecting the current clip. The top left corner of the rectangle specified
      by @x, @y, @width and @height will be drawn at the current (0,0) position of
      the `cairo_t`.

      This will work for *all* `cairo_t`, as long as @surface is realized, but the
      fallback implementation that reads back the pixels from the buffer may be
      used in the general case. In the case of direct drawing to a surface with
      no special effects applied to @cr it will however use a more efficient
      approach.

      For GL_RENDERBUFFER the code will always fall back to software for buffers
      with alpha components, so make sure you use GL_TEXTURE if using alpha.

      Calling this may change the current GL context.
      Parameter:
      cr - a cairo context
      surface - The surface we're rendering for (not necessarily into)
      source - The GL ID of the source buffer
      source_type - The type of the @source
      buffer_scale - The scale-factor that the @source buffer is allocated for
      x - The source x position in @source to start copying from in GL coordinates
      y - The source y position in @source to start copying from in GL coordinates
      width - The width of the region to draw
      height - The height of the region to draw
    • cairoRectangle

      public static void cairoRectangle(@Nonnull Context cr, @Nonnull Rectangle rectangle)
      Adds the given rectangle to the current path of @cr.
      Parameter:
      cr - a cairo context
      rectangle - a `GdkRectangle`
    • cairoRegion

      public static void cairoRegion(@Nonnull Context cr, @Nonnull Region region)
      Adds the given region to the current path of @cr.
      Parameter:
      cr - a cairo context
      region - a `cairo_region_t`
    • cairoRegionCreateFromSurface

      public static Region cairoRegionCreateFromSurface(@Nonnull Surface surface)
      Creates region that covers the area where the given
      @surface is more than 50% opaque.

      This function takes into account device offsets that might be
      set with cairo_surface_set_device_offset().
      Parameter:
      surface - a cairo surface
      Gibt zurück:
      A `cairo_region_t`
    • cairoSetSourcePixbuf

      public static void cairoSetSourcePixbuf(@Nonnull Context cr, @Nonnull Pixbuf pixbuf, double pixbuf_x, double pixbuf_y)
      Sets the given pixbuf as the source pattern for @cr.

      The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned
      so that the origin of @pixbuf is @pixbuf_x, @pixbuf_y.
      Parameter:
      cr - a cairo context
      pixbuf - a `GdkPixbuf`
      pixbuf_x - X coordinate of location to place upper left corner of @pixbuf
      pixbuf_y - Y coordinate of location to place upper left corner of @pixbuf
    • cairoSetSourceRgba

      public static void cairoSetSourceRgba(@Nonnull Context cr, @Nonnull RGBA rgba)
      Sets the specified `GdkRGBA` as the source color of @cr.
      Parameter:
      cr - a cairo context
      rgba - a `GdkRGBA`
    • colorStateGetOklab

      public static ColorState colorStateGetOklab()
      Returns the color state object representing the oklab color space.

      This is a perceptually uniform color state.
      Gibt zurück:
      the color state object for oklab
    • colorStateGetOklch

      public static ColorState colorStateGetOklch()
      Returns the color state object representing the oklch color space.

      This is the polar variant of oklab, in which the hue is encoded as
      a polar coordinate.
      Gibt zurück:
      the color state object for oklch
    • colorStateGetRec2100Linear

      public static ColorState colorStateGetRec2100Linear()
      Returns the color state object representing the linear rec2100 color space.

      This color state uses the primaries defined by BT.2020-2 and BT.2100-0 and a linear
      transfer function.

      It is equivalent to the [Cicp](class.CicpParams.html) tuple 9/8/0/1.

      See e.g. [the CSS HDR Module](https://drafts.csswg.org/css-color-hdr/#valdef-color-rec2100-linear)
      for details about this colorstate.
      Gibt zurück:
      the color state object for linearized rec2100
    • colorStateGetRec2100Pq

      public static ColorState colorStateGetRec2100Pq()
      Returns the color state object representing the rec2100-pq color space.

      This color state uses the primaries defined by BT.2020-2 and BT.2100-0 and the transfer
      function defined by SMPTE ST 2084 and BT.2100-2.

      It is equivalent to the [Cicp](class.CicpParams.html) tuple 9/16/0/1.

      See e.g. [the CSS HDR Module](https://drafts.csswg.org/css-color-hdr/#valdef-color-rec2100-pq)
      for details about this colorstate.
      Gibt zurück:
      the color state object for rec2100-pq
    • colorStateGetSrgb

      public static ColorState colorStateGetSrgb()
      Returns the color state object representing the sRGB color space.

      This color state uses the primaries defined by BT.709-6 and the transfer function
      defined by IEC 61966-2-1.

      It is equivalent to the [Cicp](class.CicpParams.html) tuple 1/13/0/1.

      See e.g. [the CSS Color Module](https://www.w3.org/TR/css-color-4/#predefined-sRGB)
      for details about this colorstate.
      Gibt zurück:
      the color state object for sRGB
    • colorStateGetSrgbLinear

      public static ColorState colorStateGetSrgbLinear()
      Returns the color state object representing the linearized sRGB color space.

      This color state uses the primaries defined by BT.709-6 and a linear transfer function.

      It is equivalent to the [Cicp](class.CicpParams.html) tuple 1/8/0/1.

      See e.g. [the CSS Color Module](https://www.w3.org/TR/css-color-4/#predefined-sRGB-linear)
      for details about this colorstate.
      Gibt zurück:
      the color state object for linearized sRGB
    • contentDeserializeAsync

      public static void contentDeserializeAsync(@Nonnull InputStream stream, @Nonnull Str mime_type, long type, int io_priority, @Nullable Cancellable cancellable, Gdk.OnAsyncReadyCallback callback, @Nullable Pointer user_data)
      Reads content from the given input stream and deserialize it, asynchronously.

      The default I/O priority is `G_PRIORITY_DEFAULT` (i.e. 0), and lower numbers
      indicate a higher priority.
      Parameter:
      stream - a `GInputStream` to read the serialized content from
      mime_type - the mime type to deserialize from
      type - the GType to deserialize from
      io_priority - the I/O priority of the operation
      cancellable - optional `GCancellable` object
      callback - callback to call when the operation is done
      user_data - data to pass to the callback function
    • contentDeserializeFinish

      public static boolean contentDeserializeFinish(@Nonnull AsyncResult result, @Nonnull Value value) throws AllocationError
      Finishes a content deserialization operation.
      Parameter:
      result - the `GAsyncResult`
      value - return location for the result of the operation
      Gibt zurück:
      %TRUE if the operation was successful. In this case, @value is set. %FALSE if an error occurred. In this case, @error is set
      Löst aus:
      AllocationError
    • contentFormatsParse

      public static ContentFormats contentFormatsParse(@Nonnull Str string)
      Parses the given @string into `GdkContentFormats` and
      returns the formats.

      Strings printed via [method@Gdk.ContentFormats.to_string]
      can be read in again successfully using this function.

      If @string does not describe valid content formats, %NULL
      is returned.
      Parameter:
      string - the string to parse
      Gibt zurück:
      the content formats if @string is valid
    • contentRegisterDeserializer

      public static void contentRegisterDeserializer(@Nonnull Str mime_type, long type, Gdk.OnContentDeserializeFunc deserialize, @Nullable Pointer data, Gdk.OnDestroyNotify notify)
      Registers a function to deserialize object of a given type.
      Parameter:
      mime_type - the mime type which the function can deserialize from
      type - the type of objects that the function creates
      deserialize - the callback
      data - data that @deserialize can access
      notify - destroy notify for @data
    • contentRegisterSerializer

      public static void contentRegisterSerializer(long type, @Nonnull Str mime_type, Gdk.OnContentSerializeFunc serialize, @Nullable Pointer data, Gdk.OnDestroyNotify notify)
      Registers a function to serialize objects of a given type.
      Parameter:
      type - the type of objects that the function can serialize
      mime_type - the mime type to serialize to
      serialize - the callback
      data - data that @serialize can access
      notify - destroy notify for @data
    • contentSerializeAsync

      public static void contentSerializeAsync(@Nonnull OutputStream stream, @Nonnull Str mime_type, @Nonnull Value value, int io_priority, @Nullable Cancellable cancellable, Gdk.OnAsyncReadyCallback callback, @Nullable Pointer user_data)
      Serialize content and write it to the given output stream, asynchronously.

      The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
      indicate a higher priority.
      Parameter:
      stream - a `GOutputStream` to write the serialized content to
      mime_type - the mime type to serialize to
      value - the content to serialize
      io_priority - the I/O priority of the operation
      cancellable - optional `GCancellable` object
      callback - callback to call when the operation is done
      user_data - data to pass to the callback function
    • contentSerializeFinish

      public static boolean contentSerializeFinish(@Nonnull AsyncResult result) throws AllocationError
      Finishes a content serialization operation.
      Parameter:
      result - the `GAsyncResult`
      Gibt zurück:
      %TRUE if the operation was successful, %FALSE if an error occurred. In this case, @error is set
      Löst aus:
      AllocationError
    • dmabufErrorQuark

      public static int dmabufErrorQuark()
      Registers an error quark for [class@Gdk.DmabufTexture] errors.
      Gibt zurück:
      the error quark
    • dragActionIsUnique

      public static boolean dragActionIsUnique(int action)
      Checks if @action represents a single action or includes
      multiple actions.

      When @action is 0 - ie no action was given, %TRUE
      is returned.
      Parameter:
      action - a `GdkDragAction`
      Gibt zurück:
      %TRUE if exactly one action was given
    • glErrorQuark

      public static int glErrorQuark()
      Registers an error quark for [class@Gdk.GLContext] errors.
      Gibt zurück:
      the error quark
    • internMimeType

      public static Str internMimeType(@Nonnull Str string)
      Canonicalizes the given mime type and interns the result.

      If @string is not a valid mime type, %NULL is returned instead.
      See RFC 2048 for the syntax if mime types.
      Parameter:
      string - string of a potential mime type
      Gibt zurück:
      An interned string for the canonicalized mime type or %NULL if the string wasn't a valid mime type
    • keyvalFromName

      public static int keyvalFromName(@Nonnull Str keyval_name)
      Converts a key name to a key value.

      The names are the same as those in the
      `gdk/gdkkeysyms.h` header file
      but without the leading “GDK_KEY_”.
      Parameter:
      keyval_name - a key name
      Gibt zurück:
      the corresponding key value, or `GDK_KEY_VoidSymbol` if the key name is not a valid key
    • keyvalIsLower

      public static boolean keyvalIsLower(int keyval)
      Returns true if the given key value is in lower case.
      Parameter:
      keyval - a key value.
      Gibt zurück:
      true if @keyval is in lower case, or if @keyval is not subject to case conversion.
    • keyvalIsUpper

      public static boolean keyvalIsUpper(int keyval)
      Returns true if the given key value is in upper case.
      Parameter:
      keyval - a key value.
      Gibt zurück:
      true if @keyval is in upper case, or if @keyval is not subject to case conversion.
    • keyvalName

      public static Str keyvalName(int keyval)
      Converts a key value into a symbolic name.

      The names are the same as those in the
      `gdk/gdkkeysyms.h` header file
      but without the leading “GDK_KEY_”.
      Parameter:
      keyval - a key value
      Gibt zurück:
      a string containing the name of the key
    • keyvalToLower

      public static int keyvalToLower(int keyval)
      Converts a key value to lower case, if applicable.
      Parameter:
      keyval - a key value.
      Gibt zurück:
      the lower case form of @keyval, or @keyval itself if it is already in lower case or it is not subject to case conversion.
    • keyvalToUnicode

      public static int keyvalToUnicode(int keyval)
      Converts from a GDK key symbol to the corresponding Unicode
      character.

      Note that the conversion does not take the current locale
      into consideration, which might be expected for particular
      keyvals, such as `GDK_KEY_KP_Decimal`.
      Parameter:
      keyval - a GDK key symbol
      Gibt zurück:
      the corresponding unicode character, or 0 if there is no corresponding character.
    • keyvalToUpper

      public static int keyvalToUpper(int keyval)
      Converts a key value to upper case, if applicable.
      Parameter:
      keyval - a key value.
      Gibt zurück:
      the upper case form of @keyval, or @keyval itself if it is already in upper case or it is not subject to case conversion.
    • paintableNewEmpty

      public static Paintable paintableNewEmpty(int intrinsic_width, int intrinsic_height)
      Returns a paintable that has the given intrinsic size and draws nothing.

      This is often useful for implementing the
      [vfunc@Gdk.Paintable.get_current_image] virtual function
      when the paintable is in an incomplete state (like a
      [GtkMediaStream](../gtk4/class.MediaStream.html) before receiving
      the first frame).
      Parameter:
      intrinsic_width - The intrinsic width to report. Can be 0 for no width.
      intrinsic_height - The intrinsic height to report. Can be 0 for no height.
      Gibt zurück:
      a `GdkPaintable`
    • pixbufGetFromSurface

      @Deprecated public static Pixbuf pixbufGetFromSurface(@Nonnull Surface surface, int src_x, int src_y, int width, int height)
      Veraltet.
      Transfers image data from a `cairo_surface_t` and converts it
      to a `GdkPixbuf`.

      This allows you to efficiently read individual pixels from cairo surfaces.

      This function will create an RGB pixbuf with 8 bits per channel.
      The pixbuf will contain an alpha channel if the @surface contains one.
      Parameter:
      surface - surface to copy from
      src_x - Source X coordinate within @surface
      src_y - Source Y coordinate within @surface
      width - Width in pixels of region to get
      height - Height in pixels of region to get
      Gibt zurück:
      A newly-created pixbuf with a reference count of 1
    • pixbufGetFromTexture

      @Deprecated public static Pixbuf pixbufGetFromTexture(@Nonnull Texture texture)
      Veraltet.
      Creates a new pixbuf from @texture.

      This should generally not be used in newly written code as later
      stages will almost certainly convert the pixbuf back into a texture
      to draw it on screen.
      Parameter:
      texture - a `GdkTexture`
      Gibt zurück:
      a new `GdkPixbuf`
    • setAllowedBackends

      public static void setAllowedBackends(@Nonnull Str backends)
      Sets a list of backends that GDK should try to use.

      This can be useful if your application does not
      work with certain GDK backends.

      By default, GDK tries all included backends.

      For example:

      ```c
      gdk_set_allowed_backends ("wayland,macos,*");
      ```

      instructs GDK to try the Wayland backend first, followed by the
      MacOs backend, and then all others.

      If the `GDK_BACKEND` environment variable is set, it determines
      what backends are tried in what order, while still respecting the
      set of allowed backends that are specified by this function.

      The possible backend names are:

      - `broadway`
      - `macos`
      - `wayland`.
      - `win32`
      - `x11`

      You can also include a `*` in the list to try all remaining backends.

      This call must happen prior to functions that open a display, such
      as [func@Gdk.Display.open], `gtk_init()`, or `gtk_init_check()`
      in order to take effect.
      Parameter:
      backends - a comma-separated list of backends
    • textureErrorQuark

      public static int textureErrorQuark()
      Registers an error quark for [class@Gdk.Texture] errors.
      Gibt zurück:
      the error quark
    • unicodeToKeyval

      public static int unicodeToKeyval(int wc)
      Converts from a Unicode character to a key symbol.
      Parameter:
      wc - a Unicode character
      Gibt zurück:
      the corresponding GDK key symbol, if one exists, or, if there is no corresponding symbol, `wc | 0x01000000`
    • vulkanErrorQuark

      public static int vulkanErrorQuark()
      Registers an error quark for [class@Gdk.VulkanContext] errors.
      Gibt zurück:
      the error quark