Some prework for the binary, linter issue is resolved, unnecessary comments removed
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 11s
Python / lint-format (pull_request) Successful in 19s
Python / test (pull_request) Successful in 50s
Lint & Format (Rust) / lint-format (pull_request) Failing after 49s

This commit is contained in:
2026-05-30 20:40:14 +02:00
parent 164c0a18c2
commit 8ea295d1ce
3 changed files with 29 additions and 11 deletions
+2
View File
@@ -0,0 +1,2 @@
edition = "2024"
style_edition = "2024"
-7
View File
@@ -52,15 +52,11 @@ pub fn apply_shadow(
blur: f32, blur: f32,
offset_x: f32, offset_x: f32,
offset_y: f32, offset_y: f32,
// blur_passes: u32,
shadow_color: [u8; 4], shadow_color: [u8; 4],
) -> RgbaImage { ) -> RgbaImage {
let (iw, ih) = img.dimensions(); let (iw, ih) = img.dimensions();
let br = blur.ceil() as u32; let br = blur.ceil() as u32;
let bp = 1; let bp = 1;
// Original idea
// let spread = br * bp;
// Claude is hallucinating but let's try it **Worked btw**
let spread = (br as f32 * (bp as f32).sqrt() * 2.0).ceil() as u32; let spread = (br as f32 * (bp as f32).sqrt() * 2.0).ceil() as u32;
let extra_left = spread + (-offset_x).max(0.0).ceil() as u32; let extra_left = spread + (-offset_x).max(0.0).ceil() as u32;
@@ -91,11 +87,8 @@ pub fn apply_shadow(
tint_pixmap_as_shadow(&mut shadow_pixmap, shadow_color); tint_pixmap_as_shadow(&mut shadow_pixmap, shadow_color);
// Shadow
let shadow_img = pixmap_to_rgba_image(shadow_pixmap); let shadow_img = pixmap_to_rgba_image(shadow_pixmap);
// Shadow blur
let blurred = box_blur_rgba(&shadow_img, br, bp); let blurred = box_blur_rgba(&shadow_img, br, bp);
// Shadow pos
let blurred_pixmap = rgba_image_to_pixmap(&blurred); let blurred_pixmap = rgba_image_to_pixmap(&blurred);
let mut canvas = Pixmap::new(canvas_w, canvas_h).expect("canvas pixmap"); let mut canvas = Pixmap::new(canvas_w, canvas_h).expect("canvas pixmap");
+27 -4
View File
@@ -1,7 +1,7 @@
mod config; mod config;
mod effects; mod effects;
use anyhow::{bail, Context, Result}; use anyhow::{Context, Result, bail};
use std::io::Write as _; use std::io::Write as _;
use std::process::{Command, Stdio}; use std::process::{Command, Stdio};
@@ -57,7 +57,11 @@ fn extract_image_path() -> Option<String> {
} }
fn main() { fn main() {
if let Some(path) = extract_image_path() && let Err(e) = run() { // Fundamental issue when supplying args it won't give output unless --image is used.
// Will have to be fixed in a later patch upcoming week
if let Some(path) = extract_image_path()
&& let Err(e) = run()
{
eprintln!("Error: {}", e); eprintln!("Error: {}", e);
push_image(&path).ok(); push_image(&path).ok();
} }
@@ -73,6 +77,22 @@ fn run() -> Result<()> {
let mut i = 0; let mut i = 0;
while i < args.len() { while i < args.len() {
match args[i].as_str() { match args[i].as_str() {
"--help" => {
println!();
println!("Usage: zshell-img-tools [options]");
println!();
println!("All options are required");
println!("Options:");
println!(" --rounding <true|false> Enable or disable rounded corners");
println!(" --radius <number> Set the radius for rounded corners");
println!(" --shadow <true|false> Enable or disable shadow");
println!(" --shadow-blur <number> Set the blur radius for the shadow");
println!(" --shadow-offset-x <number> Set the horizontal offset for the shadow");
println!(" --shadow-offset-y <number> Set the vertical offset for the shadow");
println!(" --shadow-color <r,g,b,a> Set the color of the shadow as comma-separated RGBA values (0-255)");
println!(" --scale <number> Scale all effects by this factor (e.g. 2.0 for display scale)");
return Ok(());
}
"--image" => { "--image" => {
image_path = Some(next_arg(&args, &mut i, "--image")?); image_path = Some(next_arg(&args, &mut i, "--image")?);
} }
@@ -117,7 +137,11 @@ fn run() -> Result<()> {
let val = next_arg(&args, &mut i, "--scale")?; let val = next_arg(&args, &mut i, "--scale")?;
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), unknown => {
let unknown_args = unknown.to_string();
println!("Warning: Unknown argument '{}'", unknown);
next_arg(&args, &mut i, &unknown_args)?;
}
} }
i += 1; i += 1;
@@ -125,7 +149,6 @@ fn run() -> Result<()> {
let image_path = image_path.context("Missing --image <path>")?; let image_path = image_path.context("Missing --image <path>")?;
// Check if any arguments were provided
let cli_args_provided = overrides.rounding.is_some() let cli_args_provided = overrides.rounding.is_some()
|| overrides.radius.is_some() || overrides.radius.is_some()
|| overrides.shadow.is_some() || overrides.shadow.is_some()