Closed dom1817 closed 3 years ago
ofPixels:getColor() returns an RGBA value instead of a single value, even if allocated using the of.PIXEL_GRAY format. All the other settings are updated properly.
ofPixels:getColor()
local pixels = of.Pixels() pixels:allocatePixelFormat(width, height, of.PIXELS_GRAY) print("------------------------------------------------") print("Pixel color:", pixels:getColor(1,1)) print("Size:", pixels:size()) print("Bits per pixels", pixels:getBitsPerPixel()) print("Pixel channels", pixels:getNumChannels()) print("------------------------------------------------")
Returns:
------------------------------------------------ Pixel color: 0, 0, 0, 255 ? Size: 389550.0 Bits per pixels 8.0 Pixel channels 1.0 ------------------------------------------------
That is expected as ofColor uses RGBA internally: https://github.com/openframeworks/openFrameworks/blob/e6e4ee1da88f507f36bad503cd329b31eaadccac/libs/openFrameworks/types/ofColor.h#L83
ofPixels:getColor()
returns an RGBA value instead of a single value, even if allocated using the of.PIXEL_GRAY format. All the other settings are updated properly.Returns: