📄 maxmap.cpp
字号:
/* gridsim2 (c) 2006 Kris Beevers This file is part of gridsim2. gridsim2 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. gridsim2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with gridsim2; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA*/#include <inttypes.h>#include <assert.h>extern bool load_pgm(const char *file, uint8_t **grid, uint32_t *w, uint32_t *h);extern bool write_pgm(const char *file, const uint8_t *grid, uint32_t w, uint32_t h);int main(int argc, char **argv){ assert(argc > 1); uint32_t gw, gh; uint8_t *grid; assert(load_pgm(argv[1], &grid, &gw, &gh)); for(uint32_t i = 0; i < gw*gh; ++i) { if(grid[i] == 127) grid[i] = 0; else if(grid[i] > 127) grid[i] = 255; else grid[i] = 0; } write_pgm("ml-map.pgm", grid, gw, gh); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -