From e0e06d1c778601dfa7050f9d3f725b6571d3d6cb Mon Sep 17 00:00:00 2001 From: Alex Butler Date: Thu, 10 Dec 2020 18:23:35 +0000 Subject: [PATCH] Fix image deprecated usage in tests & examples --- dev/examples/image.rs | 2 +- dev/tests/render_reference.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dev/examples/image.rs b/dev/examples/image.rs index 5baa2eb..105fa8a 100644 --- a/dev/examples/image.rs +++ b/dev/examples/image.rs @@ -43,7 +43,7 @@ fn draw_image(font: F) { }; // Create a new rgba image with some padding - let mut image = DynamicImage::new_rgba8(glyphs_width + 40, glyphs_height + 40).to_rgba(); + let mut image = DynamicImage::new_rgba8(glyphs_width + 40, glyphs_height + 40).to_rgba8(); // Loop through the glyphs in the text, positing each one on a line for glyph in glyphs { diff --git a/dev/tests/render_reference.rs b/dev/tests/render_reference.rs index d4bf646..c20c340 100644 --- a/dev/tests/render_reference.rs +++ b/dev/tests/render_reference.rs @@ -17,7 +17,7 @@ macro_rules! compare_image { image::ImageFormat::Png, ) .expect("!image::load") - .to_luma_alpha(); + .to_luma_alpha8(); assert_eq!(reference.dimensions(), new_image.dimensions()); @@ -125,7 +125,7 @@ fn outline_draw(font: F, c: char, scale: f32) -> image::GrayAlphaImage let bounds = glyph.px_bounds(); let mut glyph_image = - DynamicImage::new_luma_a8(bounds.width() as _, bounds.height() as _).to_luma_alpha(); + DynamicImage::new_luma_a8(bounds.width() as _, bounds.height() as _).to_luma_alpha8(); glyph.draw(|x, y, alpha| { glyph_image.put_pixel(x, y, LumaA([128, (alpha * 255.0).round() as u8])) }); @@ -134,7 +134,7 @@ fn outline_draw(font: F, c: char, scale: f32) -> image::GrayAlphaImage fn draw_grey_image(rasterizer: Rasterizer) -> image::GrayAlphaImage { let (w, h) = rasterizer.dimensions(); - let mut glyph_image = DynamicImage::new_luma_a8(w as _, h as _).to_luma_alpha(); + let mut glyph_image = DynamicImage::new_luma_a8(w as _, h as _).to_luma_alpha8(); rasterizer.for_each_pixel_2d(|x, y, alpha| { glyph_image.put_pixel(x, y, LumaA([128, (alpha * 255.0).round() as u8]))