15fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.com 25fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.comfunction sk_scrape_startcanvas(c, fileName) end 35fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.com 45fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.comfunction sk_scrape_endcanvas(c, fileName) end 55fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.com 674f96b9c4caeff8e805d8a37c63a5e5a103e59abcommit-bot@chromium.orgcount3 = 0 774f96b9c4caeff8e805d8a37c63a5e5a103e59abcommit-bot@chromium.orgcount3sym = 0 874f96b9c4caeff8e805d8a37c63a5e5a103e59abcommit-bot@chromium.org 95fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.comfunction sk_scrape_accumulate(t) 105fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.com local p = t.paint 115fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.com if p then 125fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.com local s = p:getShader() 135fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.com if s then 145fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.com local g = s:asAGradient() 155fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.com if g then 1674f96b9c4caeff8e805d8a37c63a5e5a103e59abcommit-bot@chromium.org --io.write(g.type, " gradient with ", g.colorCount, " colors\n") 1774f96b9c4caeff8e805d8a37c63a5e5a103e59abcommit-bot@chromium.org 1874f96b9c4caeff8e805d8a37c63a5e5a103e59abcommit-bot@chromium.org if g.colorCount == 3 then 1974f96b9c4caeff8e805d8a37c63a5e5a103e59abcommit-bot@chromium.org count3 = count3 + 1 2074f96b9c4caeff8e805d8a37c63a5e5a103e59abcommit-bot@chromium.org 2174f96b9c4caeff8e805d8a37c63a5e5a103e59abcommit-bot@chromium.org if (g.midPos >= 0.499 and g.midPos <= 0.501) then 2274f96b9c4caeff8e805d8a37c63a5e5a103e59abcommit-bot@chromium.org count3sym = count3sym + 1 2374f96b9c4caeff8e805d8a37c63a5e5a103e59abcommit-bot@chromium.org end 2474f96b9c4caeff8e805d8a37c63a5e5a103e59abcommit-bot@chromium.org end 255fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.com end 265fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.com end 275fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.com end 285fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.comend 295fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.com 3074f96b9c4caeff8e805d8a37c63a5e5a103e59abcommit-bot@chromium.orgfunction sk_scrape_summarize() 3174f96b9c4caeff8e805d8a37c63a5e5a103e59abcommit-bot@chromium.org io.write("Number of 3 color gradients: ", count3, "\n"); 3274f96b9c4caeff8e805d8a37c63a5e5a103e59abcommit-bot@chromium.org io.write("Number of 3 color symmetric gradients: ", count3sym, "\n"); 3374f96b9c4caeff8e805d8a37c63a5e5a103e59abcommit-bot@chromium.orgend 345fdc983f58098e5c9fbdbedc7719f87e5efa4d31reed@google.com 35