forked from 1b-agent/opencadstudio-upstream
Raster images: transparency off draws pixels opaque; TRANSPARENCY command
An image's transparency flag decides whether transparent pixels show what is behind the image or draw in their stored colour: the image pass and PDF plots now follow it (it was ignored, so every PNG alpha showed through). TRANSPARENCY selects images and asks for the mode, defaulting to the first image's current one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
801882314f
commit
5ca7becd97
30 files changed
+237
-6
No files matched your search
@@ -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,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user