/// Read a cell from a grid using the currently set perspective
/// transform. Returns +/- 1 for black/white, 0 for cells which are
/// out of image bounds.
Read a cell from a grid using the currently set perspective
transform. Returns +/- 1 for black/white, 0 for cells which are
out of image bounds.
Read a cell from a grid using the currently set perspective transform . Returns + / - 1 for black / white 0 for cells which are out of image bounds .
fn read_cell(q: &Quirc, index: i32, x: i32, y: i32) -> Cell {
    let qr: &Grid = &q.grids[index as usize];
    let p = perspective_map(&qr.c, f64::from(x) + 0.5f64, f64::from(y) + 0.5f64);
    if p.y < 0 || p.y >= q.image.h || p.x < 0 || p.x >= q.image.w {
        Cell::OutOfBounds
    } else if q.image[(p.y * q.image.w + p.x) as usize] != 0 {
        Cell::Black
    } else {
        Cell::White
    }
}
fn read_cell ( q : & Quirc , index : i32 , x : i32 , y : i32 ) -> Cell { let qr : & Grid = & q . grids [ index as usize ] ; let p = perspective_map ( & qr . c , f64 :: from ( x ) + 0.5f64 , f64 :: from ( y ) + 0.5f64 ) ; if p . y < 0 || p . y >= q . image . h || p . x < 0 || p . x >= q . image . w { Cell :: OutOfBounds } else if q . image [ ( p . y * q . image . w + p . x ) as usize ] != 0 { Cell :: Black } else { Cell :: White } }
Read a cell from a grid using the currently set perspective
transform.
Read a cell from a grid using the currently set perspective transform .
q
&Quirc
index
i32
x
i32
y
i32