File indexing completed on 2024-05-26 04:33:57

0001 /*
0002  *  SPDX-FileCopyrightText: 2008 Lukas Tvrdy <lukast.dev@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #include "bristle.h"
0008 
0009 Bristle::Bristle(float x, float y, float length)
0010     : m_x(x)
0011     , m_y(y)
0012     , m_prevX(x)
0013     , m_prevY(y)
0014     , m_length(length)
0015 {}
0016 
0017 Bristle::~Bristle()
0018 {
0019 }
0020 
0021 void Bristle::setLength(float length)
0022 {
0023     m_length = length;
0024 }
0025 
0026 
0027 void Bristle::addInk(float value)
0028 {
0029     m_inkAmount = m_inkAmount + value;
0030 }
0031 
0032 void Bristle::removeInk(float value)
0033 {
0034     m_inkAmount = m_inkAmount - value;
0035 }
0036 
0037 void Bristle::setInkAmount(float inkAmount)
0038 {
0039     if (inkAmount > 1.0f) {
0040         inkAmount = 1.0f;
0041     }
0042     else if (inkAmount < -1.0f) {
0043         inkAmount = -1.0f;
0044     }
0045 
0046     m_inkAmount = inkAmount;
0047 }
0048 
0049 void Bristle::setColor(const KoColor &color)
0050 {
0051     m_color = color;
0052 }
0053 
0054 
0055 void Bristle::setEnabled(bool enabled)
0056 {
0057     m_enabled = enabled;
0058 }