Changes
Added
- Feature
parallel
, which depends onrayon
(6dab192). - External public crate
binary_image
(076d53b). - Iterator
iter::Edges
forEdges
(10397be).
Changed
rayon
marked as optional dependencies
(6dab192).- Functions factored out to
utils
.translate
translate_objects
- Now
UVec2
,Vec2
is inner
(ba68b6c). - Function names have been shortened
(0266d7e):single_image_edge_translated
tosingle_translated
.single_image_edge_raw
tosingle_raw
.multi_image_edge_translated
tomulti_translated
.multi_image_edge_raw
tomulti_raw
.
- Now
Edges
is unit
(10397be). - Implementation of
From
forbevy_image::prelude::Image
replaced byTryFrom
(10397be).
Fixed
- Work with channels of pixels
(10397be).
Removed
- Functions
image_edges
,new
(10397be).
Migration guide
About Using the parallel
Feature
If you want to enable the parallel
feature using rayon
,
you'll need to add it to your Cargo.toml
:
[dependencies]
edges = { version = "0.6.0", features = ["parallel"] }
About Using the New Iterator iter::Edges
To utilize the new iterator for Edges
, you can iterate over the edges like this:
use edges::Edges;
use std::path::Path;
let image = image::open(Path::new("assets/car.png")).unwrap();
let edges = Edges::from(image);
for polygon in edges.iter() {
println!("{:?}", polygon);
}
About Updating Function Calls
As mentioned, the functions translate
and translate_objects
have been moved to the utils
module.
Here’s how to update your calls:
use edges::utils::{translate, translate_objects};
let translated = translate(image_data, image_width, image_height);
let translated_objects = translate_objects(objects_data, image_width, image_height);
About Handling the TryFrom
Implementation
If you were previously using From
for converting bevy_image::prelude::Image
,
you should update your code to use TryFrom
:
use bevy_image::prelude::Image;
let bevy_image = Image::from_buffer(
include_bytes!("../assets/boulders.png"), // buffer
ImageType::Extension("png"),
CompressedImageFormats::default(),
true,
ImageSampler::default(),
RenderAssetUsages::default(),
);
// Panic occurs if image format does not support conversion to `BinaryImage`
let bevy_edges = Edges::try_from(bevy_image).unwrap();