-
Notifications
You must be signed in to change notification settings - Fork 2
/
spngt.lua
79 lines (65 loc) · 1.71 KB
/
spngt.lua
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
--EmmyLua annotations for the spngt API
--Only used for intellisense, not used at runtime.
local spngt = {}
---@class spngt_ihdr
---@field width integer
---@field height integer
---@field bit_depth integer
---@field color_type integer
---@field interlace_method integer
local spngt_ihdr = {}
---@class spngt_result
---@field png_size integer
---@field time integer --Encode/decode time
---@field ihdr spngt_ihdr
local spngt_result = {}
---@class spngt_file
local spngt_file = {}
---@class spngt_params
---@field format integer
---@field override_defaults boolean
---@field compression_level integer
---@field window_bits integer
---@field mem_level integer
---@field zlib_strategy integer
---@field filter_choice integer
local spngt_params = {}
---Prefetch PNG file
---@param filename string
---@return spngt_file
function spngt.prefetch(filename)
end
---Get ihdr from PNG
---@return spngt_ihdr
function spngt_file:get_ihdr()
end
---Discard cached file and associated buffers
function spngt_file:discard()
end
---Measure encode time
---@param params spngt_params
---@return spngt_result
function spngt_file:encode_benchmark(params)
end
--spngt_params.zlib_strategy
spngt.Z_FILTERED = 1
spngt.Z_HUFFMAN_ONLY = 2
spngt.Z_RLE = 3
spngt.Z_FIXED = 4
spngt.Z_DEFAULT_STRATEGY = 0
--spngt_params.compression_level
spngt.Z_NO_COMPRESSION = 0
spngt.Z_BEST_SPEED = 1
spngt.Z_BEST_COMPRESSION = 9
spngt.Z_DEFAULT_COMPRESSION = -1
--spngt_params.filter_choice
spngt.DISABLE_FILTERING = 0
spngt.FILTER_CHOICE_NONE = 8
spngt.FILTER_CHOICE_SUB = 16
spngt.FILTER_CHOICE_UP = 32
spngt.FILTER_CHOICE_AVG = 64
spngt.FILTER_CHOICE_PAETH = 128
spngt.FILTER_CHOICE_ALL = (8|16|32|64|128)
spngt.DEFAULT_DECODE_RUNS = 5
spngt.DEFAULT_ENCODE_RUNS = 2
return spngt