ImageWidget Class Reference
This class is an image container to display fawkes cameras (or image buffers) inside a Gtk::Container. More...
#include <fvwidgets/image_widget.h>
Classes | |
| class | RefThread |
Public Member Functions | |
| ImageWidget (unsigned int width, unsigned int height) | |
| Creates a new ImageWidget with predefined width and height. | |
| ImageWidget (Camera *cam, unsigned int refresh_delay=0, unsigned int width=0, unsigned int height=0) | |
| Creates a new ImageWidget with a Camera as image source. | |
| ImageWidget (BaseObjectType *cobject, Glib::RefPtr< Gnome::Glade::Xml > refxml) | |
| Constructor that can be used to instantiate an ImageWidget as a derived widget from a Glade file. | |
| virtual | ~ImageWidget () |
| Destructor. | |
| void | set_camera (Camera *cam, unsigned int refresh_delay=0) |
| Set the camera from which the ImageWidget obtains the images. | |
| void | enable_camera (bool enable) |
| En-/disable the camera. | |
| void | set_size (unsigned int width, unsigned int height) |
| Sets the size of the ImageWidget. | |
| virtual bool | show (colorspace_t colorspace, unsigned char *buffer, unsigned int width=0, unsigned int height=0) |
| Show image from given colorspace. | |
| void | set_refresh_delay (unsigned int refresh_delay) |
| Sets the refresh delay for automatic camera refreshes. | |
| void | refresh_cam () |
| Performs a refresh during the next loop of the refresh thread. | |
| unsigned int | get_width () const |
| Returns the image buffer width. | |
| unsigned int | get_height () const |
| Returns the image buffer height. | |
| Glib::RefPtr< Gdk::Pixbuf > | get_buffer () const |
| Returns the widgets pixel buffer (RGB!). | |
| void | set_rgb (unsigned int x, unsigned int y, unsigned char r, unsigned char g, unsigned char b) |
| Sets a pixel to the given RGB colors. | |
| void | set_rgb (unsigned int x, unsigned int y, RGB_t rgb) |
| Sets a pixel to the given RGB colors. | |
| bool | save_image (std::string filename, Glib::ustring type) const throw () |
| Saves the current content of the Image. | |
| void | save_on_refresh_cam (bool enabled, std::string path="", Glib::ustring type="", unsigned int img_num=0) |
| Saves the content of the image on every refresh. | |
| unsigned int | get_image_num () |
| Returns the latest image number. | |
| sigc::signal< void, colorspace_t, unsigned char *, unsigned int, unsigned int > & | signal_show () |
| Signal emits after a new buffer gets successfully shown (see. | |
Detailed Description
This class is an image container to display fawkes cameras (or image buffers) inside a Gtk::Container.
Definition at line 38 of file image_widget.h.
Constructor & Destructor Documentation
| ImageWidget::ImageWidget | ( | unsigned int | width, | |
| unsigned int | height | |||
| ) |
Creates a new ImageWidget with predefined width and height.
- Parameters:
-
width of the widget height of the widget
Definition at line 47 of file image_widget.cpp.
References set_size().
| ImageWidget::ImageWidget | ( | Camera * | cam, | |
| unsigned int | refresh_delay = 0, |
|||
| unsigned int | width = 0, |
|||
| unsigned int | height = 0 | |||
| ) |
Creates a new ImageWidget with a Camera as image source.
- Parameters:
-
cam the image source refresh_delay if greater 0 a thread gets created that refreshes the Image every refresh_delay milliseconds width of the widget (if not equal to the camera width the image gets scaled) height of the widget (if not equal to the camera height the image gets scaled)
Definition at line 67 of file image_widget.cpp.
References Camera::capture_time(), and set_size().
| ImageWidget::ImageWidget | ( | BaseObjectType * | cobject, | |
| Glib::RefPtr< Gnome::Glade::Xml > | refxml | |||
| ) |
Constructor that can be used to instantiate an ImageWidget as a derived widget from a Glade file.
Note: The ImageWidget (and its internal buffer) is set to the size as in the glade file, in case no camera is set afterwards. Use
- See also:
- ImageWidget::set_size() to resize the ImageWidget afterwards.
- Parameters:
-
cobject pointer to the base object refxml the Glade XML file
Definition at line 103 of file image_widget.cpp.
| ImageWidget::~ImageWidget | ( | ) | [virtual] |
Member Function Documentation
| void ImageWidget::enable_camera | ( | bool | enable | ) |
En-/disable the camera.
- Parameters:
-
enable if true the camera is enabled and the refresh thread is start, if false the refresh thread is stopped and the camera is disabled
Definition at line 167 of file image_widget.cpp.
| Glib::RefPtr< Gdk::Pixbuf > ImageWidget::get_buffer | ( | ) | const |
Returns the widgets pixel buffer (RGB!).
- Returns:
- the RGB pixel buffer
Definition at line 241 of file image_widget.cpp.
| unsigned int ImageWidget::get_height | ( | ) | const |
Returns the image buffer height.
- Returns:
- height of the contained image
Definition at line 231 of file image_widget.cpp.
| unsigned int ImageWidget::get_image_num | ( | ) |
Returns the latest image number.
- Returns:
- the latest image number
Definition at line 438 of file image_widget.cpp.
| unsigned int ImageWidget::get_width | ( | ) | const |
Returns the image buffer width.
- Returns:
- width of the contained image
Definition at line 221 of file image_widget.cpp.
| void ImageWidget::refresh_cam | ( | ) |
Performs a refresh during the next loop of the refresh thread.
Definition at line 365 of file image_widget.cpp.
| bool ImageWidget::save_image | ( | std::string | filename, | |
| Glib::ustring | type | |||
| ) | const throw () |
Saves the current content of the Image.
- Parameters:
-
filename of the output type of the output (By default, "jpeg", "png", "ico" and "bmp" are possible file formats to save in, but more formats may be installed. The list of all writable formats can be determined by using Gdk::Pixbuf::get_formats() with Gdk::PixbufFormat::is_writable().)
Definition at line 402 of file image_widget.cpp.
| void ImageWidget::save_on_refresh_cam | ( | bool | enable, | |
| std::string | path = "", |
|||
| Glib::ustring | type = "", |
|||
| unsigned int | img_num = 0 | |||
| ) |
Saves the content of the image on every refresh.
- Parameters:
-
enable enables or disables the feature path to save the images at type file type (
- See also:
- ImageWidget::save_image)
- Parameters:
-
img_num of which to start the numbering (actually the first image is numbered img_num + 1)
Definition at line 428 of file image_widget.cpp.
| void ImageWidget::set_camera | ( | Camera * | cam, | |
| unsigned int | refresh_delay = 0 | |||
| ) |
Set the camera from which the ImageWidget obtains the images.
Note: The size of the ImageWidget remains untouched and the cameras image gets scaled appropriately. Use ImageWidget::set_size(0, 0) to set the widget to the size of the camera.
- Parameters:
-
cam the camera refresh_delay the delay between two refreshs in milliseconds
Definition at line 133 of file image_widget.cpp.
References Camera::capture_time(), Camera::pixel_height(), Camera::pixel_width(), and set_size().
| void ImageWidget::set_refresh_delay | ( | unsigned int | refresh_delay | ) |
Sets the refresh delay for automatic camera refreshes.
- Parameters:
-
refresh_delay im [ms]
Definition at line 355 of file image_widget.cpp.
| void ImageWidget::set_rgb | ( | unsigned int | x, | |
| unsigned int | y, | |||
| RGB_t | rgb | |||
| ) |
Sets a pixel to the given RGB colors.
- Parameters:
-
x position of the pixel y position of the pixel rgb the color
Definition at line 269 of file image_widget.cpp.
| void ImageWidget::set_rgb | ( | unsigned int | x, | |
| unsigned int | y, | |||
| unsigned char | r, | |||
| unsigned char | g, | |||
| unsigned char | b | |||
| ) |
Sets a pixel to the given RGB colors.
- Parameters:
-
x position of the pixel y position of the pixel r component of the color g component of the color b component of the color
Definition at line 256 of file image_widget.cpp.
| void ImageWidget::set_size | ( | unsigned int | width, | |
| unsigned int | height | |||
| ) |
Sets the size of the ImageWidget.
Updates the internal buffer and the size request for the ImageWidget. If width and/or height are set to 0 (and a Camera is set) the ImageWidget will be set to the camera dimensions.
Note: The ImageWidget must be refreshed after changing its size!
- Parameters:
-
width The new width height The new height
Definition at line 189 of file image_widget.cpp.
References Camera::pixel_height(), and Camera::pixel_width().
Referenced by ImageWidget(), and set_camera().
| bool ImageWidget::show | ( | colorspace_t | colorspace, | |
| unsigned char * | buffer, | |||
| unsigned int | width = 0, |
|||
| unsigned int | height = 0 | |||
| ) | [virtual] |
Show image from given colorspace.
Warning: If width and/or height not set, it is assumed, that the given buffer has the same dimension as the widget.
- Parameters:
-
colorspace colorspace of the supplied buffer buffer image buffer width Width of the provided buffer (may be scaled to ImageWidget dimensions) height Height of the provided buffer (may be scaled to ImageWidget dimensions)
- Returns:
- TRUE if the buffer chould have been shown
Definition at line 292 of file image_widget.cpp.
References LossyScaler::scale(), LossyScaler::set_original_buffer(), LossyScaler::set_original_dimensions(), LossyScaler::set_scaled_buffer(), LossyScaler::set_scaled_dimensions(), and fawkes::Exception::what().
| sigc::signal< void, colorspace_t, unsigned char *, unsigned int, unsigned int > & ImageWidget::signal_show | ( | ) |
Signal emits after a new buffer gets successfully shown (see.
- See also:
- ImageWidget::show()).
- Returns:
- The signal_show signal
Definition at line 343 of file image_widget.cpp.
The documentation for this class was generated from the following files:
- src/firevision/fvwidgets/image_widget.h
- src/firevision/fvwidgets/image_widget.cpp

