diff --git a/automation/v4-docs/get-frame.txt b/automation/v4-docs/get-frame.txt index 5d75e5055..99342ac4a 100644 --- a/automation/v4-docs/get-frame.txt +++ b/automation/v4-docs/get-frame.txt @@ -40,7 +40,7 @@ Returns: number Get RGB pixel value at a certain position of frame object. -function frame:frame:getPixel(x, y) +function frame:getPixel(x, y) @x (number) Pixel to retrieve on the x-axis @@ -48,8 +48,10 @@ function frame:frame:getPixel(x, y) @y (number) Pixel to retrieve on the y-axis -Returns: number - Integer value representing the RGB pixel value. +Returns: 3 values, all numbers + 1. R value of the pixel + 2. G value of the pixel + 3. B value of the pixel --- diff --git a/src/auto4_lua.cpp b/src/auto4_lua.cpp index b5e381fe1..449a27989 100644 --- a/src/auto4_lua.cpp +++ b/src/auto4_lua.cpp @@ -230,12 +230,13 @@ namespace { size_t pos = y * frame->pitch + x * 4; // VideoFrame is stored as BGRA, but we want to return RGB - int pixelValue = frame->data[pos+2] * 65536 + frame->data[pos+1] * 256 + frame->data[pos]; - push_value(L, pixelValue); + push_value(L, frame->data[pos+2]); + push_value(L, frame->data[pos+1]); + push_value(L, frame->data[pos]); } else { lua_pushnil(L); } - return 1; + return 3; } int FramePixelFormatted(lua_State *L) {