| 47 | static FileFormat::Regular<SheFormat> ff{"she"}; |
| 48 | |
| 49 | bool SheFormat::onLoad(FileOp* fop) |
| 50 | { |
| 51 | try { |
| 52 | auto surface = std::shared_ptr<she::Surface>(she::instance()->loadRgbaSurface(fop->filename().c_str())); |
| 53 | auto width = surface->width(); |
| 54 | auto height = surface->height(); |
| 55 | Image* image = fop->sequenceImage(IMAGE_RGB, width, height); |
| 56 | for (int y = 0; y < height; ++y) { |
| 57 | for (int x = 0; x < width; ++x) { |
| 58 | auto c = surface->getPixel(x, y); |
| 59 | auto r = gfx::getr(c); |
| 60 | auto g = gfx::getg(c); |
| 61 | auto b = gfx::getb(c); |
| 62 | auto a = gfx::geta(c); |
| 63 | put_pixel(image, x, y, doc::rgba(r,g,b,a)); |
| 64 | } |
| 65 | } |
| 66 | return true; |
| 67 | } catch (...) {} |
| 68 | |
| 69 | return false; |
| 70 | } |
| 71 | |
| 72 | } // namespace app |
nothing calls this directly
no test coverage detected