| 72 | } |
| 73 | |
| 74 | bool TilePickerTab::save() |
| 75 | { |
| 76 | if ( !fopen_text_file(filename.latin1(), WRTMODE) ) { |
| 77 | // XXX handle better |
| 78 | exit(1); |
| 79 | } |
| 80 | pixel p[TILE_Y][TILE_X]; |
| 81 | for ( int index=0; index < num; index++ ) { |
| 82 | int ox = (index%TILES_ACROSS)*TILE_X; |
| 83 | int oy = (index/TILES_ACROSS)*TILE_Y; |
| 84 | for ( int y=0; y<TILE_Y; y++ ) { |
| 85 | uchar* c = image.scanLine(oy+y) + ox; |
| 86 | for ( int x=0; x<TILE_X; x++ ) { |
| 87 | QRgb rgb = image.color(*c++); |
| 88 | p[y][x].r = qRed(rgb); |
| 89 | p[y][x].g = qGreen(rgb); |
| 90 | p[y][x].b = qBlue(rgb); |
| 91 | } |
| 92 | } |
| 93 | write_text_tile(p); |
| 94 | } |
| 95 | fclose_text_file(); |
| 96 | } |
| 97 | |
| 98 | void TilePickerTab::mousePressEvent(QMouseEvent* e) |
| 99 | { |
nothing calls this directly
no test coverage detected