Hi,

 

I am drawing user-interface elements in Cocoa. I have a problem with 
transparent colors.

I have created a minimal example to illustrate the issue.



https://github.com/JeffMcClintock/AlphaBlender

 

Here is the apps output:



https://synthedit.com/files/AlphaBlender.png

 

To explain, the app is drawing (left to right) first some solid colors (White, 
Black, 50% Grey), then a checkerboard pattern (50% white, 50% black), then two 
blends – 50% white over Black and 50% black over white.

My aim is that any blend of two colors is calculated in a linear RGB color 
space. So ideally all 3 shades on the right would appear to be the same 
brightness as the checkerboard (a physical brightness half way between black 
and white).
I think, based on the sRGB curve that the raw pixel brightness of mid-grey is 
188 (on a scale of 0 – 255) i.e. hex 0xBCBCBC. This is the pixel value that I 
am hoping to achieve with a 50% blend of black and white.

I have tried creating the NSColor with various different colorspaces, but this 
seems to not affect the result of the blending.

Any suggestions of how I can achieve this are appreciated!
Jeff

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to