LibCapy - display

Class to display graphics on screen, using GTK.

Macros:

Max length of the window's title

Size of the buffer for events

Enumerations:

None.

Typedefs:

Type for the time values of a CapyDisplay

Struct CapyDisplayKeyEvt :

Struct CapyDisplayKeyEvt's properties:

The key value. See the link below for a complete list of key values. https://gitlab.gnome.org/GNOME/gtk/blob/master/gdk/gdkkeysyms.h

Time of the event

Struct CapyDisplayKeyEvt's methods:

None.

Struct CapyDisplayMouseEvt :

Struct CapyDisplayMouseEvt's properties:

The coordinates in the display of the mouse at the time of the event

The coordinates in the image of the mouse at the time of the event

The type of event (GDK_BUTTON_PRESS or GDK_BUTTON_RELEASE)

Time of the event

Struct CapyDisplayMouseEvt's methods:

None.

Struct CapyDisplayCom :

Struct CapyDisplayCom's properties:

Flag to memorise the request from the client to close the CapyDisplay

Flag to memorise if the windows is displayed

Buffer to memorise the key pressed waiting to be processed by the user process

Buffer to memorise the mouse event waiting to be processed by the user process

Window's title

Current mouse position in pixel coordinates of the display. If the mouse moves out of the display, it is the last recorded position.

Display magnifier

Struct CapyDisplayCom's methods:

None.

Struct CapyDisplay :

Struct CapyDisplay's properties:

Dimensions of the CapyDisplay

GTK variables to manage the window

Variables to manage the two shared segments (one for the pixels value and for the communication between the CapyDisplay and the user process).

Chronometer to measure time since the Display is running

Handler called in the child process when the display is shown By default NULL, onShowArg is the argument passed to onShow

Handler called in the child process when the display is closed By default NULL, onCloseArg is the argument passed to onClose

Struct CapyDisplay's methods:

Destructor

Show a CapyDisplay on the screen. The display is centered on the screen.

Exception(s):

May raise CapyExc_ForkFailed

Close the window of the CapyDisplay

Return the last key pressed since the last call to getKeyPressed

Output and side effect(s):

Return the key event, or CapyDisplayKeyEvt.keyval=0 if there wasn't any key pressed. See the link below for a complete list of key values. https://gitlab.gnome.org/GNOME/gtk/blob/master/gdk/gdkkeysyms.h

Return the last mouse event since the last call to getMouseEvent

Output and side effect(s):

Return the mouse event, or CapyDisplayMouseEvt.type=0 if there wasn't any event.

Set the RGB value of a pixel in the CapyDisplay

Input argument(s):

pixel: the position of the pixel (from left to right and top to bottom)
color: the new color of the pixel (the alpha channel is forced to 1.0)

Copy a CapyImage into a CapyDisplay

Input argument(s):

img: the CapyImage to copy (the alpha channel is forced to 1.0)

Copy a CapyImage into a CapyDisplay after scaling and translating it with the CapyDisplayMagnifier

Input argument(s):

img: the CapyImage to copy (the alpha channel is forced to 1.0)

Check if a CapyDisplay is currently displayed

Output and side effect(s):

Return true if the CapyDisplay is displayed

Set the window's title

Input argument(s):

title: the new title

Get the time spent in millisecond since the CapyDisplay is displayed.

Set the magnifier scale to fit entirely the image in argument in the display. (The position is left unmodified)

Input argument(s):

img: the image to fit

Get the current mouse position in display coordinates (from left to right and top to bottom).

Output and side effect(s):

Return the position

Get the current mouse position converted to image coordinates.

Output and side effect(s):

Return the position

Functions:

Create a CapyDisplay

Input argument(s):

dim: the dimension of the display
title: title displayed in the title bar of the window of the CapyDisplay

Output and side effect(s):

Return a CapyDisplay

Exception(s):

May raise CapyExc_MallocFailed

Allocate memory for new CapyDisplay

Input argument(s):

dim: the dimension of the display
title: title displayed in the title bar of the window of the CapyDisplay

Output and side effect(s):

Return a newly allocated CapyDisplay

Exception(s):

May raise CapyExc_MallocFailed

Free the memory used by a CapyDisplay* and reset '*that' to NULL

Input argument(s):

display: the CapyDisplay to free

2021-11-02
in LibCapy,
72 views
Copyright 2021-2024 Baillehache Pascal