Esempio n. 1
0
function tile_get_32($url)
{
    $tile = db_get_value('tiles', 't32', 'where url=%"', $url);
    if ($tile === false) {
        #return false;
        return str_repeat("", 32 * 32 / 8);
    }
    #$debug_binary = true;
    if ($debug_binary) {
        $GLOBALS['debug_tiles'] = true;
        tile_get_128($url);
        # because it prints now
        tile_get_64($url);
        # because it prints now
        print_full_table($tile, 32, 32 / 8);
        exit;
    }
    if ($GLOBALS['debug_tiles']) {
        print_full_table($tile, 32, 32 / 8);
    }
    return $tile;
}
Esempio n. 2
0
function create_random_square()
{
    $GLOBALS['crs_count'] = ($GLOBALS['crs_count'] + 1) % 4;
    if ($GLOBALS['crs_count'] == 0) {
        $GLOBALS['pixels'] = array_fill(0, 256 * 256 / 8, 0x0);
        $GLOBALS['pixels'][0] = 0x0;
        $GLOBALS['pixels'][PIXELS_RB] = 0x0;
        # draw some random boxes
        $num_boxes = rand(100, 2055);
        for ($i = 0; $i < $num_boxes; ++$i) {
            $size = 1 << rand(0, 2);
            $x = rand(0, 255);
            $y = rand(0, 255);
            $x -= $x % $size;
            $y -= $y % $size;
            color_square($x, $y, $size);
        }
        if ($GLOBALS['debug_tiles']) {
            print_full_table($GLOBALS['pixels'], 256, 256 / 8);
        }
    }
    $zooms = create_tile_from_quadrant($GLOBALS['crs_count']);
    return $zooms;
}