A fuzzy logic C++ library
Classes | Namespaces | Defines | Typedefs | Enumerations
gapi_glue.hpp File Reference

Provides an interface for all the graphical stuff into a common graphical API (see Slifis Graphical API for plotting), so we can make the code independent from the used graphical library. More...

#include <gtk/gtk.h>
#include <string>
#include <algorithm>
#include <list>
+ Include dependency graph for gapi_glue.hpp:
+ This graph shows which files directly or indirectly include this file:

Classes

struct  slifis_plot::GAPI_COLOR
 Abstract color type, common for all graphicals back-ends. More...
struct  slifis_plot::GAPI_POINT
 Abstract integer 2D-point type (for pixels), common for all graphicals back-ends. More...
struct  slifis_plot::GAPI_gtk_window
 A wrapper over a GTK window. More...
struct  slifis_plot::CAIRO_GLOBALS
 Private class for static-related stuff of gapi, cairo version. More...

Namespaces

namespace  slifis_plot
 

This namespace includes both the set of interface functions to the backend graphical library and the plot classes, see Slifis Graphical API for plotting.


Defines

#define GAPI_EVENT_MOUSEMOVE   1
 Mouse event: move.
#define GAPI_EVENT_LBUTTONDOWN   2
 Mouse event: left button down.
#define GAPI_EVENT_LBUTTONUP   3
 Mouse event: left button up.
#define GAPI_EVENT_RBUTTONDOWN   4
 Mouse event: right button down.
#define GAPI_EVENT_RBUTTONUP   5
 Mouse event: right button up.

Typedefs

typedef cairo_surface_t slifis_plot::GAPI_IMAGE
typedef void slifis_plot::GAPI_FONT
typedef void(* slifis_plot::MouseCallback )(int event, int x, int y, int flags, void *param)

Enumerations

enum  slifis_plot::EN_LINE_TYPE { slifis_plot::en_aa_off, slifis_plot::en_aa_on }
 Line type, to enable or not anti-aliasing in function GAPI_DrawLine() More...
enum  slifis_plot::EN_TEXT_ORIENTATION { slifis_plot::EN_TXT_HORIZ, slifis_plot::EN_TXT_VERT }
 Orientation of text for text functions (ignored in OpenCv build) More...

Functions

Windowing and user-interface related functions
void slifis_plot::GAPI_CreateWindow (std::string name, int x0, int y0)
 Open a window.
void slifis_plot::GAPI_DestroyWindow (std::string wnd_name)
 Destroy the window wnd_name.
void slifis_plot::GAPI_MoveWindow (std::string wnd_name, int x, int y)
 Moves the window wnd_name.
void slifis_plot::GAPI_AssignCallback (std::string wnd_name, void(*userMouseCB)(int event, int x, int y, int flags, void *param), void *param)
 Assigns the user mouse callback userMouseCB to window wnd_name.
void slifis_plot::GAPI_ShowImage (std::string wnd_name, GAPI_IMAGE *im)
 Draw image on GTK window.
bool slifis_plot::GAPI_WindowIsOpen (std::string name)
 Returns true if window is open (GTK2 version)
char slifis_plot::GAPI_WaitKey ()
 Blocking function, until a key is pressed.
Drawing-related functions
void slifis_plot::GAPI_DrawText (GAPI_IMAGE *p_im, std::string txt, GAPI_POINT p, GAPI_FONT *, GAPI_COLOR col, EN_TEXT_ORIENTATION txt_or)
 Draws text on image (cairo version)
void slifis_plot::GAPI_DrawCircle (GAPI_IMAGE *p_im, GAPI_POINT p, double rad, GAPI_COLOR col, int line_width)
 Draw circle (Cairo version)
void slifis_plot::GAPI_DrawRectangle (GAPI_IMAGE *p_im, GAPI_POINT p1, GAPI_POINT p2, GAPI_COLOR col, bool is_filled)
 Draw rectangle (Cairo version)
void slifis_plot::GAPI_DrawLine (GAPI_IMAGE *p_im, GAPI_POINT p1, GAPI_POINT p2, GAPI_COLOR col, int line_width, EN_LINE_TYPE)
 Draw line (Cairo version)
void slifis_plot::GAPI_FillImage (GAPI_IMAGE *im, GAPI_COLOR col)
 Fill image im with color col (Cairo version)
Data-types handling
GAPI_POINT slifis_plot::GAPI_BuildPoint (int x0, int y0)
 C-style constructor for point.
GAPI_COLOR slifis_plot::GAPI_BuildColor (char r, char g, char b)
 C-style constructor for color.
void slifis_plot::GAPI_ReleaseImage (GAPI_IMAGE **p_im)
GAPI_IMAGE * slifis_plot::GAPI_CreateImage (int w, int h)
Misc.
bool slifis_plot::GAPI_SaveImage (std::string filename, GAPI_IMAGE *im)
 Saves image to file, returns false on failure.
int slifis_plot::GAPI_GetImageW (GAPI_IMAGE *p_im)
int slifis_plot::GAPI_GetImageH (GAPI_IMAGE *p_im)
void slifis_plot::GAPI_GetTextSize (GAPI_IMAGE *im, const std::string &txt, GAPI_FONT *, int &t_w, int &t_h)
 Returns size of text txt (Cairo version)
GAPI_FONT * slifis_plot::GAPI_InitFont ()
 Initializes font for drawing text (Cairo version, does nothing)
void slifis_plot::GAPI_Init (int argc, char **argv)
 Initialize the gtk windowing engine. Called each time a window is created.

Detailed Description

Provides an interface for all the graphical stuff into a common graphical API (see Slifis Graphical API for plotting), so we can make the code independent from the used graphical library.

At present, two backends libraries can be used

Selection is done through makefile.

The file is made of 4 parts:


Define Documentation

#define GAPI_EVENT_MOUSEMOVE   1
#define GAPI_EVENT_LBUTTONDOWN   2

Mouse event: left button down.

Referenced by slifis_plot::generic_mouse_callback(), Mouse_CB(), Mouse_CB_rb_2D(), and Mouse_CB_rb_text().

#define GAPI_EVENT_LBUTTONUP   3

Mouse event: left button up.

Referenced by slifis_plot::generic_mouse_callback().

#define GAPI_EVENT_RBUTTONDOWN   4

Mouse event: right button down.

Referenced by slifis_plot::generic_mouse_callback().

#define GAPI_EVENT_RBUTTONUP   5

Mouse event: right button up.

Referenced by slifis_plot::generic_mouse_callback().