Skip to content

Commit

Permalink
v0.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Colonial-Dev committed Oct 9, 2023
1 parent c3c0cbc commit 05522fe
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 87 deletions.
20 changes: 0 additions & 20 deletions CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "satpaper"
authors = ["Colonial"]
version = "0.5.4"
version = "0.5.5"
edition = "2021"

description = "Display near-real-time satellite imagery on your desktop."
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Thanks to `cyberbit`, everything you need to build and run a Satpaper Docker ima
- `-b`/`--background-image`/`SATPAPER_BACKGROUND_IMAGE` - the path to an image to use as the background.
- Most common image formats are supported.
- For best results, the image should match the specified resolution, but Satpaper will resize the image to fit if need be.
- Satpaper uses a basic "marching" algorithm to find the bounds of the Earth and apply transparency to the original image, but it's not perfect - some black bordering may remain.
- Satpaper uses a basic "marching" algorithm to find the bounds of the Earth and apply transparency to the original image, but it's not perfect - some black bordering and/or jagged edges may remain. (Unfortunately, the canonical algorithm for this problem - flood filling - doesn't really work, because it tends to end up eating into the Earth at night. If you have an idea for a better solution, please let me know!)
- `-w`/`--wallpaper-command`/`SATPAPER_WALLPAPER_COMMAND` - custom command to run when a wallpaper is generated.
- This overrides the automatic update handling.
- Currently, this only works on Unix. The command will be run as `sh -c "{command} file://{image_path}`.
Expand Down
64 changes: 0 additions & 64 deletions src/slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,70 +198,6 @@ enum Direction {
Right
}

fn cutout_disk_flood(image: &mut DynamicImage) {
use std::collections::VecDeque;

let x_max = image.dimensions().0 - 1;
let y_max = image.dimensions().1 - 1;

let step = |mut x: u32, mut y: u32, direction: Direction| {
use Direction::*;

match direction {
Up => y = y.saturating_add(1),
Down => y = y.saturating_sub(1),
Left => x = x.saturating_sub(1),
Right => x = x.saturating_add(1),
};

(x, y)
};

let mut flood_fill = |x: u32, y: u32| {
use Direction::*;

let mut queue = VecDeque::new();

queue.push_back((x, y));

while !queue.is_empty() {
let (x, y) = queue
.pop_front()
.expect("Queue should not be empty");

if x > x_max ||
y > y_max
{
continue;
}

let pixel = image.get_pixel(x, y);

// It turns out that some pixels in the "black" background are actually [1, 1, 1, 255]!
// Why? Who knows.
if pixel.0 <= BLACK.0 && pixel != CLEAR {
image.put_pixel(x, y, CLEAR);

queue.push_back(step(x, y, Up));
queue.push_back(step(x, y, Down));
queue.push_back(step(x, y, Left));
queue.push_back(step(x, y, Right));
}
}
};

// These might seem redundant, but it's necessary to handle differences in the
// satellite imagery - GOES has no space between the Earth and image edge on the left and right,
// while the rest do.
//
// This handles the "edge case" of GOES's separated corners, while not doing any extra work
// for the likes of Himawari (because the first fill will get all the pixels, causing the rest to finish immediately.)
flood_fill(0, 0);
flood_fill(x_max, 0);
flood_fill(0, y_max);
flood_fill(x_max, y_max);
}

// Identifies the bounds of the Earth in the image
fn cutout_disk(image: &mut DynamicImage) {
// Find the midpoint and max of the edges.
Expand Down

0 comments on commit 05522fe

Please sign in to comment.