ws-cleanup: MeshFlatten, Zip and the SVG style parser reuse Types.Scene.mul, Types.Date.civilFromDays, Raster.multiply

This commit is contained in:
4DBug committed 2026-10-31 12:31:32 -05:00
1 parent 44a599f00c
commit f5cf02026d
4 files changed
+6 -36

No files matched your search

+2 -10
View File
@@ -4,6 +4,7 @@
-- lengths with units, transform lists, style="" declarations, and a CSS subset for <style> (rules of comma-separated
-- compound selectors made of a type, .classes, #id and *, with specificity; @rules and other combinators are skipped).
-- Never throws.
local Raster = require("@formats/codecs/image/Raster")
local Style = {}
local NAMED: { [string]: number } = {
@@ -242,16 +243,7 @@ function Style.numbers(s: string?): { number }
end
-- transform(s) -> { a, b, c, d, e, f } (the product of the list) | nil on a syntax error
local function mul(m: { number }, n: { number }): { number }
return {
m[1] * n[1] + m[3] * n[2],
m[2] * n[1] + m[4] * n[2],
m[1] * n[3] + m[3] * n[4],
m[2] * n[3] + m[4] * n[4],
m[1] * n[5] + m[3] * n[6] + m[5],
m[2] * n[5] + m[4] * n[6] + m[6],
}
end
local mul = Raster.multiply
Style.multiply = mul
function Style.transform(s: string): { number }?
local m = { 1, 0, 0, 1, 0, 0 }