MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / setPixelData

Method setPixelData

src/openrct2-ui/scripting/ScImageManager.hpp:142–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140 }
141
142 static JSValue setPixelData(JSContext* ctx, JSValue thisVal, int argc, JSValue* argv)
143 {
144 JS_UNPACK_INT32(id, ctx, argv[0]);
145 JSValue pixelData = argv[1];
146
147 auto& scriptEngine = GetContext()->GetScriptEngine();
148 auto plugin = scriptEngine.GetExecInfo().GetCurrentPlugin();
149 if (!DoesPluginOwnImage(plugin, id))
150 {
151 JS_ThrowPlainError(ctx, "This plugin did not allocate the specified image range.");
152 return JS_EXCEPTION;
153 }
154
155 try
156 {
157 JSSetPixelData(ctx, id, pixelData);
158 }
159 catch (const std::runtime_error& e)
160 {
161 JS_ThrowInternalError(ctx, "%s", e.what());
162 return JS_EXCEPTION;
163 }
164 return JS_UNDEFINED;
165 }
166
167 static JSValue draw(JSContext* ctx, JSValue thisVal, int argc, JSValue* argv)
168 {

Callers

nothing calls this directly

Calls 5

GetContextFunction · 0.85
DoesPluginOwnImageFunction · 0.85
JSSetPixelDataFunction · 0.85
GetCurrentPluginMethod · 0.80
whatMethod · 0.45

Tested by

no test coverage detected