Krita Source Code Documentation
Loading...
Searching...
No Matches
Bristle Class Reference

#include <bristle.h>

Public Member Functions

void addInk (float value)
 
 Bristle ()=default
 
 Bristle (float x, float y, float length)
 
const KoColorcolor () const
 
int counter () const
 
float distanceCenter ()
 
bool enabled () const
 
float inkAmount () const
 
float length () const
 
float prevX () const
 
float prevY () const
 
void removeInk (float value)
 
void setColor (const KoColor &color)
 
void setEnabled (bool enabled)
 
void setInkAmount (float inkAmount)
 
void setLength (float length)
 
void setPrevX (float prevX)
 
void setPrevY (float prevY)
 
void setX (float x)
 
void setY (float y)
 
void upIncrement ()
 
float x () const
 
float y () const
 
 ~Bristle ()
 

Private Member Functions

void init (float x, float y, float length)
 

Private Attributes

KoColor m_color
 
int m_counter {0}
 
bool m_enabled {true}
 
float m_inkAmount {0.0f}
 
float m_length {0.0f}
 
float m_prevX {0.0f}
 
float m_prevY {0.0f}
 
float m_x {0.0f}
 
float m_y {0.0f}
 

Detailed Description

Definition at line 13 of file bristle.h.

Constructor & Destructor Documentation

◆ Bristle() [1/2]

Bristle::Bristle ( )
default

◆ Bristle() [2/2]

Bristle::Bristle ( float x,
float y,
float length )

Definition at line 9 of file bristle.cpp.

10 : m_x(x)
11 , m_y(y)
12 , m_prevX(x)
13 , m_prevY(y)
15{}
float m_length
Definition bristle.h:97
float x() const
Definition bristle.h:21
float m_y
Definition bristle.h:94
float length() const
Definition bristle.h:37
float m_prevY
Definition bristle.h:96
float m_x
Definition bristle.h:93
float y() const
Definition bristle.h:25
float m_prevX
Definition bristle.h:95

◆ ~Bristle()

Bristle::~Bristle ( )

Definition at line 17 of file bristle.cpp.

18{
19}

Member Function Documentation

◆ addInk()

void Bristle::addInk ( float value)

Definition at line 27 of file bristle.cpp.

28{
30}
float value(const T *src, size_t ch)
float m_inkAmount
Definition bristle.h:99

References m_inkAmount, and value().

◆ color()

const KoColor & Bristle::color ( ) const
inline

Definition at line 41 of file bristle.h.

41 {
42 return m_color;
43 }
KoColor m_color
Definition bristle.h:98

References m_color.

◆ counter()

int Bristle::counter ( ) const
inline

Definition at line 45 of file bristle.h.

45 {
46 return m_counter;
47 }
int m_counter
Definition bristle.h:102

References m_counter.

◆ distanceCenter()

float Bristle::distanceCenter ( )
inline

Definition at line 57 of file bristle.h.

57 {
58 return std::sqrt(m_x * m_x + m_y * m_y);
59 }

References m_x, and m_y.

◆ enabled()

bool Bristle::enabled ( ) const
inline

Definition at line 76 of file bristle.h.

76 {
77 return m_enabled;
78 }
bool m_enabled
Definition bristle.h:104

References m_enabled.

◆ init()

void Bristle::init ( float x,
float y,
float length )
private

◆ inkAmount()

float Bristle::inkAmount ( ) const
inline

Definition at line 53 of file bristle.h.

53 {
54 return m_inkAmount;
55 };

References m_inkAmount.

◆ length()

float Bristle::length ( ) const
inline

Definition at line 37 of file bristle.h.

37 {
38 return m_length;
39 }

References m_length.

◆ prevX()

float Bristle::prevX ( ) const
inline

Definition at line 29 of file bristle.h.

29 {
30 return m_prevX;
31 }

References m_prevX.

◆ prevY()

