MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / make_heatmap_buffer

Function make_heatmap_buffer

tools/bloom-diff/src/main.rs:510–528  ·  view source on GitHub ↗

In-memory heatmap used for the composite output — same algorithm as `write_heatmap` but returns a buffer instead of writing it.

(
    reference: &[[f32; 3]],
    candidate: &[[f32; 3]],
    width: u32,
    height: u32,
)

Source from the content-addressed store, hash-verified

508/// In-memory heatmap used for the composite output — same algorithm
509/// as `write_heatmap` but returns a buffer instead of writing it.
510fn make_heatmap_buffer(
511 reference: &[[f32; 3]],
512 candidate: &[[f32; 3]],
513 width: u32,
514 height: u32,
515) -> RgbImage {
516 let mut img: RgbImage = ImageBuffer::new(width, height);
517 for y in 0..height {
518 for x in 0..width {
519 let i = (y * width + x) as usize;
520 let dr = (reference[i][0] - candidate[i][0]).abs();
521 let dg = (reference[i][1] - candidate[i][1]).abs();
522 let db = (reference[i][2] - candidate[i][2]).abs();
523 let mag = dr.max(dg).max(db);
524 img.put_pixel(x, y, heatmap_color(mag));
525 }
526 }
527 img
528}

Callers 1

mainFunction · 0.85

Calls 1

heatmap_colorFunction · 0.85

Tested by

no test coverage detected