Merge pull request #1513 from ramox81/codex/image-transparency

Raster images: draw opaque when transparency is off; TRANSPARENCY command
This commit is contained in:
Hakan Seven committed 2026-09-28 13:48:51 +03:00
commit 6c481c92fe
30 files changed
+242 -6

No files matched your search

+8
View File
@@ -94,6 +94,9 @@ pub struct ImageModel {
/// Magnified pixels stay square (raster images); otherwise they blend
/// (PDF pages, OLE pictures).
pub pixelated: bool,
/// Pixel alpha applies. A raster image whose transparency is off draws
/// every pixel opaque in its stored colour.
pub use_alpha: bool,
}
impl ImageModel {
@@ -165,6 +168,9 @@ impl ImageModel {
draw_depth: 0.0,
verts,
pixelated: true,
use_alpha: img
.flags
.contains(codec::entities::ImageDisplayFlags::TRANSPARENCY_ON),
})
}
}
@@ -274,6 +280,7 @@ impl ImageModel {
draw_depth: 0.0,
verts,
pixelated: false,
use_alpha: true,
})
}
}
@@ -355,6 +362,7 @@ impl ImageModel {
draw_depth: 0.0,
verts,
pixelated: false,
use_alpha: true,
})
}
}
+5 -2
View File
@@ -79,7 +79,9 @@ struct ImageParams {
/// Signed draw-order depth (-1,1); applied as a clip-z bias in the shader
/// so the raster orders against other entity types. 0.0 = neutral.
draw_depth: f32,
_pad: [f32; 2],
/// 1.0 when pixel alpha applies, 0.0 when pixels draw opaque.
use_alpha: f32,
_pad: f32,
} // 16 bytes
// ── Per-image GPU handle ──────────────────────────────────────────────────
@@ -196,7 +198,8 @@ impl ImageGpu {
let params = ImageParams {
opacity: model.opacity.clamp(0.0, 1.0),
draw_depth: 0.0,
_pad: [0.0; 2],
use_alpha: if model.use_alpha { 1.0 } else { 0.0 },
_pad: 0.0,
};
let params_buf = Arc::new(super::gpu_upload::upload_buffer(
device,