Utility presenting a canvas to the user, along with a brush tool to paint on it using different shapes.
More...
#include <PaintingTool.hpp>
|
| enum class | Mode : int { DRAW = 0
, ERASE
} |
| | The effect of a brush stroke.
|
| |
| enum class | Shape : int { CIRCLE = 0
, SQUARE
, DIAMOND
, COUNT
} |
| | The shape of the brush.
|
| |
|
|
Texture | _canvas |
| | Scene rendering buffer.
|
| |
|
Texture | _visu |
| | Scene rendering buffer.
|
| |
|
Program * | _brushShader |
| | Program for the brush and its outline.
|
| |
|
std::vector< Mesh > | _brushes |
| | Brush shape geometries.
|
| |
|
glm::vec3 | _bgColor = glm::vec3(0.0f) |
| | Canvas color.
|
| |
|
glm::vec3 | _fgColor = glm::vec3(1.0f) |
| | Brush color.
|
| |
|
glm::vec2 | _drawPos = glm::vec2(0.0f) |
| | Current brush position.
|
| |
|
int | _radius = 40 |
| | Brush radius, in pixels.
|
| |
|
Mode | _mode = Mode::DRAW |
| | Current brush effect.
|
| |
|
Shape | _shape = Shape::CIRCLE |
| | Current brush shape.
|
| |
|
bool | _shouldClear = true |
| | Clear the canvas at the next frame.
|
| |
|
bool | _shouldDraw = false |
| | Apply the brush to the canvas at the next frame.
|
| |
|
GPUAsyncTask | _readbackTask = 0 |
| | Handle for color picker task.
|
| |
Utility presenting a canvas to the user, along with a brush tool to paint on it using different shapes.
◆ PaintingTool()
| PaintingTool::PaintingTool |
( |
unsigned int |
width, |
|
|
unsigned int |
height |
|
) |
| |
Constructor.
- Parameters
-
| width | the canvas width |
| height | the canvas height |
◆ draw()
| void PaintingTool::draw |
( |
| ) |
|
Draw the scene and effects
◆ resize()
| void PaintingTool::resize |
( |
uint |
width, |
|
|
uint |
height |
|
) |
| |
Handle a window resize event.
- Parameters
-
| width | the new width |
| height | the new height |
◆ texture()
| const Texture * PaintingTool::texture |
( |
| ) |
const |
|
inline |
Canvas content texture.
- Returns
- the canvas ID
◆ update()
| void PaintingTool::update |
( |
| ) |
|
Perform once-per-frame update (buttons, GUI,...)
◆ visuId()
| const Texture * PaintingTool::visuId |
( |
| ) |
const |
|
inline |
Texture containing the canvas and the brush shape outline, for visualisation.
- Returns
- the texture ID
The documentation for this class was generated from the following files:
- src/apps/imagefiltering/PaintingTool.hpp
- src/apps/imagefiltering/PaintingTool.cpp