Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
- Methods
- cairoDrawFromGl
- cairoRectangle
- cairoRegion
- cairoRegionCreateFromSurface
- cairoSetSourcePixbuf
- cairoSetSourceRgba
- contentDeserializeAsync
- contentDeserializeFinish
- contentRegisterDeserializer
- contentRegisterSerializer
- contentSerializeAsync
- contentSerializeFinish
- eventsGetAngle
- eventsGetCenter
- eventsGetDistance
- internMimeType
- keyvalConvertCase
- keyvalFromName
- keyvalIsLower
- keyvalIsUpper
- keyvalName
- keyvalToLower
- keyvalToUnicode
- keyvalToUpper
- pixbufGetFromSurface
- pixbufGetFromTexture
- setAllowedBackends
- toplevelSizeGetType
- unicodeToKeyval
Synopsis
- cairoDrawFromGl :: (HasCallStack, MonadIO m, IsSurface a) => Context -> a -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> m ()
- cairoRectangle :: (HasCallStack, MonadIO m) => Context -> Rectangle -> m ()
- cairoRegion :: (HasCallStack, MonadIO m) => Context -> Region -> m ()
- cairoRegionCreateFromSurface :: (HasCallStack, MonadIO m) => Surface -> m Region
- cairoSetSourcePixbuf :: (HasCallStack, MonadIO m, IsPixbuf a) => Context -> a -> Double -> Double -> m ()
- cairoSetSourceRgba :: (HasCallStack, MonadIO m) => Context -> RGBA -> m ()
- contentDeserializeAsync :: (HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) => a -> Text -> GType -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- contentDeserializeFinish :: (HasCallStack, MonadIO m, IsAsyncResult a) => a -> GValue -> m ()
- contentRegisterDeserializer :: (HasCallStack, MonadIO m) => Text -> GType -> ContentDeserializeFunc -> m ()
- contentRegisterSerializer :: (HasCallStack, MonadIO m) => GType -> Text -> ContentSerializeFunc -> m ()
- contentSerializeAsync :: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> Text -> GValue -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- contentSerializeFinish :: (HasCallStack, MonadIO m, IsAsyncResult a) => a -> m ()
- eventsGetAngle :: (HasCallStack, MonadIO m, IsEvent a, IsEvent b) => a -> b -> m (Bool, Double)
- eventsGetCenter :: (HasCallStack, MonadIO m, IsEvent a, IsEvent b) => a -> b -> m (Bool, Double, Double)
- eventsGetDistance :: (HasCallStack, MonadIO m, IsEvent a, IsEvent b) => a -> b -> m (Bool, Double)
- internMimeType :: (HasCallStack, MonadIO m) => Text -> m Text
- keyvalConvertCase :: (HasCallStack, MonadIO m) => Word32 -> m (Word32, Word32)
- keyvalFromName :: (HasCallStack, MonadIO m) => Text -> m Word32
- keyvalIsLower :: (HasCallStack, MonadIO m) => Word32 -> m Bool
- keyvalIsUpper :: (HasCallStack, MonadIO m) => Word32 -> m Bool
- keyvalName :: (HasCallStack, MonadIO m) => Word32 -> m (Maybe Text)
- keyvalToLower :: (HasCallStack, MonadIO m) => Word32 -> m Word32
- keyvalToUnicode :: (HasCallStack, MonadIO m) => Word32 -> m Word32
- keyvalToUpper :: (HasCallStack, MonadIO m) => Word32 -> m Word32
- pixbufGetFromSurface :: (HasCallStack, MonadIO m) => Surface -> Int32 -> Int32 -> Int32 -> Int32 -> m (Maybe Pixbuf)
- pixbufGetFromTexture :: (HasCallStack, MonadIO m, IsTexture a) => a -> m (Maybe Pixbuf)
- setAllowedBackends :: (HasCallStack, MonadIO m) => Text -> m ()
- toplevelSizeGetType :: (HasCallStack, MonadIO m) => m GType
- unicodeToKeyval :: (HasCallStack, MonadIO m) => Word32 -> m Word32
Methods
cairoDrawFromGl
:: (HasCallStack, MonadIO m, IsSurface a) | |
=> Context |
|
-> a |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> 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
:: (HasCallStack, MonadIO m) | |
=> Context |
|
-> Rectangle |
|
-> m () |
Adds the given rectangle to the current path of cr
.
cairoRegion
:: (HasCallStack, MonadIO m) | |
=> Context |
|
-> Region |
|
-> m () |
Adds the given region to the current path of cr
.
cairoRegionCreateFromSurface
cairoRegionCreateFromSurface Source #
:: (HasCallStack, MonadIO m) | |
=> Surface |
|
-> m Region | Returns: A |
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
:: (HasCallStack, MonadIO m, IsPixbuf a) | |
=> Context |
|
-> a |
|
-> Double |
|
-> Double |
|
-> 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
:: (HasCallStack, MonadIO m) | |
=> Context |
|
-> RGBA |
|
-> m () |
Sets the specified RGBA
as the source color of cr
.
contentDeserializeAsync
contentDeserializeAsync Source #
:: (HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) | |
=> a |
|
-> Text |
|
-> GType |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsAsyncResult a) | |
=> a |
|
-> GValue |
|
-> m () | (Can throw |
Finishes a content deserialization operation.
contentRegisterDeserializer
contentRegisterDeserializer Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> GType |
|
-> ContentDeserializeFunc |
|
-> m () |
Registers a function to create objects of a given type
from
a serialized representation with the given mime type.
contentRegisterSerializer
contentRegisterSerializer Source #
:: (HasCallStack, MonadIO m) | |
=> GType |
|
-> Text |
|
-> ContentSerializeFunc |
|
-> m () |
Registers a function to convert objects of the given type
to
a serialized representation with the given mime type.
contentSerializeAsync
contentSerializeAsync Source #
:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) | |
=> a |
|
-> Text |
|
-> GValue |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsAsyncResult a) | |
=> a |
|
-> m () | (Can throw |
Finishes a content serialization operation.
eventsGetAngle
:: (HasCallStack, MonadIO m, IsEvent a, IsEvent b) | |
=> a |
|
-> b |
|
-> m (Bool, Double) | Returns: |
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
:: (HasCallStack, MonadIO m, IsEvent a, IsEvent b) | |
=> a |
|
-> b |
|
-> m (Bool, Double, Double) | Returns: |
If both events contain X/Y information, the center of both coordinates
will be returned in x
and y
.
eventsGetDistance
:: (HasCallStack, MonadIO m, IsEvent a, IsEvent b) | |
=> a |
|
-> b |
|
-> m (Bool, Double) | Returns: |
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
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Text | Returns: An interned string for the canonicalized mime type
or |
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
:: (HasCallStack, MonadIO m) | |
=> Word32 |
|
-> m (Word32, Word32) |
keyvalFromName
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Word32 | Returns: the corresponding key value, or |
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
:: (HasCallStack, MonadIO m) | |
=> Word32 |
|
-> m Bool | Returns: |
Returns True
if the given key value is in lower case.
keyvalIsUpper
:: (HasCallStack, MonadIO m) | |
=> Word32 |
|
-> m Bool | Returns: |
Returns True
if the given key value is in upper case.
keyvalName
:: (HasCallStack, MonadIO m) | |
=> Word32 |
|
-> m (Maybe Text) | Returns: a string containing the name
of the key, or |
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
:: (HasCallStack, MonadIO m) | |
=> Word32 |
|
-> m Word32 | Returns: the lower case form of |
Converts a key value to lower case, if applicable.
keyvalToUnicode
:: (HasCallStack, MonadIO m) | |
=> Word32 |
|
-> 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
:: (HasCallStack, MonadIO m) | |
=> Word32 |
|
-> m Word32 | Returns: the upper case form of |
Converts a key value to upper case, if applicable.
pixbufGetFromSurface
:: (HasCallStack, MonadIO m) | |
=> Surface |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> m (Maybe Pixbuf) | Returns: A newly-created pixbuf with a
reference count of 1, or |
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
:: (HasCallStack, MonadIO m, IsTexture a) | |
=> a |
|
-> m (Maybe Pixbuf) |
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
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> 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
:: (HasCallStack, MonadIO m) | |
=> Word32 |
|
-> 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.