I'm creating a color picker for iOS. I would like to enable the user to select the brightness (luminance) and have the color wheel reflect this change. I'm using Core Image to modify the brightness with the CIColorControls filter. Here's my code:
-(CIImage *)oldPhoto:(CIImage *)img withBrightness:(float)intensity
{
CIFilter *lighten = [CIFilter filterWithName:@"CIColorControls"];
[lighten setValue:img forKey:kCIInputImageKey];
[lighten setValue:@((intensity * 2.0) - 1.0) forKey:@"inputBrightness"];
return lighten.outputImage;
}
Here's how the color wheel looks with intensity = 0.5 (inputBrightness = 0):

The problem is that the color wheel looks wrong when intensity < 0.5. For example, here's how it looks with intensity = 0.3 (inputBrightness = -0.4):

Notice that there's a black circle in the middle, and the rest of the image hasn't been darkened correctly either. This is supposed to be an HSL color wheel, so I guess that what I actually want to change is the luminance, not the brightness.
First, can anyone explain why the image looks like this? I'm not an expert on color; it seems odd that the center of the circle quickly clips to black while the edges of it don't darken much.
Second, how can I achieve the effect I want?
Here's how I actually WANT the image to look:

This was created with a custom HSL function and luminance = 0.3. This runs on the CPU, so it's far too slow for my needs. I'd be happy to post the code for this HSL function, but I didn't include it because it didn't seem immediately relevant. If you want to see it, just ask.
Pleas