Omnidome
Fulldome Mapping Software Toolkit
|
BlendBrush for drawing on the blendmask Holds an internal pixel buffer. More...
#include <BlendBrush.h>
Public Member Functions | |
BlendBrush () | |
Default constructor. More... | |
BlendBrush (QVector2D const &_size, float _feather=1.0) | |
Constructor with a size and feather value (1.0 by default) Updates internal pixel buffer. More... | |
QVector2D const & | size () const |
Returns brush size. More... | |
void | setSize (QVector2D const &_size) |
Sets size of the brush. Minimum size is 2 pixels, maximum size is 512 pixels. More... | |
void | changeSize (QVector2D const &_delta) |
Increase/Decrease size of the brush with a certain delta value Minimum size is 2 pixels, maximum size is 512 pixels. More... | |
float | feather () const |
Return feather value. More... | |
float | opacity () const |
Return opacity value. More... | |
void | setOpacity (float _opacity) |
Set opacity value Value must be between 0.0 and 1.0 and is clamped if necessary. A value 0.0 means a hard brush, a value of 1.0 means soft brush. More... | |
void | setFeather (float _feather) |
Set feather value Value must be between 0.0 and 1.0 and is clamped if necessary. A value 0.0 means a hard brush, a value of 1.0 means soft brush. More... | |
bool | invert () const |
Returns true if the brush is inverted (aka eraser mode) More... | |
void | setInvert (bool _invert) |
Sets inverted flag of the brush. More... | |
void | setBrush (QVector2D const &_size, float _feather, float _opacity, bool _invert) |
Set brush settings and generate pixel buffer. More... | |
void | stamp (const QPointF &_pos, Buffer< uint8_t > &_buf) const |
Draws internal pixel buffer in given blend buffer. More... | |
float | drawLine (const QPointF &_p0, const QPointF &_p1, Buffer< uint8_t > &_buf, float _leftOver=0.0) |
Draws a lot from point _p0 to _p1 on given pixel buffer. More... | |
Buffer< float > const & | buffer () const |
void | toStream (QDataStream &) const |
Write blend brush to stream. More... | |
void | fromStream (QDataStream &) |
Read blend brush from stream. More... | |
Private Member Functions | |
void | generate () |
Generate internal pixel buffer with given size and feather parameters. More... | |
Static Private Member Functions | |
static QVector2D | clampBrushSize (QVector2D const &) |
Keep brush size within certain limits. More... | |
Private Attributes | |
Buffer< float > | buffer_ |
Internal pixel buffer. More... | |
float | opacity_ = 1.0 |
QVector2D | size_ |
float | feather_ = 1.0 |
bool | invert_ = false |
Friends | |
bool | operator== (BlendBrush const &, BlendBrush const &) |
Test for equality, buffer is ignored. More... | |
BlendBrush for drawing on the blendmask Holds an internal pixel buffer.
omni::BlendBrush::BlendBrush | ( | ) |
Default constructor.
omni::BlendBrush::BlendBrush | ( | QVector2D const & | _size, |
float | _feather = 1.0 |
||
) |
Constructor with a size and feather value (1.0 by default) Updates internal pixel buffer.
Buffer< float > const & omni::BlendBrush::buffer | ( | ) | const |
void omni::BlendBrush::changeSize | ( | QVector2D const & | _delta | ) |
Increase/Decrease size of the brush with a certain delta value Minimum size is 2 pixels, maximum size is 512 pixels.
|
staticprivate |
float omni::BlendBrush::drawLine | ( | const QPointF & | _p0, |
const QPointF & | _p1, | ||
Buffer< uint8_t > & | _buf, | ||
float | _leftOver = 0.0 |
||
) |
Draws a lot from point _p0 to _p1 on given pixel buffer.
_p0 | Start point |
_p1 | End point |
_buf | Buffer to be drawn |
_leftOver | Left over value to compensate positioning errors from previous moves |
float omni::BlendBrush::feather | ( | ) | const |
Return feather value.
void omni::BlendBrush::fromStream | ( | QDataStream & | _is | ) |
Read blend brush from stream.
|
private |
Generate internal pixel buffer with given size and feather parameters.
bool omni::BlendBrush::invert | ( | ) | const |
Returns true if the brush is inverted (aka eraser mode)
float omni::BlendBrush::opacity | ( | ) | const |
Return opacity value.
void omni::BlendBrush::setBrush | ( | QVector2D const & | _size, |
float | _feather, | ||
float | _opacity, | ||
bool | _invert | ||
) |
Set brush settings and generate pixel buffer.
void omni::BlendBrush::setFeather | ( | float | _feather | ) |
Set feather value Value must be between 0.0 and 1.0 and is clamped if necessary. A value 0.0 means a hard brush, a value of 1.0 means soft brush.
void omni::BlendBrush::setInvert | ( | bool | _invert | ) |
Sets inverted flag of the brush.
void omni::BlendBrush::setOpacity | ( | float | _opacity | ) |
Set opacity value Value must be between 0.0 and 1.0 and is clamped if necessary. A value 0.0 means a hard brush, a value of 1.0 means soft brush.
void omni::BlendBrush::setSize | ( | QVector2D const & | _size | ) |
Sets size of the brush. Minimum size is 2 pixels, maximum size is 512 pixels.
QVector2D const & omni::BlendBrush::size | ( | ) | const |
Returns brush size.
void omni::BlendBrush::stamp | ( | const QPointF & | _pos, |
Buffer< uint8_t > & | _buf | ||
) | const |
Draws internal pixel buffer in given blend buffer.
void omni::BlendBrush::toStream | ( | QDataStream & | _os | ) | const |
Write blend brush to stream.
|
friend |
Test for equality, buffer is ignored.
|
private |
Internal pixel buffer.
|
private |
|
private |
|
private |
|
private |