|
libcrn
3.9.5
A document image processing library
|
A widget that holds an image. More...
#include <GtkCRNImage.h>
Inheritance diagram for GtkCRN::Image:
Collaboration diagram for GtkCRN::Image:Classes | |
| struct | Line |
| struct | OverlayConfig |
| An overlay configuration. More... | |
| struct | OverlayItem |
| An overlay item. More... | |
| struct | Point |
| struct | Polygon |
| struct | Rectangle |
| struct | Text |
Public Types | |
| enum | MouseMode { MouseMode::NONE, MouseMode::SCROLL, MouseMode::DRAW, MouseMode::MOVE, MouseMode::STRETCH_LEFT, MouseMode::STRETCH_BOTTOM_LEFT, MouseMode::STRETCH_BOTTOM, MouseMode::STRETCH_BOTTOM_RIGHT, MouseMode::STRETCH_RIGHT, MouseMode::STRETCH_TOP_RIGHT, MouseMode::STRETCH_TOP, MouseMode::STRETCH_TOP_LEFT, MouseMode::MOVEPOINT, MouseMode::USER } |
| State of the mouse activity. More... | |
| enum | Overlay { Overlay::None = 0, Overlay::Rectangle, Overlay::Point, Overlay::Line, Overlay::Text, Overlay::User, Overlay::Polygon } |
| Overlay types and mouse selection modes. More... | |
Public Member Functions | |
| Image () | |
| Constructor. More... | |
| virtual | ~Image () override |
| Destructor. More... | |
| void | set_rulers_visible (bool is_visible) |
| Are the rulers visible? More... | |
| const crn::Point2DInt & | get_offset () |
| Returns to offset of the image (at scale 1:1) More... | |
| void | set_pixbuf (Glib::RefPtr< Gdk::Pixbuf > pb) |
| Sets the new image to display. More... | |
| double | get_zoom () const |
| Gets the zoom level. More... | |
| void | set_zoom (double z) |
| Sets the zoom level. More... | |
| void | zoom_in () |
| Increments the zoom level by 10%. More... | |
| void | zoom_out () |
| Decrements the zoom level by 10%. More... | |
| void | zoom_100 () |
| Sets the zoom level to 100%. More... | |
| void | zoom_fit () |
| Sets the zoom level to fit the image's size. More... | |
| void | focus_on (int x, int y) |
| Focus the image on a point. More... | |
| void | force_redraw () |
| Force the image to redraw. More... | |
| void | set_user_cursor (const Gdk::Cursor &cur) |
| Sets the cursor in user mouse mode. More... | |
| Glib::RefPtr< Gtk::ActionGroup > | get_actions () |
| Creates a tool button connected to the zoom_fit method. More... | |
| sigc::signal< void, crn::String, crn::String, MouseMode > | signal_overlay_changed () |
| Returns the signal associated to changes in selections. Binds to void on_overlay_changed(crn::String overlay_id, crn::String overlay_item_id, GtkCRN::Image::MouseMode mm). More... | |
| sigc::signal< void, guint, guint32, std::vector < std::pair< crn::String, crn::String > >, int, int > | signal_rmb_clicked () |
| Returns a signal that can be used to generate pop-up menus. Binds to void on_rmb_clicked(guint mouse_button, guint32 time, std::vector<std::pair<crn::String, crn::String> > overlay_items_under_mouse, int x_on_image, int y_on_image). More... | |
| sigc::signal< void, int, int > | signal_user_mouse () |
| Returns a signal that indicates a user mouse click. Binds to void on_mouse_clicked(int x, int y). More... | |
| sigc::signal< void, Glib::RefPtr< Gdk::Pixbuf > > | signal_drawing () |
| Returns a signal that indicates that the image will be redrawn. Binds to void on_redraw(Glib::RefPtr<Gdk::Pixbuf> new_image). More... | |
| sigc::signal< void > | signal_zoom_changed () |
| Returns a signal that indicates that the zoom was changed. Binds to void on_zoom_changed(). More... | |
| sigc::signal< void, int, int > | signal_scrolled_event () |
| Returns a signal emitted when the image is scrolled. Binds to void on_scroll(int x, int y). More... | |
| Gtk::Adjustment & | get_hadjustment () |
| Gets the horizontal adjustment of the scrollbars. More... | |
| Gtk::Adjustment & | get_vadjustment () |
| Gets the vertical adjustment of the scrollbars. More... | |
| OverlayConfig & | get_overlay_config (const crn::String &id) |
| Gets the configuration of an overlay. More... | |
| void | show_overlay (const crn::String &id) |
| Shows an hidden overlay. More... | |
| void | hide_overlay (const crn::String &id) |
| Hides an overlay. More... | |
| void | set_overlay_visible (const crn::String &id, bool visible) |
| Shows or hides an overlay. More... | |
| void | clear_overlays () |
| Clears all overlays. More... | |
| void | clear_overlay (const crn::String &id) |
| Clears an overlay. More... | |
| void | add_overlay_item (const crn::String &overlay_id, const crn::String &item_id, const crn::Rect &r, const crn::StringUTF8 &label="") |
| Adds a rectangle to an overlay. More... | |
| void | add_overlay_item (const crn::String &overlay_id, const crn::String &item_id, const crn::Point2DInt &point, const crn::StringUTF8 &label="") |
| Adds a point to an overlay. More... | |
| void | add_overlay_item (const crn::String &overlay_id, const crn::String &item_id, const crn::Point2DInt &p1, const crn::Point2DInt &p2, const crn::StringUTF8 &label="") |
| Adds a line to an overlay. More... | |
| void | add_overlay_item (const crn::String &overlay_id, const crn::String &item_id, const std::vector< crn::Point2DInt > &p, const crn::StringUTF8 &label="") |
| Adds a polygon to an overlay. More... | |
| void | add_overlay_item (const crn::String &overlay_id, const crn::String &item_id, std::vector< crn::Point2DInt > &&p, const crn::StringUTF8 &label="") |
| Adds a polygon to an overlay. More... | |
| void | add_overlay_item (const crn::String &overlay_id, const crn::String &item_id, const crn::StringUTF8 &label, const crn::Point2DInt &position) |
| Adds a text to an overlay. More... | |
| OverlayItem & | get_overlay_item (const crn::String &overlay_id, const crn::String &item_id) |
| Gets an overlay item. More... | |
| const OverlayItem & | get_overlay_item (const crn::String &overlay_id, const crn::String &item_id) const |
| Gets an overlay item. More... | |
| void | remove_overlay_item (const crn::String &overlay_id, const crn::String &item_id) |
| Removes an overlay item. More... | |
| void | set_selection_type (Overlay typ) |
| Sets the mouse selection type. More... | |
| Overlay | get_selection_type () const |
| Gets the mouse selection type. More... | |
| OverlayConfig & | get_selection_config () |
| Gets the mouse selection configuration. More... | |
| bool | has_selection () const |
| Is there a mouse selection? More... | |
| void | clear_selection () |
| Clears the mouse selection. More... | |
| const crn::Rect & | get_selection_as_rect () const |
| Gets the mouse selection as a rectangle. More... | |
| const crn::Point2DInt & | get_selection_as_point () const |
| Gets the mouse selection as a point. More... | |
| std::pair< crn::Point2DInt, crn::Point2DInt > | get_selection_as_line () const |
| Gets the mouse selection as a line. More... | |
| void | set_selection (const crn::Rect &r) |
| Sets the mouse selection. More... | |
| void | set_selection (const crn::Point2DInt &p) |
| Sets the mouse selection. More... | |
| void | set_selection (const crn::Point2DInt &p1, const crn::Point2DInt &p2) |
| Sets the mouse selection. More... | |
Static Public Member Functions | |
| static const crn::String & | selection_overlay () |
| Returns the name of the mouse selection overlay. More... | |
A widget that holds an image.
An image widget with scrollbars, optional rulers, zoom facilities and multiple selections.
Selections are combinations of a label and/or a rectangle. They are stored in selection lists that define the colors and the behaviour of the selections.
Definition at line 43 of file GtkCRNImage.h.
|
strong |
State of the mouse activity.
| Enumerator | |
|---|---|
| NONE | |
| SCROLL | |
| DRAW | |
| MOVE | |
| STRETCH_LEFT | |
| STRETCH_BOTTOM_LEFT | |
| STRETCH_BOTTOM | |
| STRETCH_BOTTOM_RIGHT | |
| STRETCH_RIGHT | |
| STRETCH_TOP_RIGHT | |
| STRETCH_TOP | |
| STRETCH_TOP_LEFT | |
| MOVEPOINT | |
| USER | |
Definition at line 116 of file GtkCRNImage.h.
|
strong |
Overlay types and mouse selection modes.
| Enumerator | |
|---|---|
| None | |
| Rectangle | |
| Point | |
| Line | |
| Text | |
| User | |
| Polygon | |
Definition at line 144 of file GtkCRNImage.h.
| Image::Image | ( | ) |
|
overridevirtual |
| void Image::add_overlay_item | ( | const crn::String & | overlay_id, |
| const crn::String & | item_id, | ||
| const crn::Rect & | r, | ||
| const crn::StringUTF8 & | label = "" |
||
| ) |
Adds a rectangle to an overlay.
Adds a rectangle to an overlay
| [in] | overlay_id | the id of the overlay in which the rectangle will be added |
| [in] | item_id | the id of the item to add |
| [in] | r | the rectangle to add |
| [in] | label | the label of the rectangle (optional) |
Definition at line 2023 of file GtkCRNImage.cpp.
| void Image::add_overlay_item | ( | const crn::String & | overlay_id, |
| const crn::String & | item_id, | ||
| const crn::Point2DInt & | point, | ||
| const crn::StringUTF8 & | label = "" |
||
| ) |
Adds a point to an overlay.
Adds a point to an overlay
| [in] | overlay_id | the id of the overlay in which the point will be added |
| [in] | item_id | the id of the item to add |
| [in] | point | the point to add |
| [in] | label | the label of the point (optional) |
Definition at line 2036 of file GtkCRNImage.cpp.
| void Image::add_overlay_item | ( | const crn::String & | overlay_id, |
| const crn::String & | item_id, | ||
| const crn::Point2DInt & | p1, | ||
| const crn::Point2DInt & | p2, | ||
| const crn::StringUTF8 & | label = "" |
||
| ) |
Adds a line to an overlay.
Adds a line to an overlay
| [in] | overlay_id | the id of the overlay in which the line will be added |
| [in] | item_id | the id of the item to add |
| [in] | p1 | the first point of the line |
| [in] | p2 | the second point of the line |
| [in] | label | the label of the line (optional) |
Definition at line 2050 of file GtkCRNImage.cpp.
| void Image::add_overlay_item | ( | const crn::String & | overlay_id, |
| const crn::String & | item_id, | ||
| const std::vector< crn::Point2DInt > & | p, | ||
| const crn::StringUTF8 & | label = "" |
||
| ) |
Adds a polygon to an overlay.
Adds a polygon to an overlay
| [in] | overlay_id | the id of the overlay in which the line will be added |
| [in] | item_id | the id of the item to add |
| [in] | p1 | the first point of the line |
| [in] | p2 | the second point of the line |
| [in] | label | the label of the line (optional) |
| ExceptionDimension | the polygon must have more than two points |
Definition at line 2077 of file GtkCRNImage.cpp.
| void Image::add_overlay_item | ( | const crn::String & | overlay_id, |
| const crn::String & | item_id, | ||
| std::vector< crn::Point2DInt > && | p, | ||
| const crn::StringUTF8 & | label = "" |
||
| ) |
Adds a polygon to an overlay.
Adds a polygon to an overlay
| [in] | overlay_id | the id of the overlay in which the line will be added |
| [in] | item_id | the id of the item to add |
| [in] | p1 | the first point of the line |
| [in] | p2 | the second point of the line |
| [in] | label | the label of the line (optional) |
| ExceptionDimension | the polygon must have more than two points |
Definition at line 2095 of file GtkCRNImage.cpp.
| void Image::add_overlay_item | ( | const crn::String & | overlay_id, |
| const crn::String & | item_id, | ||
| const crn::StringUTF8 & | label, | ||
| const crn::Point2DInt & | position | ||
| ) |
Adds a text to an overlay.
Adds a text to an overlay
| [in] | overlay_id | the id of the overlay in which the text will be added |
| [in] | item_id | the id of the item to add |
| [in] | label | the label of the point (optional) |
| [in] | position | the position of the text on the image |
Definition at line 2062 of file GtkCRNImage.cpp.
| void Image::clear_overlay | ( | const crn::String & | id | ) |
Clears an overlay.
Clears an overlay
| [in] | id | the id of the overlay |
Definition at line 2178 of file GtkCRNImage.cpp.
| void Image::clear_overlays | ( | ) |
| void Image::clear_selection | ( | ) |
Clears the mouse selection.
Clears the mouse selection
Definition at line 2202 of file GtkCRNImage.cpp.
| void Image::focus_on | ( | int | x, |
| int | y | ||
| ) |
Focus the image on a point.
Focuses the image on a point. If the point is outside of the image, the focus is made on the nearest point in the image.
| [in] | x | the abscissa of the point to focus on |
| [in] | y | the ordinate of the point to focus on |
Definition at line 271 of file GtkCRNImage.cpp.
|
inline |
Force the image to redraw.
Definition at line 82 of file GtkCRNImage.h.
|
inline |
Creates a tool button connected to the zoom_fit method.
Creates a tool button connected to the zoom_fit method. Valid names are:
Definition at line 112 of file GtkCRNImage.h.
|
inline |
Gets the horizontal adjustment of the scrollbars.
Definition at line 134 of file GtkCRNImage.h.
|
inline |
Returns to offset of the image (at scale 1:1)
Definition at line 62 of file GtkCRNImage.h.
|
inline |
Gets the configuration of an overlay.
Definition at line 232 of file GtkCRNImage.h.
| Image::OverlayItem & Image::get_overlay_item | ( | const crn::String & | overlay_id, |
| const crn::String & | item_id | ||
| ) |
Gets an overlay item.
Gets an overlay item
| crn::ExceptionDomain | Overlay not found |
| crn::ExceptionNotFound | Overlay item not found |
| [in] | overlay_id | the id of the overlay |
| [in] | item_id | the id of the item |
Definition at line 2112 of file GtkCRNImage.cpp.
| const Image::OverlayItem & Image::get_overlay_item | ( | const crn::String & | overlay_id, |
| const crn::String & | item_id | ||
| ) | const |
Gets an overlay item.
Gets an overlay item
| crn::ExceptionDomain | Overlay not found |
| crn::ExceptionNotFound | Overlay item not found |
| [in] | overlay_id | the id of the overlay |
| [in] | item_id | the id of the item |
Definition at line 2130 of file GtkCRNImage.cpp.
| std::pair< crn::Point2DInt, crn::Point2DInt > Image::get_selection_as_line | ( | ) | const |
Gets the mouse selection as a line.
Gets the mouse selection as a line
| crn::ExceptionNotFound | No selection found |
| crn::ExceptionDomain | The selection is not a line |
Definition at line 2262 of file GtkCRNImage.cpp.
| const crn::Point2DInt & Image::get_selection_as_point | ( | ) | const |
Gets the mouse selection as a point.
Gets the mouse selection as a point
| crn::ExceptionNotFound | No selection found |
| crn::ExceptionDomain | The selection is not a point |
Definition at line 2240 of file GtkCRNImage.cpp.
| const crn::Rect & Image::get_selection_as_rect | ( | ) | const |
Gets the mouse selection as a rectangle.
Gets the mouse selection as a rectangle
| crn::ExceptionNotFound | No selection found |
| crn::ExceptionDomain | The selection is not a rectangle |
Definition at line 2218 of file GtkCRNImage.cpp.
|
inline |
Gets the mouse selection configuration.
Definition at line 267 of file GtkCRNImage.h.
|
inline |
Gets the mouse selection type.
Definition at line 265 of file GtkCRNImage.h.
|
inline |
Gets the vertical adjustment of the scrollbars.
Definition at line 140 of file GtkCRNImage.h.
|
inline |
Gets the zoom level.
Definition at line 66 of file GtkCRNImage.h.
| bool Image::has_selection | ( | ) | const |
Is there a mouse selection?
Is there a mouse selection?
Definition at line 2192 of file GtkCRNImage.cpp.
|
inline |
Hides an overlay.
Definition at line 236 of file GtkCRNImage.h.
| void Image::remove_overlay_item | ( | const crn::String & | overlay_id, |
| const crn::String & | item_id | ||
| ) |
Removes an overlay item.
Removes an overlay item
| crn::ExceptionDomain | Overlay not found |
| crn::ExceptionNotFound | Overlay item not found |
| [in] | overlay_id | the id of the overlay |
| [in] | item_id | the id of the item |
Definition at line 2147 of file GtkCRNImage.cpp.
|
static |
Returns the name of the mouse selection overlay.
Definition at line 2207 of file GtkCRNImage.cpp.
| void Image::set_overlay_visible | ( | const crn::String & | id, |
| bool | visible | ||
| ) |
Shows or hides an overlay.
Shows or hides an overlay
| [in] | id | the id of the overlay |
| [in] | visible | shall the overlay be displayed? |
Definition at line 2338 of file GtkCRNImage.cpp.
| void Image::set_pixbuf | ( | Glib::RefPtr< Gdk::Pixbuf > | pb | ) |
Sets the new image to display.
Sets the new image to display
| [in] | pb | the new image (nullptr to unset the image) |
Definition at line 181 of file GtkCRNImage.cpp.
| void Image::set_rulers_visible | ( | bool | is_visible | ) |
Are the rulers visible?
Are the rulers visible?
| [in] | is_visible | are the ruler visible? |
Definition at line 161 of file GtkCRNImage.cpp.
| void Image::set_selection | ( | const crn::Rect & | r | ) |
Sets the mouse selection.
Sets the mouse selection
| crn::ExceptionInvalidArgument | The selection is not a rectangle |
| [in] | r | the new selection |
Definition at line 2283 of file GtkCRNImage.cpp.
| void Image::set_selection | ( | const crn::Point2DInt & | p | ) |
Sets the mouse selection.
Sets the mouse selection
| crn::ExceptionInvalidArgument | The selection is not a point |
| [in] | p | the new selection |
Definition at line 2300 of file GtkCRNImage.cpp.
| void Image::set_selection | ( | const crn::Point2DInt & | p1, |
| const crn::Point2DInt & | p2 | ||
| ) |
Sets the mouse selection.
Sets the mouse selection
| crn::ExceptionInvalidArgument | The selection is not a line |
| [in] | p1 | the first point of the new selection |
| [in] | p2 | the second point of the new selection |
Definition at line 2318 of file GtkCRNImage.cpp.
| void Image::set_selection_type | ( | Overlay | typ | ) |
Sets the mouse selection type.
Sets the mouse selection type
| [in] | typ | the type of selection. Can be Overlay::Rectangle, Overlay::Line, Overlay::Point, Overlay::None, Overlay::User |
Definition at line 1988 of file GtkCRNImage.cpp.
| void Image::set_user_cursor | ( | const Gdk::Cursor & | cur | ) |
Sets the cursor in user mouse mode.
Sets the cursor in user mouse mode
| [in] | cur | the cursor to use in user mouse mode |
Definition at line 293 of file GtkCRNImage.cpp.
| void Image::set_zoom | ( | double | z | ) |
Sets the zoom level.
Sets the zoom level
| Glib::OptionError | null or negative zoom |
| [in] | z | the new zoom level (must be > 0) |
Definition at line 206 of file GtkCRNImage.cpp.
|
inline |
Shows an hidden overlay.
Definition at line 234 of file GtkCRNImage.h.
|
inline |
Returns a signal that indicates that the image will be redrawn. Binds to void on_redraw(Glib::RefPtr<Gdk::Pixbuf> new_image).
Definition at line 124 of file GtkCRNImage.h.
|
inline |
Returns the signal associated to changes in selections. Binds to void on_overlay_changed(crn::String overlay_id, crn::String overlay_item_id, GtkCRN::Image::MouseMode mm).
Definition at line 118 of file GtkCRNImage.h.
|
inline |
Returns a signal that can be used to generate pop-up menus. Binds to void on_rmb_clicked(guint mouse_button, guint32 time, std::vector<std::pair<crn::String, crn::String> > overlay_items_under_mouse, int x_on_image, int y_on_image).
Definition at line 120 of file GtkCRNImage.h.
|
inline |
Returns a signal emitted when the image is scrolled. Binds to void on_scroll(int x, int y).
Definition at line 128 of file GtkCRNImage.h.
|
inline |
Returns a signal that indicates a user mouse click. Binds to void on_mouse_clicked(int x, int y).
Definition at line 122 of file GtkCRNImage.h.
|
inline |
Returns a signal that indicates that the zoom was changed. Binds to void on_zoom_changed().
Definition at line 126 of file GtkCRNImage.h.
| void Image::zoom_100 | ( | ) |
Sets the zoom level to 100%.
Sets the zoom level to 100%
Definition at line 243 of file GtkCRNImage.cpp.
| void Image::zoom_fit | ( | ) |
Sets the zoom level to fit the image's size.
Sets the zoom level to fit the image's size
Definition at line 254 of file GtkCRNImage.cpp.
| void Image::zoom_in | ( | ) |
Increments the zoom level by 10%.
Increments the zoom level by 10%
Definition at line 219 of file GtkCRNImage.cpp.
| void Image::zoom_out | ( | ) |
Decrements the zoom level by 10%.
Decrements the zoom level by 10%
Definition at line 230 of file GtkCRNImage.cpp.
1.8.6