Changeset View
Changeset View
Standalone View
Standalone View
plugins/tools/tool_transform2/kis_liquify_paintop.cpp
Context not available. | |||||
105 | return outline; | 105 | return outline; | ||
---|---|---|---|---|---|
106 | } | 106 | } | ||
107 | 107 | | |||
108 | // TODO: Reduce code duplication between KisLiquifyPaintop and KisPaintOp. It might be possible to | ||||
109 | // make them both subclasses of some more general base class. | ||||
110 | void KisLiquifyPaintop::updateSpacing(const KisPaintInformation &info, | ||||
111 | KisDistanceInformation ¤tDistance) const | ||||
112 | { | ||||
113 | KisPaintInformation pi(info); | ||||
114 | KisSpacingInformation spacingInfo; | ||||
115 | { | ||||
116 | KisPaintInformation::DistanceInformationRegistrar r | ||||
117 | = pi.registerDistanceInformation(¤tDistance); | ||||
118 | spacingInfo = updateSpacingImpl(pi); | ||||
119 | } | ||||
120 | | ||||
121 | currentDistance.setSpacing(spacingInfo); | ||||
122 | } | ||||
123 | | ||||
108 | KisSpacingInformation KisLiquifyPaintop::paintAt(const KisPaintInformation &pi) | 124 | KisSpacingInformation KisLiquifyPaintop::paintAt(const KisPaintInformation &pi) | ||
109 | { | 125 | { | ||
110 | static const qreal sizeToSigmaCoeff = 1.0 / 3.0; | 126 | const qreal size = computeSize(pi); | ||
111 | const qreal size = sizeToSigmaCoeff * | | |||
112 | (m_d->props.sizeHasPressure() ? | | |||
113 | pi.pressure() * m_d->props.size(): | | |||
114 | m_d->props.size()); | | |||
115 | 127 | | |||
116 | const qreal spacing = m_d->props.spacing() * size; | 128 | const qreal spacing = m_d->props.spacing() * size; | ||
117 | 129 | | |||
Context not available. | |||||
164 | 176 | | |||
165 | return KisSpacingInformation(spacing); | 177 | return KisSpacingInformation(spacing); | ||
166 | } | 178 | } | ||
179 | | ||||
180 | KisSpacingInformation KisLiquifyPaintop::updateSpacingImpl(const KisPaintInformation &pi) const | ||||
181 | { | ||||
182 | return KisSpacingInformation(m_d->props.spacing() * computeSize(pi)); | ||||
183 | } | ||||
184 | | ||||
185 | qreal KisLiquifyPaintop::computeSize(const KisPaintInformation &pi) const | ||||
186 | { | ||||
187 | static const qreal sizeToSigmaCoeff = 1.0 / 3.0; | ||||
188 | return sizeToSigmaCoeff * | ||||
189 | (m_d->props.sizeHasPressure() ? | ||||
190 | pi.pressure() * m_d->props.size(): | ||||
191 | m_d->props.size()); | ||||
192 | } | ||||
Context not available. |