Changeset View
Changeset View
Standalone View
Standalone View
libs/flake/KoShapeFillWrapper.cpp
| Context not available. | |||||
| 86 | KoShapeStrokeSP stroke = qSharedPointerDynamicCast<KoShapeStroke>(shape->stroke()); | 86 | KoShapeStrokeSP stroke = qSharedPointerDynamicCast<KoShapeStroke>(shape->stroke()); | ||
|---|---|---|---|---|---|
| 87 | if (!stroke) return Type::None; | 87 | if (!stroke) return Type::None; | ||
| 88 | 88 | | |||
| 89 | // strokes without any width are none | ||||
| 90 | if (stroke->lineWidth() == 0.0) { | ||||
| 91 | return Type::None; | ||||
| 92 | } | ||||
| 93 | | ||||
| 89 | // TODO: patterns are not supported yet! | 94 | // TODO: patterns are not supported yet! | ||
| 90 | return stroke->lineBrush().gradient() ? Type::Gradient : Type::Solid; | 95 | return stroke->lineBrush().gradient() ? Type::Gradient : Type::Solid; | ||
| 91 | } | 96 | } | ||
| Context not available. | |||||
| 238 | KoShape *shape = m_d->shapes.first(); | 243 | KoShape *shape = m_d->shapes.first(); | ||
| 239 | KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(shape, KoFlake::None); | 244 | KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(shape, KoFlake::None); | ||
| 240 | 245 | | |||
| 241 | return m_d->fillVariant == KoFlake::Fill ? | 246 | KoFlake::FillType fillType; | ||
| 242 | ShapeBackgroundFetchPolicy::type(shape) : | 247 | if (m_d->fillVariant == KoFlake::Fill) { | ||
| 243 | ShapeStrokeFillFetchPolicy::type(shape); | 248 | // fill property of vector object | ||
| 249 | fillType = ShapeBackgroundFetchPolicy::type(shape); | ||||
| 250 | } else { | ||||
| 251 | // stroke property of vector object | ||||
| 252 | fillType = ShapeStrokeFillFetchPolicy::type(shape); | ||||
| 253 | } | ||||
| 254 | | ||||
| 255 | return fillType; | ||||
| 244 | } | 256 | } | ||
| 245 | 257 | | |||
| 246 | QColor KoShapeFillWrapper::color() const | 258 | QColor KoShapeFillWrapper::color() const | ||
| Context not available. | |||||
| 310 | return command; | 322 | return command; | ||
| 311 | } | 323 | } | ||
| 312 | 324 | | |||
| 325 | KUndo2Command *KoShapeFillWrapper::setLineWidth(const float &lineWidth) | ||||
| 326 | { | ||||
| 327 | KUndo2Command *command = 0; | ||||
| 328 | | ||||
| 329 | float applyLineWidth = lineWidth; | ||||
| 330 | if (m_d->fillVariant == KoFlake::Fill) { | ||||
| 331 | // background section doesn't have a line width, so set to 0 | ||||
| 332 | applyLineWidth = 0.0; | ||||
| 333 | } | ||||
| 334 | | ||||
| 335 | command = KoFlake::modifyShapesStrokes(m_d->shapes, [lineWidth](KoShapeStrokeSP stroke) { | ||||
| 336 | stroke->setColor(Qt::transparent); | ||||
| 337 | stroke->setLineWidth(lineWidth); | ||||
| 338 | | ||||
| 339 | }); | ||||
| 340 | | ||||
| 341 | return command; | ||||
| 342 | | ||||
| 343 | } | ||||
| 344 | | ||||
| 345 | | ||||
| 313 | KUndo2Command *KoShapeFillWrapper::setGradient(const QGradient *gradient, const QTransform &transform) | 346 | KUndo2Command *KoShapeFillWrapper::setGradient(const QGradient *gradient, const QTransform &transform) | ||
| 314 | { | 347 | { | ||
| 315 | KUndo2Command *command = 0; | 348 | KUndo2Command *command = 0; | ||
| Context not available. | |||||