Skip to content

Commit

Permalink
fix: style of README file
Browse files Browse the repository at this point in the history
  • Loading branch information
salam99823 committed Dec 4, 2024
1 parent 71f3a73 commit dbdbca7
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
[![Crates.io](https://img.shields.io/crates/d/edges.svg)](https://crates.io/crates/edges)
[![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](https://github.com/shnewto/edges#license)

get the edges of objects in images with transparency.
Get the edges of objects in images with transparency.

## supported image types
## Supported image types

- `image::DynamicImage`
- `bevy::render::texture::Image` (or if you rather, `bevy::prelude::Image`)
- `bevy::image::Image` (or if you rather, `bevy::prelude::Image`)

## using
## Using

```rust
use edges::Edges;
Expand All @@ -22,29 +22,29 @@ let edges = Edges::from(image.unwrap());
println!("{:#?}", edges.single_image_edge_translated());
```

## how it works
## How it works

i was inspired by [a coding train (or, coding in the cabana rather)
I was inspired by [a coding train (or, coding in the cabana rather)
on an implementation of "marching squares"](https://youtu.be/0ZONMNUKTfU).
so this crate takes a "march through all the values" approach to find edges, i.e.
So this crate takes a "march through all the values" approach to find edges, i.e.
pixels with at least 1 empty neighboring pixel, but
instead of drawing a contour in place,
it just keeps track of all the actual pixel coordinates. to determine "empty" I bitwise
it just keeps track of all the actual pixel coordinates. To determine "empty" I bitwise
or all the bytes for each pixel and,
in images with transparency, "empty" is a zero value for the pixel.

after that, we need to put the coordinates in some kind of
After that, we need to put the coordinates in some kind of
"drawing order" so whatever we pass all the points to,
knows how we want the object constructed. for this, the
crate collects all pixels, in order, that are a distance of 1 from eachother.
if there are pixels that have a distance greater than 1
knows how we want the object constructed. For this, the
crate collects all pixels, in order, that are a distance of 1 from each other.
If there are pixels that have a distance greater than 1
from any pixel in an existing group, that pixel begins a new group.

## license
## License

all code in this repository is dual-licensed under either:
All code in this repository is dual-licensed under either:

- MIT License (LICENSE-MIT or <http://opensource.org/licenses/MIT>)
- Apache License, Version 2.0 (LICENSE-APACHE or <http://www.apache.org/licenses/LICENSE-2.0>)

at your option.
At your option.

0 comments on commit dbdbca7

Please sign in to comment.