gi-gdk-4.0.4: Gdk bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gdk.Functions

Description

 
Synopsis

Methods

cairoDrawFromGl

cairoDrawFromGl Source #

Arguments

:: (HasCallStack, MonadIO m, IsSurface a) 
=> Context

cr: a cairo context

-> a

surface: The surface we're rendering for (not necessarily into)

-> Int32

source: The GL ID of the source buffer

-> Int32

sourceType: The type of the source

-> Int32

bufferScale: The scale-factor that the source buffer is allocated for

-> Int32

x: The source x position in source to start copying from in GL coordinates

-> Int32

y: The source y position in source to start copying from in GL coordinates

-> Int32

width: The width of the region to draw

-> Int32

height: The height of the region to draw

-> m () 

The main way to draw GL content in GTK.

It takes a render buffer ID (sourceType == GL_RENDERBUFFER) or a texture id (sourceType == 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.

cairoRectangle

cairoRectangle Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Context

cr: a cairo context

-> Rectangle

rectangle: a GdkRectangle

-> m () 

Adds the given rectangle to the current path of cr.

cairoRegion

cairoRegion Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Context

cr: a cairo context

-> Region

region: a cairo_region_t

-> m () 

Adds the given region to the current path of cr.

cairoRegionCreateFromSurface

cairoRegionCreateFromSurface Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Surface

surface: a cairo surface

-> m Region

Returns: A cairo_region_t

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().

cairoSetSourcePixbuf

cairoSetSourcePixbuf Source #

Arguments

:: (HasCallStack, MonadIO m, IsPixbuf a) 
=> Context

cr: a cairo context

-> a

pixbuf: a GdkPixbuf

-> Double

pixbufX: X coordinate of location to place upper left corner of pixbuf

-> Double

pixbufY: Y coordinate of location to place upper left corner of pixbuf

-> m () 

Sets the given pixbuf as the source pattern for cr.

The pattern has an extend mode of ExtendNone and is aligned so that the origin of pixbuf is pixbufX, pixbufY.

cairoSetSourceRgba

cairoSetSourceRgba Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Context

cr: a cairo context

-> RGBA

rgba: a GdkRGBA

-> m () 

Sets the specified GdkRGBA as the source color of cr.

contentDeserializeAsync

contentDeserializeAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) 
=> a

stream: a GInputStream to read the serialized content from

-> Text

mimeType: the mime type to deserialize from

-> GType

type: the GType to deserialize from

-> Int32

ioPriority: the I/O priority of the operation

-> Maybe b

cancellable: optional GCancellable object

-> Maybe AsyncReadyCallback

callback: callback to call when the operation is done

-> m () 

Read content from the given input stream and deserialize it, asynchronously.

The default I/O priority is PRIORITY_DEFAULT (i.e. 0), and lower numbers indicate a higher priority.

When the operation is finished, callback will be called. You must then call contentDeserializeFinish to get the result of the operation.

contentDeserializeFinish

contentDeserializeFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsAsyncResult a) 
=> a

result: the GAsyncResult

-> GValue

value: return location for the result of the operation

-> m ()

(Can throw GError)

Finishes a content deserialization operation.

contentRegisterDeserializer

contentRegisterDeserializer Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

mimeType: the mime type which the function can deserialize from

-> GType

type: the type of objects that the function creates

-> ContentDeserializeFunc

deserialize: the callback

-> m () 

Registers a function to deserialize object of a given type.

contentRegisterSerializer

contentRegisterSerializer Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> GType

type: the type of objects that the function can serialize

-> Text

mimeType: the mime type to serialize to

-> ContentSerializeFunc

serialize: the callback

-> m () 

Registers a function to serialize objects of a given type.

contentSerializeAsync

contentSerializeAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) 
=> a

stream: a GOutputStream to write the serialized content to

-> Text

mimeType: the mime type to serialize to

-> GValue

value: the content to serialize

-> Int32

ioPriority: the I/O priority of the operation

-> Maybe b

cancellable: optional GCancellable object

-> Maybe AsyncReadyCallback

callback: callback to call when the operation is done

-> m () 

Serialize content and write it to the given output stream, asynchronously.

The default I/O priority is PRIORITY_DEFAULT (i.e. 0), and lower numbers indicate a higher priority.

When the operation is finished, callback will be called. You must then call contentSerializeFinish to get the result of the operation.

contentSerializeFinish

contentSerializeFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsAsyncResult a) 
=> a

result: the GAsyncResult

-> m ()

(Can throw GError)

Finishes a content serialization operation.

eventsGetAngle

eventsGetAngle Source #

Arguments

