I looked into testing a CGGradient but see it requires a CGColorSpace and that’s something I haven’t quite wrapped my head around yet.
Thinking about color space though got me thinking it’s my display. When I draw columns of grey increasing 1 by 1 I get a perceptual grouping of columns. The columns increase linearly within, but between groups the step seems to be bigger, stand out in some way.
In this picture I marked off the groupings I see then looked at it on my phone (identical grouping) and on another laptop (some groupings were different). Does everyone see these groups?

Oddly, measuring the grey values with the OS’s pipette yields inconsistent results. Two visually distinct columns give the value 34 while another pair of columns that straddle the group discontinuity go up by just 1.
This got me thinking colors really are floating point and the [0-255] values are just for display purposes.
Then I remembered a javascript dithering demo. It sets pixels as [0-255] int values yet shows a perfectly smooth dithered gradient and most importantly the undithered gradient has no column groupings!
fullsize example
http://rectangleworld.com/demos/DitheredGradient/DitheredGradientExample.html
reference
http://rectangleworld.com/blog/archives/713
So in javascript you can get visually linear grey steps but in a Xojo Canvas with this paint code I get the following image. Plus drawing to a Picture then DrawPicturing that to the Canvas has slightly different grouping.
[code]Sub Paint(g As Graphics, areas() As REALbasic.Rect)
dim last As integer = g.Width / 10
for i As integer = 0 to last
g.ForeColor = RGB(i, i, i)
g.FillRect i * 10, 0, 10, g.Height
next
End Sub[/code]

Somethings going on but I’m still not sure what. Dithering isn’t the problem, it’s this magical shifting of color values that creates those column groupings. Do I have to set the colors only through CG functions? Do I have to create a CGImage/Context too or will the context from a Xojo Picture or Graphics work? Is the fix just a simple change to the Xojo given CGContext?
This conversation might relate, about NSGradient drawing banded. The solution was to create the NSGradient once instead of every draw call. Unfortunately it’s unknown why it works.

https://forum.xojo.com/20548-nsgradient-looks-ugly-why
This started as just trying to implement Floyd-Steinberg 