| 6 | namespace Star { |
| 7 | |
| 8 | LuaMethods<Image> LuaUserDataMethods<Image>::make() { |
| 9 | LuaMethods<Image> methods; |
| 10 | |
| 11 | methods.registerMethodWithSignature<Vec2U, Image&>("size", mem_fn(&Image::size)); |
| 12 | methods.registerMethodWithSignature<void, Image&, Vec2U, Image&>("drawInto", mem_fn(&Image::drawInto)); |
| 13 | methods.registerMethodWithSignature<void, Image&, Vec2U, Image&>("copyInto", mem_fn(&Image::copyInto)); |
| 14 | methods.registerMethod("set", [](Image& image, unsigned x, unsigned y, Color const& color) { |
| 15 | image.set(x, y, color.toRgba()); |
| 16 | }); |
| 17 | |
| 18 | methods.registerMethod("get", [](Image& image, unsigned x, unsigned y) { |
| 19 | return Color::rgba(image.get(x, y)); |
| 20 | }); |
| 21 | |
| 22 | methods.registerMethod("subImage", [](Image& image, Vec2U const& min, Vec2U const& size) { |
| 23 | return image.subImage(min, size); |
| 24 | }); |
| 25 | |
| 26 | methods.registerMethod("process", [](Image& image, String const& directives) { |
| 27 | return processImageOperations(parseImageOperations(directives), image, [](String const& path) -> Image const* { |
| 28 | if (auto root = RootBase::singletonPtr()) |
| 29 | return root->assets()->image(path).get(); |
| 30 | else |
| 31 | return nullptr; |
| 32 | }); |
| 33 | }); |
| 34 | |
| 35 | return methods; |
| 36 | } |
| 37 | |
| 38 | } |
nothing calls this directly
no test coverage detected