gi-clutter-1.0.2: clutter GObject bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Clutter.Objects.Image

Description

The Image structure contains private data and should only be accessed using the provided API.

Since: 1.10

Synopsis

Exported types

newtype Image Source #

Memory-managed wrapper type.

Constructors

Image (ManagedPtr Image) 

Instances

Instances details
Eq Image Source # 
Instance details

Defined in GI.Clutter.Objects.Image

Methods

(==) :: Image -> Image -> Bool #

(/=) :: Image -> Image -> Bool #

GObject Image Source # 
Instance details

Defined in GI.Clutter.Objects.Image

ManagedPtrNewtype Image Source # 
Instance details

Defined in GI.Clutter.Objects.Image

TypedObject Image Source # 
Instance details

Defined in GI.Clutter.Objects.Image

Methods

glibType :: IO GType #

HasParentTypes Image Source # 
Instance details

Defined in GI.Clutter.Objects.Image

IsGValue (Maybe Image) Source #

Convert Image to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Clutter.Objects.Image

type ParentTypes Image Source # 
Instance details

Defined in GI.Clutter.Objects.Image

class (GObject o, IsDescendantOf Image o) => IsImage o Source #

Type class for types which can be safely cast to Image, for instance with toImage.

Instances

Instances details
(GObject o, IsDescendantOf Image o) => IsImage o Source # 
Instance details

Defined in GI.Clutter.Objects.Image

toImage :: (MonadIO m, IsImage o) => o -> m Image Source #

Cast to Image, for types for which this is known to be safe. For general casts, use castTo.

Methods

new

imageNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Content

Returns: the newly created Image instance. Use objectUnref when done.

Creates a new Image instance.

Since: 1.10

setArea

imageSetArea Source #

Arguments

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

image: a Image

-> Ptr Word8

data: the image data, as an array of bytes

-> PixelFormat

pixelFormat: the Cogl pixel format of the image data

-> RectangleInt

rect: a rectangle indicating the area that should be set

-> Word32

rowStride: the length of each row inside data

-> m ()

(Can throw GError)

Sets the image data to be display by image, using rect to indicate the position and size of the image data to be set.

If the image does not have any image data set when this function is called, a new texture will be created with the size of the width and height of the rectangle, i.e. calling this function on a newly created Image will be the equivalent of calling imageSetData.

If the image data was successfully loaded, the image will be invalidated.

In case of error, the error value will be set, and this function will return False.

The image data is copied in texture memory.

Since: 1.10

setBytes

imageSetBytes Source #

Arguments

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

image: a Image

-> Bytes

data: the image data, as a Bytes

-> PixelFormat

pixelFormat: the Cogl pixel format of the image data

-> Word32

width: the width of the image data

-> Word32

height: the height of the image data

-> Word32

rowStride: the length of each row inside data

-> m ()

(Can throw GError)

Sets the image data stored inside a Bytes to be displayed by image.

If the image data was successfully loaded, the image will be invalidated.

In case of error, the error value will be set, and this function will return False.

The image data contained inside the Bytes is copied in texture memory, and no additional reference is acquired on the data.

Since: 1.12

setData

imageSetData Source #

Arguments

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

image: a Image

-> Ptr Word8

data: the image data, as an array of bytes

-> PixelFormat

pixelFormat: the Cogl pixel format of the image data

-> Word32

width: the width of the image data

-> Word32

height: the height of the image data

-> Word32

rowStride: the length of each row inside data

-> m ()

(Can throw GError)

Sets the image data to be displayed by image.

If the image data was successfully loaded, the image will be invalidated.

In case of error, the error value will be set, and this function will return False.

The image data is copied in texture memory.

The image data is expected to be a linear array of RGBA or RGB pixel data; how to retrieve that data is left to platform specific image loaders. For instance, if you use the GdkPixbuf library:

C code

 ClutterContent *image = clutter_image_new ();

 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (filename, NULL);

 clutter_image_set_data (CLUTTER_IMAGE (image),
                         gdk_pixbuf_get_pixels (pixbuf),
                         gdk_pixbuf_get_has_alpha (pixbuf)
                           ? COGL_PIXEL_FORMAT_RGBA_8888
                           : COGL_PIXEL_FORMAT_RGB_888,
                         gdk_pixbuf_get_width (pixbuf),
                         gdk_pixbuf_get_height (pixbuf),
                         gdk_pixbuf_get_rowstride (pixbuf),
                         &error);

 g_object_unref (pixbuf);

Since: 1.10