Function render

Source
pub fn render(
    image_width: u32,
    image_height: u32,
    text_config: &TextConfig,
    sensor_value_history: &[Vec<SensorValue>],
    font: &Font<'_>,
) -> ImageBuffer<Rgba<u8>, Vec<u8>>
Expand description

Renders the text element to a png image. Render Pipeline: 1. Draw text on empty rgba buffer on display size 2. Calculate bounding box of text 3. Crop buffer to the visible bounding box of the text 4. Create a new Image buffer in the size of the text element 5. Overlay the text image on the new image buffer according to the text alignment