1fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotlocal canvas -- holds the current canvas (from startcanvas()) 2fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 3fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot--[[ 4fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot startcanvas() is called at the start of each picture file, passing the 5fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot canvas that we will be drawing into, and the name of the file. 6fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 7fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot Following this call, there will be some number of calls to accumulate(t) 8fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot where t is a table of parameters that were passed to that draw-op. 9fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 10fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot t.verb is a string holding the name of the draw-op (e.g. "drawRect") 11fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 12fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot when a given picture is done, we call endcanvas(canvas, fileName) 13fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot]] 14fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotfunction sk_scrape_startcanvas(c, fileName) 15fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot canvas = c 16fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotend 17fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 18fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot--[[ 19fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot Called when the current canvas is done drawing. 20fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot]] 21fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotfunction sk_scrape_endcanvas(c, fileName) 22fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot canvas = nil 23fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotend 24fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 25fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot--[[ 26fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot Use to initialize all keys passed in keyTable to zero in table. 27fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot Useful so that keys that are never get incremented still output zero at end 28fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot]] 29fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotfunction resetTableKeys(table, keyTable) 30fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot for k, v in next, keyTable do 31fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot table[v] = 0 32fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot end 33fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotend 34fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 35fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotfunction increment(table, key) 36fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot table[key] = (table[key] or 0) + 1 37fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotend 38fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 39fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotlocal dashCount = 0 40fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 41fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotlocal total_found = {} 42fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotlocal drawPoints_count = {} 43fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotlocal drawPoints_direction = {} 44fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team RobotresetTableKeys(drawPoints_direction, {"hori", "vert", "other"}) 45fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotlocal dashInterval_count = {} 46fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotlocal dashInterval_pattern = {} 47fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team RobotresetTableKeys(dashInterval_pattern, {"one_one", "zero_on", "other"}) 48fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotlocal dash_phase = {} 49fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team RobotresetTableKeys(dash_phase, {"zero", "other"}) 50fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotlocal dash_cap = {} 51fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team RobotresetTableKeys(dash_cap, {"butt", "round", "square"}) 52fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 53fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotlocal dashTable = {} 54fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team RobotdashTable.total_found = total_found 55fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team RobotdashTable.drawPoints_count = drawPoints_count 56fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team RobotdashTable.drawPoints_direction = drawPoints_direction 57fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team RobotdashTable.dashInterval_count = dashInterval_count 58fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team RobotdashTable.dashInterval_pattern = dashInterval_pattern 59fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team RobotdashTable.dash_phase = dash_phase 60fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team RobotdashTable.dash_cap = dash_cap 61fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 62fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotfunction sk_scrape_accumulate(t) 63fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot local p = t.paint 64fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot if p then 65fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot local pe = p:getPathEffect() 66fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot if pe then 67fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot local de = pe:asADash() 68fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot if de then 69fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot dashCount = dashCount + 1 70fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot increment(total_found, t.verb); 71fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot increment(dashInterval_count, #de.intervals) 72fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot if 2 == #de.intervals then 73fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot if 1 == de.intervals[1] and 1 == de.intervals[2] then 74fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot increment(dashInterval_pattern, "one_one") 75fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot elseif 0 == de.intervals[1] then 76fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot increment(dashInterval_pattern, "zero_on") 77fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot else 78fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot increment(dashInterval_pattern, "other") 79fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot end 80fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot end 81fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 82fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot if 0 == de.phase then 83fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot increment(dash_phase, "zero") 84fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot else 85fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot increment(dash_phase, "other") 86fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot end 87fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 88fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot local cap = p:getStrokeCap() 89fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot if 0 == cap then 90fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot increment(dash_cap, "butt") 91fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot elseif 1 == cap then 92fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot increment(dash_cap, "round") 93fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot else 94fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot increment(dash_cap, "square") 95fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot end 96fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 97fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot if "drawPoints" == t.verb then 98fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot local points = t.points 99fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot increment(drawPoints_count, #points) 100fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot if 2 == #points then 101fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot if points[1].y == points[2].y then 102fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot increment(drawPoints_direction, "hori") 103fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot elseif points[1].x == points[2].x then 104fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot increment(drawPoints_direction, "vert") 105fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot else 106fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot increment(drawPoints_direction, "other") 107fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot end 108fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot end 109fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot end 110fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 111fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot --[[ 112fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot eventually would like to print out info on drawPath verbs with dashed effect 113fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot ]] 114fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot if "drawPath" == t.verb then 115fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot end 116fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 117fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot end 118fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot end 119fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot end 120fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotend 121fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 122fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot--[[ 123fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot lua_pictures will call this function after all of the pictures have been 124fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot "accumulated". 125fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot]] 126fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotfunction sk_scrape_summarize() 127fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot-- use for non telemetry 128fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot--[[ 129fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot io.write("Total dashed effects is: ", dashCount, "\n"); 130fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot for k1, v1 in next, dashTable do 131fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot io.write("\nTable: ", k1, "\n") 132fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot for k, v in next, v1 do 133fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot io.write("\"", k, "\": ", v, "\n") 134fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot end 135fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot end 136fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot]] 137fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 138fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot-- use for telemetry 139fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot io.write("\ndashCount = dashCount + ", tostring(dashCount), "\n") 140fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot for k1, v1 in next, dashTable do 141fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot for k, v in next, v1 do 142fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot io.write("\nincrement(dashTable, \"", k1, "\", \"", k, "\", ", v, ")\n") 143fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot end 144fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot end 145fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robotend 146fe17456d5e528078ce69b5f15cf7adf1fab963fandroid-build-team Robot 147