hsqml-0.3.2.0: Haskell binding for Qt Quick

Safe HaskellNone
LanguageHaskell2010

Graphics.QML.Canvas

Description

Facility for drawing OpenGL graphics into the QML scenegraph.

To use this facility, you must place a HaskellCanvas item into your QML scene. This item can be imported from the HsQML.Canvas 1.0 namespace using the import statement in your QML script. It has several properties which can be set from QML:

displayMode
Specifies how the canvas is rendered with respect to the rest of the scene. Possible values are:
HaskellCanvas.Above
The canvas shares a buffer with the scenegraph and is painted top of other items.
HaskellCanvas.Inline
The canvas has its own framebuffer object and the contents of this buffer are painted inline with other items (default).
HaskellCanvas.Below
The canvas shares a buffer with the scenegraph and is painted underneath other items.
canvasWidth
Width of the framebuffer object in pixels. Defaults to the item width.
canvasHeight
Height of the framebuffer object in pixels. Defaults to the item height.
delegate
A marshalled OpenGLDelegate value which specifies the Haskell functions used to render the canvas.
model
A value passed to delegate's paint function. The canvas is repainted whenever this value changes.
status
Either HaskellCanvas.Okay or an error code (read only).

Synopsis

Documentation

data OpenGLDelegate

Delegate for painting OpenGL graphics.

newOpenGLDelegate :: (Marshal m, CanGetFrom m ~ Yes) => (OpenGLSetup -> IO i) -> (OpenGLPaint i m -> IO ()) -> (i -> IO ()) -> IO OpenGLDelegate

Creates a new OpenGLDelegate from setup, paint, and cleanup functions.

data OpenGLType

Represents the type of an OpenGL context.

Constructors

OpenGLDesktop

Desktop OpenGL context.

OpenGLES

OpenGL ES context.

data OpenGLSetup

Encapsulates parameters for OpenGL setup.

openGLType :: OpenGLSetup -> OpenGLType

Type of OpenGL context.

openGLMajor :: OpenGLSetup -> Int

Major version number of OpenGL context.

openGLMinor :: OpenGLSetup -> Int

Minor version number of OpenGL context.

data OpenGLPaint s m

Encapsulates parameters for OpenGL paint.

type OpenGLPaint' s = OpenGLPaint s Ignored

Specialised version of OpenGLPaint with no model.

setupData :: OpenGLPaint s m -> s

Gets the setup state.

modelData :: OpenGLPaint s m -> m

Gets the active model.

matrixPtr :: OpenGLPaint s m -> Ptr CFloat

Pointer to a 4 by 4 matrix which transform coordinates in the range (-1, -1) to (1, 1) on to the target rectangle in the scene.

itemWidth :: OpenGLPaint s m -> Float

Width of the canvas item in its local coordinate system.

itemHeight :: OpenGLPaint s m -> Float

Height of the canvas item in its local coordinate system.