MoonBit OpenEXR scanline, tiled and flat multipart HDR interchange with PIZ
moon version --all
moon check --target all --deny-warn
moon build --target all --deny-warn
moon test --target all --deny-warn
moon run examples/render_assets
moon run examples/scientific_imaging
moon run examples/offline_preview --target js
moon run examples/scale --target native --release
moon run examples/storage --target nativemoon add FikaRomantic/moonexr@0.2.0.\tools\windows\moon.ps1 check --target all --deny-warn
.\tools\windows\moon.ps1 test --target all --deny-warn
.\tools\windows\moon.ps1 run examples/render_assetsfn main raise {
let w = @exr.Window::new(-1, 2, 1, 3)
let ids = @exr.Plane::from_values(
{ name: "id", kind: U32, linear: true }, w,
[0.0, 1.0, 16777217.0, 4294967295.0, 42.0, 7.0],
)
let image = @exr.Image::new(w, [ids])
let file = @exr.ExrFile::open(@exr.encode(image))
let roi = file.read(region=Some(@exr.Window::new(0, 2, 1, 3)))
assert_eq(roi.plane("id").bits_at(1, 2), 16777217U)
}| 项目 | 已支持 | 明确不支持/不承诺 |
|---|---|---|
| 存储 | EXR v2 flat scanline、tiled ONE_LEVEL/MIPMAP/RIPMAP、命名 multipart、tile 随机块顺序 | deep、未知 flags、缺失块恢复 |
| 通道 | UINT32、IEEE HALF16、FLOAT32,单位采样,命名层、长UTF-8名字 | 子采样、自动合成Y/RY/BY、任意像素类型 |
| 压缩 | NONE、RLE、ZIPS、ZIP、PIZ;压缩无收益时回退原始块 | PXR24、B44/B44A、DWA 等其他 codec |
| 元数据 | 标准窗口/屏幕/像素比例,未知可选属性原始保留;string/int/float/chromaticities辅助接口 | 任意可选属性的领域解释、ICC变换、设备校准 |
| 读写 | 单文件/多部件编码、按层及区域读、scanline 原子批次写、提取与转码 | 文件IO流式读取、零复制、物理字节完全一致重写 |
| 处理 | crop/select/rename/translate、层选择/合并、显式类型转换、有限值统计/直方图、RGBA预览 | 合成器、滤镜引擎、渲染器、完整色彩管理 |
moon run cmd/main --target native -- inspect INPUT.exr
moon run cmd/main --target native -- bits INPUT.exr
moon run cmd/main --target native -- demo NEW.exr
moon run cmd/main --target native -- rewrite INPUT.exr NEW.exr zip
moon run cmd/main --target native -- transcode INPUT.exr NEW.exr piz
moon run cmd/main --target native -- extract-part INPUT.exr depth NEW.exr piz
moon run cmd/main --target native -- level-bits INPUT.exr 0 2 2 Z
python -m venv _local/venv
# 激活环境后安装;Windows也可直接使用_local/venv/Scripts/python.exe
python -m pip install -r scripts/requirements-interop.txt
moon build --target native --deny-warn
python scripts/interop.py verify _build/native/debug/build/cmd/main/main.exepub struct ExrDocument {
// private fields
}pub struct ExrFile {
// private fields
}fn ExrFile::extract(self : ExrFile, level_x? : Int, level_y? : Int, region? : Window?, channels? : Array[String]?, tiles? : TileDescription?, compression? : Compression) -> Bytes raise ExrErrorpub struct Header {
// private fields
}pub(all) struct Histogram {
lower : Double
upper : Double
bins : Array[Int]
below : Int
above : Int
nonfinite : Int
}pub struct Image {
// private fields
}pub(all) struct MaskedStatistics {
selected : Int
finite_samples : Int
nonfinite_samples : Int
minimum : Double?
maximum : Double?
mean : Double?
} derive(Debug)pub(all) struct PartSource {
name : String
compression : Compression
tiles : TileDescription?
images : Array[Image]
}pub struct Plane {
// private fields
}pub(all) struct PlaneStatistics {
samples : Int
finite_samples : Int
nan_samples : Int
positive_infinities : Int
negative_infinities : Int
negative_zeros : Int
minimum : Double?
maximum : Double?
mean : Double?
population_variance : Double?
} derive(Debug)pub(all) struct SampleDifference {
samples : Int
changed_bits : Int
finite_pairs : Int
maximum_absolute_error : Double?
} derive(Debug)pub struct Scan {
// private fields
}fn TileDescription::levels(self : TileDescription, base : Window) -> Array[LevelInfo] raise ExrErrorpub struct Writer {
// private fields
}fn encode_tiled(images : Array[Image], tiles : TileDescription, compression? : Compression, limits? : Limits) -> Bytes raise ExrErrorfn float_bits_to_half(bits : UInt) -> Intfn half_to_float_bits(bits : Int) -> UIntInstall
Download zipMoonBit OpenEXR scanline, tiled and flat multipart HDR interchange with PIZ