gi-gdk-4.0.3: Gdk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
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 () 

This is 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 Rectangle

-> 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 Region

-> 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 Region; must be freed with cairo_region_destroy()

Creates region that describes 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 Pixbuf

-> 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 RGBA

-> m () 

Sets the specified RGBA as the source color of cr.

contentDeserializeAsync

contentDeserializeAsync Source #

Arguments

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

stream: a InputStream to read the serialized content from

-> Text

mimeType: the mime type to deserialize from

-> GType

type: the GType to deserialize from

-> Int32

ioPriority: the io priority of the operation

-> Maybe b

cancellable: optional Cancellable object

-> Maybe AsyncReadyCallback

callback: callback to call when the operation is done

-> m () 

Read content from the given input stream and deserialize it, asynchronously. When the operation is finished, callback will be called. You can then call contentDeserializeFinish to get the result of the operation.

contentDeserializeFinish

contentDeserializeFinish Source #

Arguments

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

result: the AsyncResult

-> 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 create objects of a given type from a serialized representation with the given mime 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 convert objects of the given type to a serialized representation with the given mime type.

contentSerializeAsync

contentSerializeAsync Source #

Arguments

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

stream: a OutputStream to write the serialized content to

-> Text

mimeType: the mime type to serialize to

-> GValue

value: the content to serialize

-> Int32

ioPriority: the io priority of the operation

-> Maybe b

cancellable: optional Cancellable object

-> Maybe AsyncReadyCallback

callback: callback to call when the operation is done

-> m () 

Serialize content and write it to the given output stream, asynchronously. When the operation is finished, callback will be called. You can then call contentSerializeFinish to get the result of the operation.

contentSerializeFinish

contentSerializeFinish Source #

Arguments

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

result: the AsyncResult

-> m ()

(Can throw GError)

Finishes a content serialization operation.

eventsGetAngle

eventsGetAngle Source #

Arguments

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

event1: first Event

-> b

event2: second Event

-> m (Bool, Double)

Returns: True if the angle could be calculated.

If both events contain X/Y information, this function will return True and return in angle the relative angle from event1 to event2. The rotation direction for positive angles is from the positive X axis towards the positive Y axis.

eventsGetCenter

eventsGetCenter Source #

Arguments

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

event1: first Event

-> b

event2: second Event

-> m (Bool, Double, Double)

Returns: True if the center could be calculated.

If both events contain X/Y information, the center of both coordinates will be returned in x and y.

eventsGetDistance

eventsGetDistance Source #

Arguments

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

event1: first Event

-> b

event2: second Event

-> m (Bool, Double)

Returns: True if the distance could be calculated.

If both events have X/Y information, the distance between both coordinates (as in a straight line going from event1 to event2) will be returned.

internMimeType

internMimeType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

string: string of a potential mime type

-> m 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 KEY_a, GDK_KEY_Enter, 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, or Nothing if keyval is not a valid key. The string should not be modified.

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 ISO10646 (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, or Nothing on error

Transfers image data from a Surface and converts it to an RGB(A) representation inside a Pixbuf. 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 Texture

-> m (Maybe Pixbuf)

Returns: a new Pixbuf or Nothing in case of an error

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,quartz,*");

instructs GDK to try the Wayland backend first, followed by the Quartz 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 x11, win32, quartz, broadway, wayland. You can also include a * in the list to try all remaining backends.

This call must happen prior to displayOpen, 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 ISO10646 encoded character

-> m Word32

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

Convert from a ISO10646 character to a key symbol.