qt5base-lts/tests/auto/other/lancelot/scripts/gradientxform_object.qps
Eirik Aavitsland f5fe9fc5a4 Add ObjectMode coordinate mode to QGradient
The ObjectBoundingMode coordinate mode of QGradient allows specifying
the gradient coordinates relative to the object being painted. But if
the gradient brush also has a transformation, that transformation is
applied in the logical, not object, coordinate space. That behavior is
counterintuitive. However, changing it now would break existing
code. Instead, we introduce a new coordinate mode enum with the
expected behavior, and document the old one as deprecated.

This prepares to fix the bugs below in qtsvg, by making
it possible to specify the same behavior in Qt as SVG has.

[ChangeLog][QtGui][QGradient] Add ObjectMode coordinate mode
[ChangeLog][Important Behavior Changes] QDataStream version bumped up to 18 to account for changes in the serialization of QGradient.

Task-number: QTBUG-59978
Task-number: QTBUG-67995
Change-Id: I8820a2555359812f3e1a46e37d6ac2cc29a2091d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2018-06-22 10:42:33 +00:00

84 lines
1.3 KiB
Plaintext

# Version: 1
# CheckVsReference: 5%
gradient_clearStops
gradient_appendStop 0 black
gradient_appendStop 0.4 yellow
gradient_appendStop 1 gray
gradient_setSpread PadSpread
gradient_setCoordinateMode ObjectBoundingMode
# first run is dummy, make it offscreen
save
translate -500 -500
begin_block row
save
setPen nopen
drawRect 50 0 100 100
setPen brush 30
setBrush lightblue
translate 110 0
drawRect 65 15 70 70
translate 110 0
setFont "times" 110 99
drawText 50 100 "X"
restore
end_block row
restore
drawText 160 20 "PLAIN"
drawText 560 20 "BRUSH XFORM"
translate 0 20
begin_block block
save
drawText 75 20 "Brush Fill"
drawText 176 20 "Pen Stroke"
drawText 277 20 "Text Stroke"
translate 0 30
drawText 0 50 "Linear"
drawText 0 160 "Radial"
drawText 0 270 "Conical"
gradient_setLinear 0.1 0.0 0.5 0.0
repeat_block row
translate 0 110
gradient_setRadial 0.3 0.2 0.5 0.4 0.5
repeat_block row
translate 0 110
gradient_setConical 0.5 0.7 45
repeat_block row
restore
end_block block
save
translate 400 0
brushRotate 30.0
brushScale 1.5 .5
repeat_block block
restore
drawText 80 400 "BRUSH XFORM, OBJECT BOUNDING MODE"
drawText 500 400 "BRUSH XFORM, OBJECT MODE"
translate 0 400
brushTranslate 0.5 0.5
brushRotate 180.0
brushTranslate -0.5 -0.5
repeat_block block
translate 400 0
gradient_setCoordinateMode ObjectMode
repeat_block block