Skip to content

Releases: shnewto/edges

0.5.1 - 2024-12-04

06 Dec 01:24
Compare
Choose a tag to compare

Changes

Added

Changed

  • Refactored inner logic without changes in API
    (ffadade).
  • Updated docs (dbdbca7).

0.5.0 - 2024-12-04

05 Dec 22:12
Compare
Choose a tag to compare

Changes

Added

  • Implementation of Clone, Into<Vec<Vec<UVec2>>
    traits for Edges (662f42c) (0fdc732).
  • translate_objects method to Edges for replace flag translate (1bb608c).

Changed

  • Upgrade dependencies: Bevy 0.15 (ac1a5a5).
  • Function multi_image_edges_raw renamed to multi_image_edge_raw (1bb608c).
  • Now methods image_edges, multi_image_edge_raw, single_image_edge_raw
    returns Vec<Vec<UVec2>> (1bb608c).

Removed

  • translate flag for image_edges function (1bb608c).

Migration guide

Definition of edges.

let edges = Edges::from(&image);

About Into

You can replace call Edges::multi_image_edge_raw or
Edges::image_edges with Into::into with type declaration.

let objects1 = edges.image_edges();
let objects2 = edges.multi_image_edge_raw();
let objects3: Vec<Vec<UVec2>> = edges.into();

assert_eq!(objects1, objects2);
assert_eq!(objects2, objects3);

About translate flag

If you use Edges::image_edges like there:

let objects = edges.image_edges(true);

You must replace it with this:

// this two lines equal.
let objects1 = edges.multi_image_edge_translated();
let objects2 = edges.translate_objects(edges.image_edges());

assert_eq!(objects1, objects2);

About new type of output

If you use raw variants of edges like there:

let objects = edges.multi_image_edge_raw();

let object = edges.single_image_edge_raw();

And type of points in output you wait is Vec2 you can convert UVec2 like there:

// What these two examples have in common is the use of `UVec2::as_vec2`.
let objects: Vec<Vec<Vec2>> = edges
    .multi_image_edge_raw()
    .into_iter()
    .map(|object| {
        object.into_iter().map(|p| p.as_vec2()/* <-- */).collect()
    }).collect();

let object: Vec<Vec2> = edges
    .single_image_edge_raw()
    .into_iter()
    .map(|p| p.as_vec2()/* <-- */)
    .collect();

0.4.0 - 2024-11-12

06 Dec 00:55
Compare
Choose a tag to compare

Changes

Added

Changed

Fixed

Removed

Migration guide

Definition of edges.

let edges = Edges::from(&image);

About feature glam-latest

This feature added for lightweight of usage of this crate without bevy
and support latest version of glam.

Note

The bevy feature disables the glam-latest feature.

[dependencies.edges]
version = "*" # Your version
default-features = false
features = ["glam-latest"]

About Edges::new

Now, you mustn't call Edges::march_edges.
To get edges from custom data, you can use Edges::new.

Warning

The data size must be greater than or equal to height multiplied by width.

let data: &[u8];
let edges = Edges::new(height, width, data);

let objects = edges.multi_image_edge_translated();

About Edges

If you use match-case on Edges to return an image.
You should now use one of these options.
This will preserve your ownership of the image.

let data: &[u8];
let edges: Edges = Edges::new(height, width, data);

let edges: Edges = Edges::from(&image);

0.3.4 - 2024-08-13

06 Dec 01:06
Compare
Choose a tag to compare

Changes

Changed

0.3.3 - 2024-07-08

06 Dec 01:29
Compare
Choose a tag to compare

Changes

Changed

0.3.2 - 2024-05-13

06 Dec 01:48
Compare
Choose a tag to compare

Changes

Added

Changed

  • Reworked the algorithm for sorting points in drawing order
    (c508c2a).

Fixed

  • Incorrect drawing order for complex images (#1)
    (c508c2a).

0.3.1 - 2024-03-05

06 Dec 03:16
Compare
Choose a tag to compare

Changes

Fixed

  • Implementation of trait Debug for Edges (022e575).
  • Tests module cfg (022e575).

0.3.0 - 2024-03-04

06 Dec 03:36
Compare
Choose a tag to compare

Changes

Changed

  • Methods march_edges, translate_vec are provided as associated functions
    (faee752).

Migration guide

Definition of edges.

let edges = Edges::from(&image);

About march_edges

If you use Edges::march_edges like there:

let objects = edges.march_edges(&data, rows, cols, translate);

You must replace it with this:

let objects = Edges::march_edges(&data, rows, cols, translate);

About translate_vec

You must replace call to translate_vec like there:

let vec: Vec<Vec2> = Vec::new();

// Before:
let translate_vec = edges.translated_vec(vec, rows, cols);

// After:
let translated_vec = Edges::translate_vec(vec, rows, cols);