| 26 | } |
| 27 | |
| 28 | void Bitmap::save() |
| 29 | { |
| 30 | if (endsWith(filename, ".png")) |
| 31 | stbi_write_png( |
| 32 | filename.c_str(), width, height, 4, &_bitmap[0], width * 4); |
| 33 | else if (endsWith(filename, ".bmp")) |
| 34 | stbi_write_bmp(filename.c_str(), width, height, 4, &_bitmap[0]); |
| 35 | else if (endsWith(filename, ".tga")) |
| 36 | stbi_write_tga(filename.c_str(), width, height, 4, &_bitmap[0]); |
| 37 | else if (endsWith(filename, ".jpg")) |
| 38 | stbi_write_jpg(filename.c_str(), width, height, 4, &_bitmap[0], 80); |
| 39 | else |
| 40 | error("don't know how to write that image format"); |
| 41 | } |
no test coverage detected