Changeset View
Changeset View
Standalone View
Standalone View
libs/image/recorder/kis_recorded_path_paint_action.cpp
Context not available. | |||||
53 | QPointF control2; | 53 | QPointF control2; | ||
---|---|---|---|---|---|
54 | KisPaintInformation point2; | 54 | KisPaintInformation point2; | ||
55 | }; | 55 | }; | ||
56 | | ||||
57 | Private(const KisDistanceInitInfo &startDistInfo) : | ||||
58 | startDistInfo(startDistInfo) {} | ||||
59 | | ||||
56 | QList<BezierCurveSlice> curveSlices; | 60 | QList<BezierCurveSlice> curveSlices; | ||
61 | | ||||
62 | // Information about distance and spacing at the start of the action. | ||||
63 | KisDistanceInitInfo startDistInfo; | ||||
57 | }; | 64 | }; | ||
58 | 65 | | |||
59 | KisRecordedPathPaintAction::KisRecordedPathPaintAction( | 66 | KisRecordedPathPaintAction::KisRecordedPathPaintAction( | ||
60 | const KisNodeQueryPath& path, | 67 | const KisNodeQueryPath& path, | ||
61 | const KisPaintOpPresetSP preset) | 68 | const KisPaintOpPresetSP preset, | ||
69 | const KisDistanceInitInfo& startDistInfo) | ||||
62 | : KisRecordedPaintAction("PathPaintAction", i18n("Path"), path, preset) | 70 | : KisRecordedPaintAction("PathPaintAction", i18n("Path"), path, preset) | ||
63 | , d(new Private) | 71 | , d(new Private(startDistInfo)) | ||
64 | { | 72 | { | ||
65 | } | 73 | } | ||
66 | 74 | | |||
Context not available. | |||||
74 | delete d; | 82 | delete d; | ||
75 | } | 83 | } | ||
76 | 84 | | |||
85 | KisDistanceInitInfo KisRecordedPathPaintAction::getInitDistInfo() const | ||||
86 | { | ||||
87 | return d->startDistInfo; | ||||
88 | } | ||||
89 | | ||||
90 | void KisRecordedPathPaintAction::setInitDistInfo(const KisDistanceInitInfo &startDistInfo) | ||||
91 | { | ||||
92 | d->startDistInfo = startDistInfo; | ||||
93 | } | ||||
94 | | ||||
77 | void KisRecordedPathPaintAction::addPoint(const KisPaintInformation& info) | 95 | void KisRecordedPathPaintAction::addPoint(const KisPaintInformation& info) | ||
78 | { | 96 | { | ||
79 | Private::BezierCurveSlice slice; | 97 | Private::BezierCurveSlice slice; | ||
Context not available. | |||||
120 | { | 138 | { | ||
121 | dbgImage << "play path paint action with " << d->curveSlices.size() << " slices"; | 139 | dbgImage << "play path paint action with " << d->curveSlices.size() << " slices"; | ||
122 | if (d->curveSlices.size() <= 0) return; | 140 | if (d->curveSlices.size() <= 0) return; | ||
123 | KisDistanceInformation savedDist; | 141 | | ||
142 | KisDistanceInformation savedDist = d->startDistInfo.makeDistInfo(); | ||||
124 | 143 | | |||
125 | Q_FOREACH (const Private::BezierCurveSlice &slice, d->curveSlices) | 144 | Q_FOREACH (const Private::BezierCurveSlice &slice, d->curveSlices) | ||
126 | { | 145 | { | ||
Context not available. | |||||
196 | } | 215 | } | ||
197 | } | 216 | } | ||
198 | elt.appendChild(waypointsElt); | 217 | elt.appendChild(waypointsElt); | ||
218 | | ||||
219 | QDomElement initDistElt = doc.createElement("StartDistInfo"); | ||||
220 | d->startDistInfo.toXML(doc, initDistElt); | ||||
221 | elt.appendChild(initDistElt); | ||||
199 | } | 222 | } | ||
200 | 223 | | |||
201 | KisRecordedAction* KisRecordedPathPaintAction::clone() const | 224 | KisRecordedAction* KisRecordedPathPaintAction::clone() const | ||
Context not available. | |||||
221 | // Decode pressets | 244 | // Decode pressets | ||
222 | KisPaintOpPresetSP paintOpPreset = paintOpPresetFromXML(elt); | 245 | KisPaintOpPresetSP paintOpPreset = paintOpPresetFromXML(elt); | ||
223 | 246 | | |||
224 | KisRecordedPathPaintAction* rplpa = new KisRecordedPathPaintAction(pathnode, paintOpPreset); | 247 | KisRecordedPathPaintAction* rplpa = new KisRecordedPathPaintAction(pathnode, paintOpPreset, | ||
248 | KisDistanceInitInfo()); | ||||
225 | 249 | | |||
226 | setupPaintAction(rplpa, elt, context); | 250 | setupPaintAction(rplpa, elt, context); | ||
227 | 251 | | |||
Context not available. | |||||
254 | } else { | 278 | } else { | ||
255 | dbgImage << "Warning: no <Waypoints /> found"; | 279 | dbgImage << "Warning: no <Waypoints /> found"; | ||
256 | } | 280 | } | ||
281 | | ||||
282 | QDomElement initDistInfoElt = elt.firstChildElement("StartDistInfo"); | ||||
283 | if (!initDistInfoElt.isNull()) { | ||||
284 | rplpa->setInitDistInfo(KisDistanceInitInfo::fromXML(initDistInfoElt)); | ||||
285 | } else { | ||||
286 | dbgImage << "Warning: no <StartDistInfo /> found"; | ||||
287 | } | ||||
288 | | ||||
257 | return rplpa; | 289 | return rplpa; | ||
258 | } | 290 | } | ||
259 | 291 | | |||
Context not available. |