Changeset View
Changeset View
Standalone View
Standalone View
plugins/tools/tool_transform2/tool_transform_args.cc
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 78 | { | |||
---|---|---|---|---|---|
93 | m_transfPoints = args.transfPoints(); | 93 | m_transfPoints = args.transfPoints(); | ||
94 | m_warpType = args.warpType(); | 94 | m_warpType = args.warpType(); | ||
95 | m_alpha = args.alpha(); | 95 | m_alpha = args.alpha(); | ||
96 | m_defaultPoints = args.defaultPoints(); | 96 | m_defaultPoints = args.defaultPoints(); | ||
97 | m_keepAspectRatio = args.keepAspectRatio(); | 97 | m_keepAspectRatio = args.keepAspectRatio(); | ||
98 | m_filter = args.m_filter; | 98 | m_filter = args.m_filter; | ||
99 | m_flattenedPerspectiveTransform = args.m_flattenedPerspectiveTransform; | 99 | m_flattenedPerspectiveTransform = args.m_flattenedPerspectiveTransform; | ||
100 | m_editTransformPoints = args.m_editTransformPoints; | 100 | m_editTransformPoints = args.m_editTransformPoints; | ||
101 | m_pixelPrecision = 8; | 101 | m_pixelPrecision = args.pixelPrecision(); | ||
102 | m_previewPixelPrecision = 16; | 102 | m_previewPixelPrecision = args.previewPixelPrecision(); | ||
103 | 103 | | |||
104 | if (args.m_liquifyWorker) { | 104 | if (args.m_liquifyWorker) { | ||
105 | m_liquifyWorker.reset(new KisLiquifyTransformWorker(*args.m_liquifyWorker.data())); | 105 | m_liquifyWorker.reset(new KisLiquifyTransformWorker(*args.m_liquifyWorker.data())); | ||
106 | } | 106 | } | ||
107 | 107 | | |||
108 | m_continuedTransformation.reset(args.m_continuedTransformation ? new ToolTransformArgs(*args.m_continuedTransformation) : 0); | 108 | m_continuedTransformation.reset(args.m_continuedTransformation ? new ToolTransformArgs(*args.m_continuedTransformation) : 0); | ||
109 | } | 109 | } | ||
110 | 110 | | |||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Line(s) | 225 | ToolTransformArgs::ToolTransformArgs(TransformMode mode, | |||
228 | QPointF rotationCenterOffset, | 228 | QPointF rotationCenterOffset, | ||
229 | bool transformAroundRotationCenter, | 229 | bool transformAroundRotationCenter, | ||
230 | double aX, double aY, double aZ, | 230 | double aX, double aY, double aZ, | ||
231 | double scaleX, double scaleY, | 231 | double scaleX, double scaleY, | ||
232 | double shearX, double shearY, | 232 | double shearX, double shearY, | ||
233 | KisWarpTransformWorker::WarpType warpType, | 233 | KisWarpTransformWorker::WarpType warpType, | ||
234 | double alpha, | 234 | double alpha, | ||
235 | bool defaultPoints, | 235 | bool defaultPoints, | ||
236 | const QString &filterId) | 236 | const QString &filterId, | ||
237 | int pixelPrecision, int previewPixelPrecision) | ||||
237 | : m_mode(mode) | 238 | : m_mode(mode) | ||
238 | , m_defaultPoints(defaultPoints) | 239 | , m_defaultPoints(defaultPoints) | ||
239 | , m_origPoints {QVector<QPointF>()} | 240 | , m_origPoints {QVector<QPointF>()} | ||
240 | , m_transfPoints {QVector<QPointF>()} | 241 | , m_transfPoints {QVector<QPointF>()} | ||
241 | , m_warpType(warpType) | 242 | , m_warpType(warpType) | ||
242 | , m_alpha(alpha) | 243 | , m_alpha(alpha) | ||
243 | , m_transformedCenter(transformedCenter) | 244 | , m_transformedCenter(transformedCenter) | ||
244 | , m_originalCenter(originalCenter) | 245 | , m_originalCenter(originalCenter) | ||
245 | , m_rotationCenterOffset(rotationCenterOffset) | 246 | , m_rotationCenterOffset(rotationCenterOffset) | ||
246 | , m_transformAroundRotationCenter(transformAroundRotationCenter) | 247 | , m_transformAroundRotationCenter(transformAroundRotationCenter) | ||
247 | , m_aX(aX) | 248 | , m_aX(aX) | ||
248 | , m_aY(aY) | 249 | , m_aY(aY) | ||
249 | , m_aZ(aZ) | 250 | , m_aZ(aZ) | ||
250 | , m_scaleX(scaleX) | 251 | , m_scaleX(scaleX) | ||
251 | , m_scaleY(scaleY) | 252 | , m_scaleY(scaleY) | ||
252 | , m_shearX(shearX) | 253 | , m_shearX(shearX) | ||
253 | , m_shearY(shearY) | 254 | , m_shearY(shearY) | ||
254 | , m_liquifyProperties(new KisLiquifyProperties()) | 255 | , m_liquifyProperties(new KisLiquifyProperties()) | ||
255 | , m_pixelPrecision(8) | 256 | , m_pixelPrecision(pixelPrecision) | ||
256 | , m_previewPixelPrecision(16) | 257 | , m_previewPixelPrecision(previewPixelPrecision) | ||
257 | { | 258 | { | ||
258 | setFilterId(filterId); | 259 | setFilterId(filterId); | ||
259 | } | 260 | } | ||
260 | 261 | | |||
261 | 262 | | |||
262 | ToolTransformArgs::~ToolTransformArgs() | 263 | ToolTransformArgs::~ToolTransformArgs() | ||
263 | { | 264 | { | ||
264 | clear(); | 265 | clear(); | ||
▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Line(s) | 359 | } else if (m_mode == WARP || m_mode == CAGE) { | |||
361 | 362 | | |||
362 | KisDomUtils::saveValue(&warpEl, "defaultPoints", m_defaultPoints); | 363 | KisDomUtils::saveValue(&warpEl, "defaultPoints", m_defaultPoints); | ||
363 | KisDomUtils::saveValue(&warpEl, "originalPoints", m_origPoints); | 364 | KisDomUtils::saveValue(&warpEl, "originalPoints", m_origPoints); | ||
364 | KisDomUtils::saveValue(&warpEl, "transformedPoints", m_transfPoints); | 365 | KisDomUtils::saveValue(&warpEl, "transformedPoints", m_transfPoints); | ||
365 | 366 | | |||
366 | KisDomUtils::saveValue(&warpEl, "warpType", (int)m_warpType); // limited! | 367 | KisDomUtils::saveValue(&warpEl, "warpType", (int)m_warpType); // limited! | ||
367 | KisDomUtils::saveValue(&warpEl, "alpha", m_alpha); | 368 | KisDomUtils::saveValue(&warpEl, "alpha", m_alpha); | ||
368 | 369 | | |||
370 | if(m_mode == CAGE){ | ||||
371 | KisDomUtils::saveValue(&warpEl,"pixelPrecision",m_pixelPrecision); | ||||
372 | KisDomUtils::saveValue(&warpEl,"previewPixelPrecision",m_previewPixelPrecision); | ||||
373 | } | ||||
374 | | ||||
369 | } else if (m_mode == LIQUIFY) { | 375 | } else if (m_mode == LIQUIFY) { | ||
370 | QDomElement liqEl = doc.createElement("liquify_transform"); | 376 | QDomElement liqEl = doc.createElement("liquify_transform"); | ||
371 | e->appendChild(liqEl); | 377 | e->appendChild(liqEl); | ||
372 | 378 | | |||
373 | m_liquifyProperties->toXML(&liqEl); | 379 | m_liquifyProperties->toXML(&liqEl); | ||
374 | m_liquifyWorker->toXML(&liqEl); | 380 | m_liquifyWorker->toXML(&liqEl); | ||
375 | } else { | 381 | } else { | ||
376 | KIS_ASSERT_RECOVER_RETURN(0 && "Unknown transform mode"); | 382 | KIS_ASSERT_RECOVER_RETURN(0 && "Unknown transform mode"); | ||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | 443 | result = | |||
440 | KisDomUtils::loadValue(warpEl, "defaultPoints", &args.m_defaultPoints) && | 446 | KisDomUtils::loadValue(warpEl, "defaultPoints", &args.m_defaultPoints) && | ||
441 | 447 | | |||
442 | KisDomUtils::loadValue(warpEl, "originalPoints", &args.m_origPoints) && | 448 | KisDomUtils::loadValue(warpEl, "originalPoints", &args.m_origPoints) && | ||
443 | KisDomUtils::loadValue(warpEl, "transformedPoints", &args.m_transfPoints) && | 449 | KisDomUtils::loadValue(warpEl, "transformedPoints", &args.m_transfPoints) && | ||
444 | 450 | | |||
445 | KisDomUtils::loadValue(warpEl, "warpType", &warpType) && | 451 | KisDomUtils::loadValue(warpEl, "warpType", &warpType) && | ||
446 | KisDomUtils::loadValue(warpEl, "alpha", &args.m_alpha); | 452 | KisDomUtils::loadValue(warpEl, "alpha", &args.m_alpha); | ||
447 | 453 | | |||
454 | if(args.m_mode == CAGE){ | ||||
455 | result = result && | ||||
456 | KisDomUtils::loadValue(warpEl, "pixelPrecision", &args.m_pixelPrecision) && | ||||
457 | KisDomUtils::loadValue(warpEl, "previewPixelPrecision", &args.m_previewPixelPrecision); | ||||
458 | } | ||||
459 | | ||||
448 | if (result && warpType >= 0 && warpType < KisWarpTransformWorker::N_MODES) { | 460 | if (result && warpType >= 0 && warpType < KisWarpTransformWorker::N_MODES) { | ||
449 | args.m_warpType = (KisWarpTransformWorker::WarpType_) warpType; | 461 | args.m_warpType = (KisWarpTransformWorker::WarpType_) warpType; | ||
450 | } else { | 462 | } else { | ||
451 | result = false; | 463 | result = false; | ||
452 | } | 464 | } | ||
453 | 465 | | |||
454 | } else if (args.m_mode == LIQUIFY) { | 466 | } else if (args.m_mode == LIQUIFY) { | ||
455 | QDomElement liquifyEl; | 467 | QDomElement liquifyEl; | ||
Show All 36 Lines |