Debian Codegraph @

tests/auto/other/lancelot/scripts/clipping.qps

raw
1 # Version: 1
2 # CheckVsReference: 5%
3
4 region_addRect clip 50 0 90 190
5 region_addRect clip 0 50 180 90
6
7 region_addRect clip2 30 30 60 60
8
9 region_addRect clip3 10 10 60 60
10
11 path_cubicTo path 90 0 50 50 90 90
12 path_cubicTo path 0 90 50 50 0 0
13
14 path_addRect path2 0 0 90 90
15 path_moveTo path2 90 45
16 path_arcTo path2 0 0 90 90 0 -360
17
18 path_addRect emptypath 0 0 0 0
19 region_addRect emptyregion 0 0 0 0
20
21 # Normal clip rect
22 setClipRect 0 0 50 150
23 begin_block repaint
24 save
25 setBrush red
26 setPen nopen
27 resetMatrix
28 region_getClipRegion tmpclip
29 path_getClipPath tmpclippath
30 drawRect 0 0 width height
31 setBrush #3f0000ff
32 setClipRegion tmpclip
33 drawRect 0 0 width height
34 setClipPath tmpclippath
35 setBrush #3f00ff00
36 drawRect 0 0 width height
37 restore
38 end_block
39
40 # Rotated clip rect
41 translate 100 0
42 rotate 10
43 setClipRect 0 0 50 150
44 repeat_block repaint
45
46 # simple clip region
47 resetMatrix
48 translate 0 200
49 setClipRegion clip
50 repeat_block repaint
51
52 # simle rotated clip region
53 translate 250 -10
54 rotate 10
55 setClipRegion clip
56 repeat_block repaint
57
58 # verify that clip is not xformed with painter
59 resetMatrix
60 translate 200 0
61 setClipRegion clip
62 rotate 30
63 setBrush red
64 setPen nopen
65 drawRect 0 0 width height
66
67 resetMatrix
68 translate 0 400
69 save
70 setClipRegion clip
71 setClipRegion clip2 IntersectClip
72 repeat_block repaint
73 translate 0 100
74 rotate 10
75 setClipRegion clip
76 setClipRegion clip2 IntersectClip
77 restore
78
79 translate 100 0
80 save
81 setClipRegion clip3
82 setClipRegion clip2 UniteClip
83 repeat_block repaint
84 translate 0 100
85 rotate 10
86 setClipRegion clip3
87 setClipRegion clip2 UniteClip
88 repeat_block repaint
89 restore
90
91 translate 100 0
92 save
93 setClipPath path
94 repeat_block repaint
95 translate 50 100
96 rotate 45
97 setClipPath path
98 repeat_block repaint
99 restore
100
101 translate 100 0
102 save
103 setClipPath path
104 setClipPath path2 IntersectClip
105 repeat_block repaint
106 translate 0 100
107 rotate 10
108 setClipPath path
109 setClipPath path2 IntersectClip
110 repeat_block repaint
111 restore
112
113 translate 100 0
114 save
115 setClipPath path
116 setClipPath path2 UniteClip
117 repeat_block repaint
118 translate 0 100
119 rotate 10
120 setClipPath path
121 setClipPath path2 UniteClip
122 repeat_block repaint
123 restore
124
125 translate 100 0
126 save
127 setClipPath path
128 setClipRegion clip3 IntersectClip
129 repeat_block repaint
130 translate 0 100
131 rotate 10
132 setClipRegion clip3
133 setClipPath path IntersectClip
134 repeat_block repaint
135 restore
136
137 translate 100 0
138 save
139 setClipPath path
140 setClipRegion clip3 UniteClip
141 repeat_block repaint
142 translate 0 100
143 rotate 10
144 setClipRegion clip3
145 setClipPath path UniteClip
146 repeat_block repaint
147 restore
148
149 # test that an empty region is not drawn.
150 resetMatrix
151 setClipRegion emptyregion
152 setBrush #3f00ff00
153 drawRect 0 0 300 300
154 drawText 50 50 "Text should be clipped away by region"
155 setClipping false
156
157 setClipPath emptypath
158 setBrush #3fffff00
159 drawRect 50 50 300 300
160 drawText 70 80 "Text should be clipped away by path"
161
162 # Test that we can extract a clipregion when a matrix is set too
163 resetMatrix
164 translate 500 10
165 scale 2 1
166 setBrush blue
167 setClipping false
168 rotate 5
169 drawRect 0 0 100 100
170 setClipRect 0 0 100 100
171 resetMatrix
172 rotate 10
173 region_getClipRegion xclip
174 setClipRegion xclip
175 resetMatrix
176 setBrush #7f00ff00
177 drawRect 0 0 width height
178
179 # the below used to assert in debug mode
180 setClipRect 10 10 20 20
181 setClipping false
182 setClipping true