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