|
Webcam Tracker
V1.0
Using openCV and an Arduino Uno
|
A button that can be clicked. Member of GUI classes Graphic group. More...
#include <Button.h>
Classes | |
| struct | STYLE |
| Button style information. More... | |
Public Member Functions | |
| Button () | |
| Default constructor. | |
| Button (cv::Point startPoint, int height, cv::String text) | |
| Constructor. More... | |
| void | draw (cv::Mat *img) |
| Draws the button to the image matrix. More... | |
| void | setStartPoint (cv::Point startPoint) |
| Sets the topleft corner of the button. More... | |
| void | checkClick (int x, int y) |
| Checks if a mouse-click event happened inside the button. More... | |
| int | getWidth () |
| Gets the width of the button. More... | |
| bool | getClick () |
| Gets the button state. More... | |
Private Member Functions | |
| void | roundedRectangle (cv::Mat *img, cv::Point topLeft, cv::Point bottomRight, const cv::Scalar lineColor, const cv::Scalar fillColor, const int thickness, const int cornerRadius) |
| creates a rectangle with rounded corners More... | |
Private Attributes | |
| cv::Point | startPoint |
| X and Y coordinate of the topleft corner in pixels. | |
| cv::Size | size |
| Height and Width of the button in pixels. | |
| cv::String | text |
| Button Text. | |
| bool | clicked |
| Button state. | |
| cv::Mat * | img |
| Pointer to the img where the button should be drawn. | |
| struct Button::STYLE | style |
| button style information | |
A button that can be clicked. Member of GUI classes Graphic group.
| Button::Button | ( | cv::Point | startPoint, |
| int | height, | ||
| cv::String | text | ||
| ) |
Constructor.
| startPoint | X and Y coordinate of the topleft corner in pixels |
| height | Height of the button in pixels |
| text | Button text |
|
private |
creates a rectangle with rounded corners
First draws the four edges, than draws the corners and last fills the rectangle.
| img | Pointer to the img where the rounded rectangle should be drawn |
| topLeft | X and Y coordinate of the topleft corner in pixels |
| bottomRight | X and Y coordinate of the bottomright corner in pixels |
| lineColor | color of the button edge(line) |
| fillColor | color of the button |
| thickness | line thickness |
| cornerRadius | size of the rounded corner radius in pixels |
| void Button::draw | ( | cv::Mat * | img | ) |
Draws the button to the image matrix.
the color of the line is based on the button state. The text is always centered in the middle of the button.
| img | Pointer to the image where the button should be drawn |
| void Button::setStartPoint | ( | cv::Point | startPoint | ) |
Sets the topleft corner of the button.
is used to shift the startpoints of the buttons when creating the GUI.
| startPoint | X and Y coordinate of the topleft corner in pixels |
| void Button::checkClick | ( | int | x, |
| int | y | ||
| ) |
Checks if a mouse-click event happened inside the button.
| x | X-part of the mouse event Coordinate |
| y | Y-part of the mouse event Coordinate |
| int Button::getWidth | ( | ) |
| bool Button::getClick | ( | ) |