Linear Alpha Blending
site_archiver@lists.apple.com Delivered-To: Cocoa-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=synthedit.com; s=x; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To: From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=KwC4LesfcOuSPN88xMhBQ4mow4XWAFqSP3zlq65LiUw=; b=zGJ4f/SanLknykenkXo0APrJDs aiZEHQKoQTEh2XYGxP7RYIGcpwoOhg5t3SH0eypFtXEFf3fS8/YQcWWft9X91rC39zhnKcMC6slIs v1pgzd9r91YKLEPewz5RuiOGyjQMs/YSEuK1TVh4FGSxt89zNeuZ+Ov09jZcSUA828cPlHx0F0m2u nMJIvKqsnB4A59DUIZsi/gVRRiDihSP98VJLcY/l38Uxzo4SfaYpV0DeqdL/CD9mcdzQ9Ovjwawd0 B73pP/A2LBlAvc3r/olBdBalWNQgOVRThgDRTJrM2QFr9BOiqsl/RV4e+9Dnpq7ekFKi9xeySRx7F J5wlVlkQ==; Thread-index: Adn70PzDYm/6B5hTQniPtc2u5BiM8Q== 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/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Jeff McClintock via Cocoa-dev