pub fn make_indexed_image<F: FnOnce(&mut Graphics<'_>)>(
width: usize,
height: usize,
simplify_palette: bool,
method: F,
) -> Result<IndexedImage, GraphicsError>Expand description
Create an indexed image widthxheight px and then run drawing commands on it
§Params
simplify_paletteif true and there’s more than 255 colours, this will simplify/merge the palette until there are under 255 colours
§Usage
let image: Result<IndexedImage, GraphicsError> = make_indexed_image(30, 30, true, |g| {
g.clear(BLACK);
g.draw_rect(Rect::new(coord!(0,0), coord!(29,29)), stroke(WHITE))
});§Errors
GraphicsError::TooManyColorsOver 255 colors have been used andsimplify_palettewas falseGraphicsError::TooBigImage is bigger than 255x255