C++ Template Image Processing Library. |
[Introduction]- [News]- [Download]- [Screenshots]- [Tutorial]- [Forums-Eng]- [Forums-Fr]- [Reference]- [SourceForge Repository ]

- Main Page
- Modules
- Namespaces
- Classes

- Class List
- Class Hierarchy
- Class Members

# CImgDisplay Struct Reference

This class represents a window which can display CImg<T> images and handles mouse and keyboard events. More...

List of all members.

## Public Member Functions
| CImgDisplay (const unsigned int dimw, const unsigned int dimh, const char *title=0, const unsigned int normalization_type=1, const unsigned int events_type=3, const bool fullscreen_flag=false, const bool closed_flag=false)
| Create a display window with a specified size `pwidth` x `height`.
template<typename T>
| CImgDisplay (const CImg< T > &img, const char *title=0, const unsigned int normalization_type=1, const unsigned int events_type=3, const bool fullscreen_flag=false, const bool closed_flag=false)
| Create a display window from an image.
template<typename T>
| CImgDisplay (const CImgl< T > &list, const char *title=0, const unsigned int normalization_type=1, const unsigned int events_type=3, const bool fullscreen_flag=false, const bool closed_flag=false)
| Create a display window from an image list.
| CImgDisplay (const CImgDisplay &disp)
| Create a display window by copying another one.
| ~CImgDisplay ()
| Destructor.
CImgDisplay & | operator= (const CImgDisplay &disp)
| Assignement operator.
int | dimx () const
| Return display width.
int | dimy () const
| Return display height.
int | window_dimx () const
| Return display window width.
int | window_dimy () const
| Return display window height.
int | window_posx () const
| Return X-coordinate of the window.
int | window_posy () const
| Return Y-coordinate of the window.
CImgDisplay & | wait (const unsigned int milliseconds)
| Synchronized waiting function. Same as cimg::wait().
CImgDisplay & | wait ()
| Wait for an event.
float | frames_per_second ()
| Return the frame per second rate.
template<typename T>
CImgDisplay & | display (const CImgl< T > &list, const char axe='x', const char align='c')
| Display an image list CImgl<T> into a display window.
template<typename T>
CImgDisplay & | resize (const CImg< T > &img, const bool redraw=true)
| Resize a display window with the size of an image.
CImgDisplay & | resize (const CImgDisplay &disp, const bool redraw=true)
| Resize a display window using the size of the given display `disp`.
CImgDisplay & | resize (const bool redraw=true)
| Resize a display window in its current size.
template<typename tp, typename tf, typename T, typename to>
CImgDisplay & | display_object3d (const tp &points, const CImgl< tf > &primitives, const CImgl< T > &colors, const CImg< to > &opacities, const bool centering=true, const int render_static=4, const int render_motion=1, const bool double_sided=false, const float focale=500.0f, const float ambiant_light=0.05f, const bool display_axes=true, float *const pose_matrix=0)
| Display a 3d object.
template<typename tp, typename tf, typename T, typename to>
CImgDisplay & | display_object3d (const tp &points, const CImgl< tf > &primitives, const CImgl< T > &colors, const CImgl< to > &opacities, const bool centering=true, const int render_static=4, const int render_motion=1, const bool double_sided=false, const float focale=500.0f, const float ambiant_light=0.05f, const bool display_axes=true, float *const pose_matrix=0)
| Display a 3d object.
template<typename tp, typename tf, typename T>
CImgDisplay & | display_object3d (const tp &points, const CImgl< tf > &primitives, const CImgl< T > &colors, const bool centering=true, const int render_static=4, const int render_motion=1, const bool double_sided=false, const float focale=500.0f, const float ambiant_light=0.05f, const float opacity=1.0f, const bool display_axes=true, float *const pose_matrix=0)
| Display a 3D object.
CImgDisplay & | assign (const unsigned int dimw, const unsigned int dimh, const char *title=0, const unsigned int normalization_type=1, const unsigned int events_type=3, const bool fullscreen_flag=false, const bool closed_flag=false)
| In-place version of the corresponding constructor.
template<typename T>
CImgDisplay & | assign (const CImg< T > &img, const char *title=0, const unsigned int normalization_type=1, const unsigned int events_type=3, const bool fullscreen_flag=false, const bool closed_flag=false)
| In-place version of the corresponding constructor.
template<typename T>
CImgDisplay & | assign (const CImgl< T > &list, const char *title=0, const unsigned int normalization_type=1, const unsigned int events_type=3, const bool fullscreen_flag=false, const bool closed_flag=false)
| In-place version of the corresponding constructor.
CImgDisplay & | assign (const CImgDisplay &disp)
| In-place version of the corresponding constructor.
template<typename T>
CImgDisplay & | display (const CImg< T > &img)
| Display an image in a window.
CImgDisplay & | resize (const int width, const int height, const bool redraw=true)
| Resize window.
CImgDisplay & | move (const int posx, const int posy)
| Move window.
CImgDisplay & | show ()
| Show a closed display.
CImgDisplay & | close ()
| Close a visible display.
CImgDisplay & | set_title (const char *format,...)
| Set the window title.
CImgDisplay & | paint ()
| Re-paint image content in window.
template<typename T>
CImgDisplay & | render (const CImg< T > &img)
| Render image buffer into GDI native image format.
## Static Public Member Functions
static int | screen_dimx ()
| Return the width of the screen resolution.
static int | screen_dimy ()
| Return the height of the screen resolution.
static void | wait_all ()
| Wait for a window event in any CImg window.
## Public Attributes
unsigned int | width
| Width of the display.
unsigned int | height
| Height of the display.
unsigned int | normalization
| Normalization type used for the display.
unsigned int | events
| Range of events detected by the display.
bool | is_fullscreen
| Fullscreen state of the display.
char * | title
| Display title.
volatile int | window_x
| X-pos of the display on the screen.
volatile int | window_y
| Y-pos of the display on the screen.
volatile unsigned int | window_width
| Width of the underlying window.
volatile unsigned int | window_height
| Height of the underlying window.
volatile int | mouse_x
| X-coordinate of the mouse pointer on the display.
volatile int | mouse_y
| Y-coordinate of the mouse pointer on the display.
volatile unsigned int | button
| Button state of the mouse.
volatile int | wheel
| Wheel state of the mouse (Linux only).
volatile unsigned int | key
| Key value if pressed.
volatile bool | is_closed
| Closed state of the window.
volatile bool | is_resized
| Resized state of the window.
volatile bool | is_moved
| Moved state of the window.
volatile bool | is_event
| Event state of the window.

