MCPcopy Create free account
hub / github.com/defold/defold / PushImageParameters

Function PushImageParameters

engine/gamesys/src/gamesys/scripts/script_image.cpp:72–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70 */
71
72 static void PushImageParameters(lua_State* L, dmImage::Image image)
73 {
74 lua_pushliteral(L, "width");
75 lua_pushinteger(L, image.m_Width);
76 lua_rawset(L, -3);
77
78 lua_pushliteral(L, "height");
79 lua_pushinteger(L, image.m_Height);
80 lua_rawset(L, -3);
81
82 lua_pushliteral(L, "type");
83 switch (image.m_Type) {
84 case dmImage::TYPE_RGB:
85 lua_pushliteral(L, "rgb");
86 break;
87 case dmImage::TYPE_RGBA:
88 lua_pushliteral(L, "rgba");
89 break;
90 case dmImage::TYPE_LUMINANCE:
91 lua_pushliteral(L, "l");
92 break;
93 case dmImage::TYPE_LUMINANCE_ALPHA:
94 lua_pushliteral(L, "la");
95 break;
96 default:
97 assert(false);
98 }
99 lua_rawset(L, -3);
100 }
101
102 /*# load image from buffer
103 * Load image (PNG or JPEG) from buffer.

Callers 2

Image_LoadFunction · 0.85
Image_LoadBufferFunction · 0.85

Calls 3

lua_pushintegerFunction · 0.85
lua_rawsetFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected