Image Component Library (ICL)
|
Class for openGL-based image visualization components. More...
#include <Widget.h>
Public Types | |
enum | fitmode { fmNoScale =0, fmHoldAR =1, fmFit =2, fmZoom =3 } |
determines how the image is fit into the widget geometry More... | |
enum | rangemode { rmOn = 1, rmOff = 2, rmAuto } |
determines intensity adaption mode More... | |
typedef utils::Function< core::Color > | BGColorSource |
generic background color creator plugin More... | |
Signals | |
void | mouseEvent (const MouseEvent &event) |
invoked when any mouse interaction was performed More... | |
void | specialButtonClicked (const std::string &id) |
synchronizes special button clicks with GUI thread More... | |
void | specialButtonToggled (const std::string &id, bool down) |
synchronizes special toggle button clicks with GUI thread More... | |
Public Member Functions | |
ICLWidget (QWidget *parent=0) | |
creates a new ICLWidget within the parent widget More... | |
virtual | ~ICLWidget () |
destructor More... | |
virtual void | initializeGL () |
GLContext initialization. More... | |
virtual void | resizeGL (int w, int h) |
called by resizeEvent to adapt the current GL-Viewport More... | |
virtual void | paintGL () |
draw function More... | |
virtual void | paintEvent (QPaintEvent *e) |
drawing function for NO-GL fallback More... | |
virtual void | customPaintEvent (PaintEngine *e) |
this function can be overwritten do draw additional misc using the given PaintEngine More... | |
virtual void | setVisible (bool visible) |
void | setFitMode (fitmode fm) |
sets the current fitmode More... | |
void | setRangeMode (rangemode rm) |
sets the current rangemode More... | |
void | setBCI (int brightness, int contrast, int intensity) |
set up current brightness, contrast and intensity adaption values More... | |
utils::Size | getSize () |
returns the widgets size as icl::Size More... | |
utils::Size | getImageSize (bool fromGUIThread=false) |
returns the current images size More... | |
utils::Rect | getImageRect (bool fromGUIThread=false) |
returns the rect, that is currently used to draw the image into More... | |
fitmode | getFitMode () |
returns current fit-mode More... | |
rangemode | getRangeMode () |
returns current range mode More... | |
std::vector< std::string > | getImageInfo () |
returns a list of image specification string (used by the OSD) More... | |
void | install (MouseHandler *h) |
adds a new mouse handler via signal-slot connection More... | |
void | uninstall (MouseHandler *h) |
deletes mouse handler connection More... | |
void | registerCallback (const GUI::Callback &cb, const std::string &eventList="drag,press") |
registers a simple callback More... | |
void | removeCallbacks () |
removes all callbacks registered using registerCallback More... | |
void | render () |
re-renders the widget (thread-safe) More... | |
virtual bool | event (QEvent *event) |
overloaded event function processing special thread save update events More... | |
const ImageStatistics & | getImageStatistics () |
returns current ImageStatistics struct (used by OSD) More... | |
void | setMenuEnabled (bool enabled) |
if the menu is disabled, there will be no menu button at the top left of the widget More... | |
void | setImageInfoIndicatorEnabled (bool enabled) |
This can be used in order to hide to label at the lower right image rect. More... | |
void | setShowNoImageWarnings (bool showWarnings) |
sets wheather to notify, that no image was set More... | |
void | setViewPort (const utils::Size &size) |
Sets a viewport size that is used if no image was set. More... | |
void | setFullScreenMode (bool on, int screen=-1) |
show the widget on fullscreen on the (or returns to the original embedded state) More... | |
void | addSpecialToggleButton (const std::string &id, const core::ImgBase *untoggledIcon=0, const core::ImgBase *toggledIcon=0, bool initiallyToggled=0, const utils::Function< void, bool > &cb=(utils::FunctionImpl< void, bool > *) 0, const std::string &toolTipText="") |
Adds a new toggle-button to the OSD-button bar on the upper widget edge. More... | |
void | addSpecialButton (const std::string &id, const core::ImgBase *icon=0, const utils::Function< void > &cb=(utils::FunctionImpl< void > *) 0, const std::string &toolTipText="") |
Adds a new toggle-button to the OSD-button bar on the upper widget edge. More... | |
void | setInfoText (const std::string &text) |
sets an info text, is shown as a dialog when pressing an extra info button More... | |
void | removeSpecialButton (const std::string &id) |
removes special button with given ID More... | |
void | setAutoRenderOnSetImage (bool on) |
sets whether the widget will automatically call render when setImage is called More... | |
void | setBackgroundColorSource (BGColorSource src) |
can be used to replace the default OSD-GUI based background color source More... | |
void | startRecording (const std::string &outputDevice, const std::string &outputInfo, bool framebuffer=true, int frameskip=0, bool setParamsOnlyButDoNotStartRecording=false) |
sets up the capturing GUI and immediately initialized the internal capturer More... | |
void | registerRecordingCallback (utils::Function< void, const core::ImgBase * > cb, const std::string &handle="default") |
adds a callback function that is executed each time an image is recorded! More... | |
void | unregisterRecordingCallback (const std::string &handle="default") |
removes a recording callback function More... | |
virtual void | mousePressEvent (QMouseEvent *e) |
virtual void | mouseReleaseEvent (QMouseEvent *e) |
virtual void | mouseMoveEvent (QMouseEvent *e) |
virtual void | enterEvent (QEvent *e) |
virtual void | leaveEvent (QEvent *e) |
virtual void | resizeEvent (QResizeEvent *e) |
virtual void | wheelEvent (QWheelEvent *e) |
virtual void | hideEvent (QHideEvent *e) |
virtual void | keyPressEvent (QKeyEvent *event) |
listens for F11 which enables the fullscreen mode More... | |
Protected Member Functions | |
void | showInfoDialog () |
shows a help dialog More... | |
virtual void | swapQueues () |
this is reimplemented by the DrawWidget and by the DrawWidget3D for internal buffers swapping More... | |
Private Slots | |
void | reEmbed () |
internally used for re-embedding ... More... | |
Private Member Functions | |
const core::Img8u & | grabFrameBufferICL () |
internally used, grabs the current framebuffer as core::Img8u More... | |
std::string | getImageCaptureFileName () |
internal utility function More... | |
void | updateInfoTab () |
internal utility function More... | |
void | rebufferImageInternal () |
just internally used More... | |
const MouseEvent & | createMouseEvent (MouseEventType type) |
creates internal event instance More... | |
Private Attributes | |
Data * | m_data |
Internal data class (large, so it's hidden) More... | |
Friends | |
class | OSDGLButton |
just used internally More... | |
Class for openGL-based image visualization components.
The ICLWidget class provide ICL's fundamental abilities for real-time image visualization. It always comes up with a set of special buttons, that are used to affect the image display in real-time. The left-most button shows an extra menu, which provides a larger set of additional options. The widget can be embedded to external Qt-based GUI-applications. However, we recomment to use ICL's GUI-Creation-Framework rather than using the ICLWidget class directly
Internally, the icl::qt:GLImg is used for OpenGL-texture-based image rendering. This allows image hardware-scaling -zooming, -intensity and -contrast-adaption.
generic background color creator plugin
determines how the image is fit into the widget geometry
icl::qt::ICLWidget::ICLWidget | ( | QWidget * | parent = 0 | ) |
creates a new ICLWidget within the parent widget
|
virtual |
destructor
void icl::qt::ICLWidget::addSpecialButton | ( | const std::string & | id, |
const core::ImgBase * | icon = 0 , |
||
const utils::Function< void > & | cb = (utils::FunctionImpl< void > *) 0 , |
||
const std::string & | toolTipText = "" |
||
) |
Adds a new toggle-button to the OSD-button bar on the upper widget edge.
void icl::qt::ICLWidget::addSpecialToggleButton | ( | const std::string & | id, |
const core::ImgBase * | untoggledIcon = 0 , |
||
const core::ImgBase * | toggledIcon = 0 , |
||
bool | initiallyToggled = 0 , |
||
const utils::Function< void, bool > & | cb = (utils::FunctionImpl< void, bool > *) 0 , |
||
const std::string & | toolTipText = "" |
||
) |
Adds a new toggle-button to the OSD-button bar on the upper widget edge.
Special buttons can directly be attached to specific ICLWidget slots, furthermore special button- clicks and toggle events are notified using the ICLWidget-signals specialButtonClicked and specialButtonToggled.
id | handle to reference the button lateron |
untoggledIcon | optional button icon(recommeded: use buttons from the ICLQt::IconFactory class) |
toggledIcon | optional button icon (recommeded: use buttons from the ICLQt::IconFactory class) |
initiallyToggled | |
cb | |
toolTipText |
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
|
private |
creates internal event instance
|
slot |
|
virtual |
this function can be overwritten do draw additional misc using the given PaintEngine
Reimplemented in icl::qt::ICLDrawWidget, and icl::qt::ICLDrawWidget3D.
|
virtual |
|
virtual |
overloaded event function processing special thread save update events
fitmode icl::qt::ICLWidget::getFitMode | ( | ) |
returns current fit-mode
|
private |
internal utility function
std::vector<std::string> icl::qt::ICLWidget::getImageInfo | ( | ) |
returns a list of image specification string (used by the OSD)
utils::Rect icl::qt::ICLWidget::getImageRect | ( | bool | fromGUIThread = false | ) |
returns the rect, that is currently used to draw the image into
utils::Size icl::qt::ICLWidget::getImageSize | ( | bool | fromGUIThread = false | ) |
returns the current images size
const ImageStatistics& icl::qt::ICLWidget::getImageStatistics | ( | ) |
returns current ImageStatistics struct (used by OSD)
rangemode icl::qt::ICLWidget::getRangeMode | ( | ) |
returns current range mode
|
inline |
returns the widgets size as icl::Size
|
private |
internally used, grabs the current framebuffer as core::Img8u
|
virtual |
|
slot |
|
virtual |
GLContext initialization.
void icl::qt::ICLWidget::install | ( | MouseHandler * | h | ) |
adds a new mouse handler via signal-slot connection
Ownership is not passed !
|
slot |
|
virtual |
listens for F11 which enables the fullscreen mode
|
virtual |
|
slot |
|
signal |
invoked when any mouse interaction was performed
|
virtual |
|
virtual |
|
virtual |
|
virtual |
drawing function for NO-GL fallback
|
virtual |
draw function
|
slot |
|
private |
just internally used
|
slot |
|
privateslot |
internally used for re-embedding ...
void icl::qt::ICLWidget::registerCallback | ( | const GUI::Callback & | cb, |
const std::string & | eventList = "drag,press" |
||
) |
registers a simple callback
cb | callback functor to use |
eventList | comma-separated list of events. Supported types are:
|
void icl::qt::ICLWidget::registerRecordingCallback | ( | utils::Function< void, const core::ImgBase * > | cb, |
const std::string & | handle = "default" |
||
) |
adds a callback function that is executed each time an image is recorded!
TODO: Use a non-default handle to manage different callbacks in parallel. use startRecording("null","",...) to use the callbacks without actually recording images.
void icl::qt::ICLWidget::removeCallbacks | ( | ) |
removes all callbacks registered using registerCallback
void icl::qt::ICLWidget::removeSpecialButton | ( | const std::string & | id | ) |
removes special button with given ID
void icl::qt::ICLWidget::render | ( | ) |
re-renders the widget (thread-safe)
in subclasses,
|
virtual |
|
virtual |
called by resizeEvent to adapt the current GL-Viewport
|
slot |
void icl::qt::ICLWidget::setAutoRenderOnSetImage | ( | bool | on | ) |
sets whether the widget will automatically call render when setImage is called
Default is true for the ICLWidget class and false for the Derived classes ICLDrawWidget and ICLDrawWidget3D
|
slot |
void icl::qt::ICLWidget::setBackgroundColorSource | ( | BGColorSource | src | ) |
can be used to replace the default OSD-GUI based background color source
The background color source can e.g. be adapted by higher level visualization tool, such as the geom::Scene. In this case, the default background color source (background color can be adjusted by the widget's OSD-menu cannot be used any more
|
slot |
|
slot |
void icl::qt::ICLWidget::setBCI | ( | int | brightness, |
int | contrast, | ||
int | intensity | ||
) |
set up current brightness, contrast and intensity adaption values
|
slot |
void icl::qt::ICLWidget::setFitMode | ( | fitmode | fm | ) |
sets the current fitmode
void icl::qt::ICLWidget::setFullScreenMode | ( | bool | on, |
int | screen = -1 |
||
) |
show the widget on fullscreen on the (or returns to the original embedded state)
optionally, a screen can be passed on which the widget is to be shown in fullscreen mode
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
sets up the current image
void icl::qt::ICLWidget::setImageInfoIndicatorEnabled | ( | bool | enabled | ) |
This can be used in order to hide to label at the lower right image rect.
void icl::qt::ICLWidget::setInfoText | ( | const std::string & | text | ) |
sets an info text, is shown as a dialog when pressing an extra info button
If the info text is set, an extra info (Question-Mark) button is created, that shows an information dialog with this text, when pressed)
|
slot |
|
slot |
void icl::qt::ICLWidget::setMenuEnabled | ( | bool | enabled | ) |
if the menu is disabled, there will be no menu button at the top left of the widget
void icl::qt::ICLWidget::setRangeMode | ( | rangemode | rm | ) |
sets the current rangemode
|
slot |
void icl::qt::ICLWidget::setShowNoImageWarnings | ( | bool | showWarnings | ) |
sets wheather to notify, that no image was set
|
slot |
void icl::qt::ICLWidget::setViewPort | ( | const utils::Size & | size | ) |
Sets a viewport size that is used if no image was set.
if no image was set, then the OpenGL viewport is adapted as if there was an image with this size. If the given size is utils::Size::null the viewport is not adated
|
virtual |
|
slot |
|
slot |
|
slot |
|
protected |
shows a help dialog
|
slot |
|
signal |
synchronizes special button clicks with GUI thread
|
signal |
synchronizes special toggle button clicks with GUI thread
void icl::qt::ICLWidget::startRecording | ( | const std::string & | outputDevice, |
const std::string & | outputInfo, | ||
bool | framebuffer = true , |
||
int | frameskip = 0 , |
||
bool | setParamsOnlyButDoNotStartRecording = false |
||
) |
sets up the capturing GUI and immediately initialized the internal capturer
|
slot |
|
inlineprotectedvirtual |
this is reimplemented by the DrawWidget and by the DrawWidget3D for internal buffers swapping
swapQueues is automatically called by render
Reimplemented in icl::qt::ICLDrawWidget.
void icl::qt::ICLWidget::uninstall | ( | MouseHandler * | h | ) |
deletes mouse handler connection
Ownership was not passed -> h is not deleted
void icl::qt::ICLWidget::unregisterRecordingCallback | ( | const std::string & | handle = "default" | ) |
removes a recording callback function
|
private |
internal utility function
|
virtual |
|
friend |
just used internally
|
private |
Internal data class (large, so it's hidden)