float Bristle::prevY ( ) const
inline

Definition at line 33 of file bristle.h.

33 {
34 return m_prevY;
35 }

References m_prevY.

◆ removeInk()

void Bristle::removeInk ( float value)

Definition at line 32 of file bristle.cpp.

33{
35}

References m_inkAmount, and value().

◆ setColor()

void Bristle::setColor ( const KoColor & color)

Definition at line 49 of file bristle.cpp.

50{
51 m_color = color;
52}
const KoColor & color() const
Definition bristle.h:41

References color(), and m_color.

◆ setEnabled()

void Bristle::setEnabled ( bool enabled)

Definition at line 55 of file bristle.cpp.

56{
58}
bool enabled() const
Definition bristle.h:76

References enabled(), and m_enabled.

◆ setInkAmount()

void Bristle::setInkAmount ( float inkAmount)

Definition at line 37 of file bristle.cpp.

38{
39 if (inkAmount > 1.0f) {
40 inkAmount = 1.0f;
41 }
42 else if (inkAmount < -1.0f) {
43 inkAmount = -1.0f;
44 }
45
47}
float inkAmount() const
Definition bristle.h:53

References inkAmount(), and m_inkAmount.

◆ setLength()

void Bristle::setLength ( float length)

Definition at line 21 of file bristle.cpp.

22{
24}

References length(), and m_length.

◆ setPrevX()

void Bristle::setPrevX ( float prevX)
inline

Definition at line 68 of file bristle.h.

68 {
69 m_prevX = prevX;
70 }
float prevX() const
Definition bristle.h:29

References m_prevX, and prevX().

◆ setPrevY()

void Bristle::setPrevY ( float prevY)
inline

Definition at line 72 of file bristle.h.

72 {
73 m_prevY = prevY;
74 }
float prevY() const
Definition bristle.h:33

References m_prevY, and prevY().

◆ setX()

void Bristle::setX ( float x)
inline

Definition at line 61 of file bristle.h.

61 {
62 m_x = x;
63 }

References m_x, and x().

◆ setY()

void Bristle::setY ( float y)
inline

Definition at line 64 of file bristle.h.

64 {
65 m_y = y;
66 }

References m_y, and y().

◆ upIncrement()

void Bristle::upIncrement ( )
inline

Definition at line 49 of file bristle.h.

49 {
50 m_counter++;
51 }

References m_counter.

◆ x()

float Bristle::x ( ) const
inline

Definition at line 21 of file bristle.h.

21 {
22 return m_x;
23 }

References m_x.

◆ y()

float Bristle::y ( ) const
inline

Definition at line 25 of file bristle.h.

25 {
26 return m_y;
27 }

References m_y.

Member Data Documentation

◆ m_color

KoColor Bristle::m_color
private

Definition at line 98 of file bristle.h.

◆ m_counter

int Bristle::m_counter {0}
private

Definition at line 102 of file bristle.h.

102{0};

◆ m_enabled

bool Bristle::m_enabled {true}
private

Definition at line 104 of file bristle.h.

104{true};

◆ m_inkAmount

float Bristle::m_inkAmount {0.0f}
private

Definition at line 99 of file bristle.h.

99{0.0f};

◆ m_length

float Bristle::m_length {0.0f}
private

Definition at line 97 of file bristle.h.

97{0.0f}; // z - coordinate

◆ m_prevX

float Bristle::m_prevX {0.0f}
private

Definition at line 95 of file bristle.h.

95{0.0f};

◆ m_prevY

float Bristle::m_prevY {0.0f}
private

Definition at line 96 of file bristle.h.

96{0.0f};

◆ m_x

float Bristle::m_x {0.0f}
private

Definition at line 93 of file bristle.h.

93{0.0f};

◆ m_y

float Bristle::m_y {0.0f}
private

Definition at line 94 of file bristle.h.

94{0.0f};

The documentation for this class was generated from the following files: