map_engine/
png.rs

1//!Empty PNG image.
2use crate::errors::MapEngineError;
3use crate::raster::{pixels::driver::Driver, StyledPixels};
4use crate::tiles::TILE_SIZE;
5use lazy_static::lazy_static;
6use ndarray::{Array, Array3};
7
8/// Fully-transparent tile served when the requested tile does not intersect the map extent
9pub fn empty_png() -> Result<Vec<u8>, MapEngineError> {
10    let arr: Array3<u8> = Array::zeros((4, TILE_SIZE, TILE_SIZE));
11    StyledPixels::new(arr, Driver::Generic).into_png()
12}
13
14lazy_static! {
15    pub static ref EMPTY_PNG: Vec<u8> = empty_png().unwrap();
16}