aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/lua/gradients.lua
blob: 3ae08d50dba01a72a7355b35b6efef8bcb6d0708 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function tostr(t)
    local str = ""
    for k, v in next, t do
        if #str > 0 then
            str = str .. ", "
        end
        if type(k) == "number" then
            str = str .. "[" .. k .. "] = "
        else
            str = str .. tostring(k) .. " = "
        end
        if type(v) == "table" then
            str = str .. "{ " .. tostr(v) .. " }"
        else
            str = str .. tostring(v)
        end
    end
    return str
end

function sk_scrape_startcanvas(c, fileName) end

function sk_scrape_endcanvas(c, fileName) end

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")
            else
                local b = s:asABitmap()
                if b then
                    io.write("bitmap ", b.genID, " width=", b.width, " height=", b.height, "\n")
                end
            end
        end
    end
end

function sk_scrape_summarize() end