:: (HasCallStack, MonadIO m, IsEvent a, IsEvent b) 
=> a

event1: first GdkEvent

-> b

event2: second GdkEvent

-> m (Bool, Double)

Returns: True if the angle could be calculated.

Returns the relative angle from event1 to event2.

The relative angle is the angle between the X axis and the line through both events' positions. The rotation direction for positive angles is from the positive X axis towards the positive Y axis.

This assumes that both events have X/Y information. If not, this function returns False.

eventsGetCenter

eventsGetCenter Source #

Arguments

:: (HasCallStack, MonadIO m, IsEvent a, IsEvent b) 
=> a

event1: first GdkEvent

-> b

event2: second GdkEvent

-> m (Bool, Double, Double)

Returns: True if the center could be calculated.

Returns the point halfway between the events' positions.

This assumes that both events have X/Y information. If not, this function returns False.

eventsGetDistance

eventsGetDistance Source #

Arguments

:: (HasCallStack, MonadIO m, IsEvent a, IsEvent b) 
=> a

event1: first GdkEvent

-> b

event2: second GdkEvent

-> m (Bool, Double)

Returns: True if the distance could be calculated.

Returns the distance between the event locations.

This assumes that both events have X/Y information. If not, this function returns False.

internMimeType

internMimeType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

string: string of a potential mime type

-> m (Maybe Text)

Returns: An interned string for the canonicalized mime type or Nothing if the string wasn't a valid mime type

Canonicalizes the given mime type and interns the result.

If string is not a valid mime type, Nothing is returned instead. See RFC 2048 for the syntax if mime types.

keyvalConvertCase

keyvalConvertCase Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

symbol: a keyval

-> m (Word32, Word32) 

Obtains the upper- and lower-case versions of the keyval symbol.

Examples of keyvals are GDK_KEY_a, GDK_KEY_Enter, GDK_KEY_F1, etc.

keyvalFromName

keyvalFromName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

keyvalName: a key name

-> m Word32

Returns: the corresponding key value, or KEY_VoidSymbol if the key name is not a valid key

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_”.

keyvalIsLower

keyvalIsLower Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

keyval: a key value.

-> m Bool

Returns: True if keyval is in lower case, or if keyval is not subject to case conversion.

Returns True if the given key value is in lower case.

keyvalIsUpper

keyvalIsUpper Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

keyval: a key value.

-> m Bool

Returns: True if keyval is in upper case, or if keyval is not subject to case conversion.

Returns True if the given key value is in upper case.

keyvalName

keyvalName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

keyval: a key value

-> m (Maybe Text)

Returns: a string containing the name of the key

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_”.

keyvalToLower

keyvalToLower Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

keyval: a key value.

-> m Word32

Returns: the lower case form of keyval, or keyval itself if it is already in lower case or it is not subject to case conversion.

Converts a key value to lower case, if applicable.

keyvalToUnicode

keyvalToUnicode Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

keyval: a GDK key symbol

-> m Word32

Returns: the corresponding unicode character, or 0 if there is no corresponding character.

Convert 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 KEY_KP_Decimal.

keyvalToUpper

keyvalToUpper Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

keyval: a key value.

-> m Word32

Returns: the upper case form of keyval, or keyval itself if it is already in upper case or it is not subject to case conversion.

Converts a key value to upper case, if applicable.

pixbufGetFromSurface

pixbufGetFromSurface Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Surface

surface: surface to copy from

-> Int32

srcX: Source X coordinate within surface

-> Int32

srcY: Source Y coordinate within surface

-> Int32

width: Width in pixels of region to get

-> Int32

height: Height in pixels of region to get

-> m (Maybe Pixbuf)

Returns: A newly-created pixbuf with a reference count of 1

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.

pixbufGetFromTexture

pixbufGetFromTexture Source #

Arguments

:: (HasCallStack, MonadIO m, IsTexture a) 
=> a

texture: a GdkTexture

-> m (Maybe Pixbuf)

Returns: a new GdkPixbuf

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.

setAllowedBackends

setAllowedBackends Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

backends: a comma-separated list of backends

-> m () 

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 code

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 [funcgdk.Display.open], gtk_init(), or gtk_init_check() in order to take effect.

toplevelSizeGetType

toplevelSizeGetType :: (HasCallStack, MonadIO m) => m GType Source #

No description available in the introspection data.

unicodeToKeyval

unicodeToKeyval Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

wc: a Unicode character

-> m Word32

Returns: the corresponding GDK key symbol, if one exists. or, if there is no corresponding symbol, wc | 0x01000000

Convert from a Unicode character to a key symbol.