Skip to content

Commit

Permalink
Fix image deprecated usage in tests & examples
Browse files Browse the repository at this point in the history
  • Loading branch information
alexheretic committed Dec 10, 2020
1 parent a2b3ed1 commit e0e06d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dev/examples/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn draw_image<F: Font>(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 {
Expand Down
6 changes: 3 additions & 3 deletions dev/tests/render_reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down Expand Up @@ -125,7 +125,7 @@ fn outline_draw<F: Font>(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]))
});
Expand All @@ -134,7 +134,7 @@ fn outline_draw<F: Font>(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]))
Expand Down

0 comments on commit e0e06d1

Please sign in to comment.