skia2/tools/lua/gradients.lua
commit-bot@chromium.org 74f96b9c4c Added 3-color gradient scraper for detecting symmetrical gradients.
Made changes to lua to scrape info about 3 color gradients

BUG=
R=reed@google.com

Author: dierk@google.com

Review URL: https://chromiumcodereview.appspot.com/21571002

git-svn-id: http://skia.googlecode.com/svn/trunk@10490 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-01 17:32:56 +00:00

35 lines
867 B
Lua

function sk_scrape_startcanvas(c, fileName) end
function sk_scrape_endcanvas(c, fileName) end
count3 = 0
count3sym = 0
function sk_scrape_accumulate(t)
local p = t.paint
if p then
local s = p:getShader()
if s then
local g = s:asAGradient()
if g then
--io.write(g.type, " gradient with ", g.colorCount, " colors\n")
if g.colorCount == 3 then
count3 = count3 + 1
if (g.midPos >= 0.499 and g.midPos <= 0.501) then
count3sym = count3sym + 1
end
end
end
end
end
end
function sk_scrape_summarize()
io.write("Number of 3 color gradients: ", count3, "\n");
io.write("Number of 3 color symmetric gradients: ", count3sym, "\n");
end