MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / make

Method make

source/base/scripting/StarImageLuaBindings.cpp:8–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6namespace Star {
7
8LuaMethods<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}

Callers

nothing calls this directly

Calls 9

processImageOperationsFunction · 0.85
parseImageOperationsFunction · 0.85
registerMethodMethod · 0.80
toRgbaMethod · 0.80
subImageMethod · 0.80
assetsMethod · 0.80
setMethod · 0.45
getMethod · 0.45
imageMethod · 0.45

Tested by

no test coverage detected