zshell-img-tools #104

Merged
zach merged 25 commits from zshell-img-tools into main 2026-05-31 00:30:12 +02:00
4 changed files with 8 additions and 31 deletions
Showing only changes of commit 6aedf6f8b7 - Show all commits
-1
View File
@@ -293,7 +293,6 @@ Singleton {
return {
enable_pp: screenshot.enable_pp,
mode: screenshot.mode,
scale: screenshot.scale,
corner_radius: screenshot.corner_radius,
drop_shadow: screenshot.drop_shadow,
rounded_corners: screenshot.rounded_corners,
-1
View File
1
@@ -6,7 +6,6 @@ JsonObject {
property bool enable_pp: true
property string mode: "manual"
property bool rounded_corners: false
property real scale: 1.0
property int shadow_blur_passes: 1
property real shadow_blur_radius: 22.0
property list<int> shadow_color: [0, 0, 0, 160]
-1
View File
@@ -14,7 +14,6 @@ pub struct EffectsConfig {
pub corner_radius: f32,
pub drop_shadow: bool,
pub rounded_corners: bool,
pub scale: f32,
pub shadow_blur_radius: f32,
pub shadow_blur_passes: u32,
pub shadow_color: [u8; 4],
+8 -28
View File
@@ -10,7 +10,6 @@ struct CliOverrides {
rounded_corners: Option<bool>,
corner_radius: Option<f32>,
drop_shadow: Option<bool>,
scale: Option<f32>,
shadow_blur_radius: Option<f32>,
shadow_blur_passes: Option<u32>,
shadow_offset_x: Option<f32>,
@@ -56,6 +55,7 @@ fn main() -> Result<()> {
let mut image_path: Option<String> = None;
let mut overrides = CliOverrides::default();
let mut scale: Option<f32> = None;
let mut i = 0;
while i < args.len() {
1
@@ -142,7 +142,7 @@ fn main() -> Result<()> {
"--scale" => {
i += 1;
let val = args.get(i).context("Expected a number after --scale")?;
overrides.scale = Some(val.parse::<f32>().context("--scale must be a number")?);
scale = Some(val.parse::<f32>().context("--scale must be a number")?);
}
unknown => bail!("Unknown argument: {unknown}"),
}
@@ -179,16 +179,14 @@ fn main() -> Result<()> {
if let Some(v) = overrides.shadow_color {
effects.shadow_color = v;
}
if let Some(v) = overrides.scale {
effects.scale = v;
}
}
if effects.scale != 1.0 {
effects.corner_radius *= effects.scale;
effects.shadow_blur_radius *= effects.scale;
effects.shadow_offset_x *= effects.scale;
effects.shadow_offset_y *= effects.scale;
// if scale is set do
if let Some(scale) = scale.filter(|&s| s != 1.0) {
effects.corner_radius *= scale;
effects.shadow_blur_radius *= scale;
effects.shadow_offset_x *= scale;
effects.shadow_offset_y *= scale;
}
if let Err(e) = process_image(&image_path, &effects) {
@@ -226,23 +224,5 @@ fn process_image(path: &str, effects: &config::EffectsConfig) -> Result<()> {
.context("Failed to write image data to swappy")?;
}
// Writes the PNG bytes to swappy's stdin and waits for swappy to close
// child
// .stdin
// .take()
// .context("Failed to get swappy stdin")?
// .write_all(&png_bytes)
// .context("Failed to write image data to swappy")?
// .spawn();
//
// let status = child.await().context("Failed to wait for swappy")?;
//
// if !status.success() {
// eprintln!(
// "swappy exited with non-zero status for '{}': {}",
// path, status
// );
// }
Ok(())
}