## Detailed Description

This class represents a window which can display CImg<T> images and handles mouse and keyboard events.

Creating a `CImgDisplay` instance opens a window that can be used to display a `CImg<T>` image of a `CImgl<T>` image list inside. When a display is created, associated window events (such as mouse motion, keyboard and window size changes) are handled and can be easily detected by testing specific `CImgDisplay` data fields. See Using Display Windows. for a complete tutorial on using the `CImgDisplay` class.

## Constructor & Destructor Documentation

CImgDisplay | ( | const unsigned int | dimw,
|  | const unsigned int | dimh,
|  | const char * | title = `0`,
|  | const unsigned int | normalization_type = `1`,
|  | const unsigned int | events_type = `3`,
|  | const bool | fullscreen_flag = `false`,
|  | const bool | closed_flag = `false`
| ) |

  | Create a display window with a specified size `pwidth` x `height`. Parameters:
  | dimw | : Width of the display window.
  | dimh | : Height of the display window.
  | title | : Title of the display window.
  | normalization_type | : Normalization type of the display window (see CImgDisplay::normalize).
  | events_type | : Type of events handled by the display window.
  | fullscreen_flag | : Fullscreen mode.
  | closed_flag | : Initially visible mode. A black image will be initially displayed in the display window.

CImgDisplay | ( | const CImg< T > & | img,
|  | const char * | title = `0`,
|  | const unsigned int | normalization_type = `1`,
|  | const unsigned int | events_type = `3`,
|  | const bool | fullscreen_flag = `false`,
|  | const bool | closed_flag = `false`
| ) |

  | Create a display window from an image. Parameters:
  | img | : Image that will be used to create the display window.
  | title | : Title of the display window
  | normalization_type | : Normalization type of the display window.
  | events_type | : Type of events handled by the display window.
  | fullscreen_flag | : Fullscreen mode.
  | closed_flag | : Initially visible mode.

CImgDisplay | ( | const CImgl< T > & | list,
|  | const char * | title = `0`,
|  | const unsigned int | normalization_type = `1`,
|  | const unsigned int | events_type = `3`,
|  | const bool | fullscreen_flag = `false`,
|  | const bool | closed_flag = `false`
| ) |

  | Create a display window from an image list. Parameters:
  | list | : The list of images to display.
  | title | : Title of the display window
  | normalization_type | : Normalization type of the display window.
  | events_type | : Type of events handled by the display window.
  | fullscreen_flag | : Fullscreen mode.
  | closed_flag | : Initially visible mode.

CImgDisplay | ( | const CImgDisplay & | disp | ) |

  | Create a display window by copying another one. Parameters:
  | win | : Display window to copy.
  | title | : Title of the new display window.

## Member Function Documentation

CImgDisplay& wait | ( | const unsigned int | milliseconds | ) |

| Synchronized waiting function. Same as cimg::wait(). See also: cimg::wait()

CImgDisplay& display | ( | const CImgl< T > & | list,
|  | const char | axe = `'x'`,
|  | const char | align = `'c'`
| ) |

  | Display an image list CImgl<T> into a display window. First, all images of the list are appended into a single image used for visualization, then this image is displayed in the current display window. Parameters:
  | list | : The list of images to display.
  | axe | : The axe used to append the image for visualization. Can be 'x' (default),'y','z' or 'v'.
  | align | : Defines the relative alignment of images when displaying images of different sizes. Can be '`c'` (centered, which is the default), '`p'` (top alignment) and '`n'` (bottom aligment).
See also: CImg::get_append()

CImgDisplay& resize | ( | const CImg< T > & | img,
|  | const bool | redraw = `true`
| ) |

  | Resize a display window with the size of an image. Parameters:
  | img | : Input image. `image.width` and `image.height` give the new dimensions of the display window.
  | redraw | : If `true` (default), the current displayed image in the display window will be bloc-interpolated to fit the new dimensions. If `false`, a black image will be drawn in the resized window.
See also: CImgDisplay::is_resized, CImgDisplay::resizedimx(), CImgDisplay::resizedimy()

The CImg Library - C++ Template Image Processing Library