ws-tex: layered/ora (OpenRaster read + write through the PNG hooks)

stack.xml tree (nested isolate / auto stacks, offsets, opacity, visibility, svg composite-ops), mergedimage,
thumbnail. Tested against spec-built files and our file taken apart by python zipfile / ElementTree / Pillow.
This commit is contained in:
4DBug committed 2026-10-31 15:12:53 -05:00
1 parent 00d47096ed
commit d618795ce7
6 files changed
+548

No files matched your search

+23
View File
@@ -168,3 +168,26 @@ if which == "icns" then
base.pixels = base.frames[4].image.pixels
emit("ours_legacy.icns", Icns.encode(base))
end
if which == "ora" then
-- a layered document: background, an offset half-opaque multiply layer, a hidden one, a group with a screen layer
local Ora = require("@formats/layered/ora")
local Png = require("@formats/image/png")
local doc = Types.Layered.new(40, 30)
local bg = Types.Layered.layer("background", image(40, 30, "rgba8", 0))
for i = 0, 40 * 30 - 1 do
buffer.writeu8(bg.image.pixels, i * 4 + 3, 255)
end
local mid = Types.Layered.layer("mid", image(20, 10, "rgba8", 1), 5, 7)
mid.opacity, mid.blend = 0.5, "multiply"
local hidden = Types.Layered.layer("hidden", image(8, 8, "rgba8", 2), 1, 1)
hidden.visible = false
local inner = Types.Layered.layer("inner", image(10, 10, "rgba8", 3), 20, 15)
inner.blend = "screen"
local g = Types.Layered.group("group", { inner })
g.opacity = 0.75
doc.layers = { bg, mid, hidden, g }
emit("ours_doc.ora", Ora.encode(doc, { encodeImage = function(img: any, _f: string): (any, any)
return Png.encode(img)
end }))
end