I get the same problem on my system (both for strings and other primitives), and using the Pixel constructor directly instead of mapRGB seems to give the correct colors.
For example, if I import Graphics.UI.SDL.Color as SDLC , and then let white' = SDLC.Pixel maxBound , I get a white line, as expected. If SDLC.Pixel 4278190335 (or 255 * 2^24 + 255 , a reasonable value for red), I get a red line.
This is clearly not a real solution or answer, but it may offer some starting points.
Another weird thing: if I print both your white and mine, like this:
print =<< SDL.getRGBA white (SDL.surfaceGetPixelFormat surf0) print =<< SDL.getRGBA white' (SDL.surfaceGetPixelFormat surf0) print white print white'
I get this:
(255,255,255,255) (255,255,255,255) Pixel 16777215 Pixel 4294967295
So they look the same through getRGBA , but the actual Pixel values ββare different.
Travis brown
source share