$spans_ref is an arrayref of x,y,width horizontal lines. If $sorted is true then they're assumed to be sorted by increasing y coordinate (allowing a single pass across the region rectangles). $function is called
&$function ($x, $y, $width, $data)
for each portion of a span which intersects $region. $function must not change $region.
$region->spans_intersect_foreach ([ 0,0,50, 20,20,100, 0,10,50 ],
0, # spans not sorted by y
\&my_callback,
'hello'); # userdata
sub my_callback {
my ($x, $y, $width, $userdata) = @_;
print "$userdata: $x, $y, $width\n";
}