Implement stable serialization and restoration for dock layouts, including auto-hidden and floating panels
- Add `persistence.rs` for stable serialization of dock layouts without runtime identifiers. - Introduce `preview.rs` for geometry handling of dock drop previews. - Create `sizing.rs` to manage content-aware sizing policies and constraint solving for dock panels. - Implement `welcome.rs` to provide a welcome surface when no documents are open, featuring New and Open actions.
This commit is contained in:
@@ -39,10 +39,7 @@ fn main() {
|
||||
let mut layer = None;
|
||||
for l in &layers {
|
||||
for e in &l.effects {
|
||||
if let hcie_protocol::effects::LayerEffect::BevelEmboss {
|
||||
enabled: true, ..
|
||||
} = e
|
||||
{
|
||||
if let hcie_protocol::effects::LayerEffect::BevelEmboss { enabled: true, .. } = e {
|
||||
layer = Some(l);
|
||||
break;
|
||||
}
|
||||
@@ -113,7 +110,9 @@ fn main() {
|
||||
hcie_protocol::effects::BevelStyle::OuterBevel => {
|
||||
hcie_fx::types::BevelStyle::OuterBevel
|
||||
}
|
||||
hcie_protocol::effects::BevelStyle::Emboss => hcie_fx::types::BevelStyle::Emboss,
|
||||
hcie_protocol::effects::BevelStyle::Emboss => {
|
||||
hcie_fx::types::BevelStyle::Emboss
|
||||
}
|
||||
hcie_protocol::effects::BevelStyle::PillowEmboss => {
|
||||
hcie_fx::types::BevelStyle::PillowEmboss
|
||||
}
|
||||
@@ -129,30 +128,27 @@ fn main() {
|
||||
let alpha: Vec<u8> = layer.pixels.iter().skip(3).step_by(4).copied().collect();
|
||||
|
||||
let (hl_buf, sh_buf) = hcie_fx::tuned::generate_bevel_tuned(
|
||||
&alpha,
|
||||
w,
|
||||
h,
|
||||
depth,
|
||||
size,
|
||||
soften,
|
||||
angle,
|
||||
altitude,
|
||||
&direction,
|
||||
&technique,
|
||||
&style,
|
||||
lb,
|
||||
hl,
|
||||
sh,
|
||||
1.0,
|
||||
tilt,
|
||||
&alpha, w, h, depth, size, soften, angle, altitude, &direction, &technique, &style, lb,
|
||||
hl, sh, 1.0, tilt,
|
||||
);
|
||||
|
||||
let mut out = layer.pixels.clone();
|
||||
for i in 0..px {
|
||||
let dst = [out[i * 4], out[i * 4 + 1], out[i * 4 + 2], out[i * 4 + 3]];
|
||||
let hl_src = [hl_buf[i * 4], hl_buf[i * 4 + 1], hl_buf[i * 4 + 2], hl_buf[i * 4 + 3]];
|
||||
let sh_src = [sh_buf[i * 4], sh_buf[i * 4 + 1], sh_buf[i * 4 + 2], sh_buf[i * 4 + 3]];
|
||||
let blended = hcie_blend::blend_pixels(dst, hl_src, hcie_blend::BlendMode::Screen, 0.75);
|
||||
let hl_src = [
|
||||
hl_buf[i * 4],
|
||||
hl_buf[i * 4 + 1],
|
||||
hl_buf[i * 4 + 2],
|
||||
hl_buf[i * 4 + 3],
|
||||
];
|
||||
let sh_src = [
|
||||
sh_buf[i * 4],
|
||||
sh_buf[i * 4 + 1],
|
||||
sh_buf[i * 4 + 2],
|
||||
sh_buf[i * 4 + 3],
|
||||
];
|
||||
let blended =
|
||||
hcie_blend::blend_pixels(dst, hl_src, hcie_blend::BlendMode::Screen, 0.75);
|
||||
let blended =
|
||||
hcie_blend::blend_pixels(blended, sh_src, hcie_blend::BlendMode::Multiply, 0.75);
|
||||
out[i * 4..i * 4 + 4].copy_from_slice(&blended);
|
||||
@@ -171,8 +167,7 @@ fn main() {
|
||||
let sy = y as i32 + offset_y;
|
||||
if sx >= 0 && sx < w as i32 && sy >= 0 && sy < h as i32 {
|
||||
let s_idx = ((sy as usize) * w as usize + (sx as usize)) * 4;
|
||||
let t_idx =
|
||||
((y as usize) * target.width() as usize + (x as usize)) * 4;
|
||||
let t_idx = ((y as usize) * target.width() as usize + (x as usize)) * 4;
|
||||
|
||||
let src_a = layer.pixels[s_idx + 3];
|
||||
if src_a > 0 {
|
||||
|
||||
Reference in New Issue
Block a user