René's URL Explorer Experiment


Title: Add support for pre-multiplied alpha · Issue #3391 · processing/processing · GitHub

Open Graph Title: Add support for pre-multiplied alpha · Issue #3391 · processing/processing

X Title: Add support for pre-multiplied alpha · Issue #3391 · processing/processing

Description: At the bottom of this pull request (#2601) @benfry mentioned opening an issue about implementing pre-multiplied alpha, which I don't think was ever done? I certainly dropped the ball on following up. It would be great if an official imag...

Open Graph Description: At the bottom of this pull request (#2601) @benfry mentioned opening an issue about implementing pre-multiplied alpha, which I don't think was ever done? I certainly dropped the ball on following u...

X Description: At the bottom of this pull request (#2601) @benfry mentioned opening an issue about implementing pre-multiplied alpha, which I don't think was ever done? I certainly dropped the ball on followi...

Opengraph URL: https://github.com/processing/processing/issues/3391

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add support for pre-multiplied alpha","articleBody":"At the bottom of this pull request (https://github.com/processing/processing/pull/2601) @benfry mentioned opening an issue about implementing pre-multiplied alpha, which I don't think was ever done? I certainly dropped the ball on following up.  It would be great if an official image mode for this was added (I'm currently sub-classing the GL renderer to achieve this).  Otherwise multiple layering (as well as convolution, etc) don't work correctly.\n\nFor reference, a long and admittedly opinionated extract of an email sent to @JakubValtar last year with a suggestion for handling this internally in the OpenGL renderer - feel free to TL;DR, although the NVIDIA link is worth a read.\n\n---\n\nOK, you asked me how Processing might use pre-multiplied alpha without\nbreaking the API.  So to start, a possibly controversial statement -\nblending in Processing is completely broken.  It was one of the\nreasons I stopped using Processing the first time around (~2006) - I\nlike the API but in my opinion there are some issues with the\nimplementation.  Praxis LIVE v1 deliberately made use of aspects of\nthe Processing API, but re-implemented on top of a custom software and\nOpenGL renderer.  Fast forward to a year ago, and I decided to stop\ntrying to re-implement the API - the new Processing OpenGL is too good\nto miss!  So Praxis LIVE v2 now embeds Processing as a library -\nhowever, there's no way I'm breaking blending in the process - luckily\nit isn't that difficult to work around.\n\nThere are many sources around about pre-multipled alpha.  I found this\npage recently looking into GL blend modes\n(http://www.slideshare.net/Mark_Kilgard/blend-modes-for-opengl) - it's\nabout the new NVIDIA blend mode extensions - note that slide 16 talks\nabout the fact that blend modes assume pre-multiplied alpha.  It\nmentions one of the key issues (one that affects me) - drawing into\nsurfaces with alpha channels - sometimes you can get away with it if\nthe destination is opaque.  He also mentions the Porter-Duff model and\nhow it relies on pre-multiplied alpha - interesting that the default\nblending in the Java2D renderer works fine - because the JRE\nAlphaComposite  pre-multiplies, blends and un-premultiplies.\n\nIncidentally, that slide also touches on another issue -\npre-multiplied alpha is necessary for performing various filtering\neffects (eg. blur) on surfaces with alpha.  I haven't looked at the\nPImage filters but I imagine there might be an issue there (note the\nConvolveOp in the JRE multiplies, filters and unmultiplies).\n\nNow, all that multiplying and unmultiplying is a bit pointless! ;-)\nNot to mention it's not easily achievable with OpenGL.  So, how to use\npre-multiplied alpha without changing the API?\n\nThe important thing in my opinion is separating the external format of\nimages to the format they're stored internally.  Take managed images\nin the Java2D backend - cached textures are not stored in the format\nof the BufferedImage, but the optimum format for rendering.  Just\nbecause the format to the user is un-premultiplied ARGB doesn't mean\nthat the underlying storage has to be.  Processing could easily switch\nto storing the underlying pixel data, in all modes, as pre-multiplied.\nOr, simpler, though not fixing issues elsewhere, it could just store\npre-multiplied data in the OpenGL textures.\n\nThe key things to handle are times when the user is setting colours,\ntimes when the user is retrieving colours, and access to the pixel\narray.\n\nProcessing already does colour calculations to match a colour format\nset by the user and convert into internal data.  What I've done in\nPraxis LIVE's PGraphics sub-class is override the various colorCalc()\nmethods to multiply in the alpha.  That's pretty much all that I'm\nusing right now, but then I don't have 100% API coverage!  It would be\npossible to handle multiply and unpremultiply fairly easily in set()\nand get(), which leaves the pixel array - I'd suggest running a\nun-premultiply \u003c\u003e premultiply during loadPixels() and updatePixels(),\nwith an extra hint to leave it premultiplied and save any hit (of\ncourse RGB images wouldn't have any anyway).\n\nI'm not quite sure if there would be any implications to PShape that\nwould need looking at - I guess I'll find out when I come to\nintegrating support for them! ;-)\n\nThe one aspect of the API that would change would be GLSL - mind you\nI'd assert that's fixing it rather than breaking it - however, it's\nthe one place that might affect the behaviour of user code.\n\nIncidentally, if it's of interest - some alternate software blend\nmodes that I and another person on the Java Gaming forum worked on a\nfew years back - all using pre-multiplied alpha, obviously -\nhttp://www.java-gaming.org/topics/some-new-blendmodes-add-multiply-overlay-etc/24529/view.html\n","author":{"url":"https://github.com/neilcsmith-net","@type":"Person","name":"neilcsmith-net"},"datePublished":"2015-06-16T16:45:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":14},"url":"https://github.com/3391/processing/issues/3391"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:d12684f6-5908-4692-9639-c66384356e76
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8446:3EC154:3AAB732:4E70425:696F1F8C
html-safe-nonce567bfeb9502543e5d1a3ba05fb0c28380214eee8dbecb9a8215a6d49b4463b82
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDQ2OjNFQzE1NDozQUFCNzMyOjRFNzA0MjU6Njk2RjFGOEMiLCJ2aXNpdG9yX2lkIjoiNTg1NjAyMjc4MTI1NzI2MDk0MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacdaf3e94f9b69500e6f54288459f5044090ac65cb2108da4b25eba3a6e65beedb
hovercard-subject-tagissue:88780027
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/processing/processing/3391/issue_layout
twitter:imagehttps://opengraph.githubassets.com/0fe16a35c3c33f20fec5f8677d8003bf7fb5d3e284e9773d10b79f3bbfb960ce/processing/processing/issues/3391
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/0fe16a35c3c33f20fec5f8677d8003bf7fb5d3e284e9773d10b79f3bbfb960ce/processing/processing/issues/3391
og:image:altAt the bottom of this pull request (#2601) @benfry mentioned opening an issue about implementing pre-multiplied alpha, which I don't think was ever done? I certainly dropped the ball on following u...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameneilcsmith-net
hostnamegithub.com
expected-hostnamegithub.com
Noneb278ad162d35332b6de714dfb005de04386c4d92df6475522bef910f491a35ee
turbo-cache-controlno-preview
go-importgithub.com/processing/processing git https://github.com/processing/processing.git
octolytics-dimension-user_id1617169
octolytics-dimension-user_loginprocessing
octolytics-dimension-repository_id7807399
octolytics-dimension-repository_nwoprocessing/processing
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id7807399
octolytics-dimension-repository_network_root_nwoprocessing/processing
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release39aed5006635ab6f45e6b77d23e73b08a00272a3
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/processing/processing/issues/3391#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fprocessing%2Fprocessing%2Fissues%2F3391
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fprocessing%2Fprocessing%2Fissues%2F3391
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=processing%2Fprocessing
Reloadhttps://github.com/processing/processing/issues/3391
Reloadhttps://github.com/processing/processing/issues/3391
Reloadhttps://github.com/processing/processing/issues/3391
processing https://github.com/processing
processinghttps://github.com/processing/processing
Please reload this pagehttps://github.com/processing/processing/issues/3391
Notifications https://github.com/login?return_to=%2Fprocessing%2Fprocessing
Fork 1.5k https://github.com/login?return_to=%2Fprocessing%2Fprocessing
Star 6.5k https://github.com/login?return_to=%2Fprocessing%2Fprocessing
Code https://github.com/processing/processing
Issues 471 https://github.com/processing/processing/issues
Pull requests 23 https://github.com/processing/processing/pulls
Actions https://github.com/processing/processing/actions
Wiki https://github.com/processing/processing/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/processing/processing/security
Please reload this pagehttps://github.com/processing/processing/issues/3391
Insights https://github.com/processing/processing/pulse
Code https://github.com/processing/processing
Issues https://github.com/processing/processing/issues
Pull requests https://github.com/processing/processing/pulls
Actions https://github.com/processing/processing/actions
Wiki https://github.com/processing/processing/wiki
Security https://github.com/processing/processing/security
Insights https://github.com/processing/processing/pulse
New issuehttps://github.com/login?return_to=https://github.com/processing/processing/issues/3391
New issuehttps://github.com/login?return_to=https://github.com/processing/processing/issues/3391
Add support for pre-multiplied alphahttps://github.com/processing/processing/issues/3391#top
https://github.com/codeanticode
enhancementhttps://github.com/processing/processing/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com/neilcsmith-net
https://github.com/neilcsmith-net
neilcsmith-nethttps://github.com/neilcsmith-net
on Jun 16, 2015https://github.com/processing/processing/issues/3391#issue-88780027
#2601https://github.com/processing/processing/pull/2601
@benfryhttps://github.com/benfry
@JakubValtarhttps://github.com/JakubValtar
http://www.slideshare.net/Mark_Kilgard/blend-modes-for-openglhttp://www.slideshare.net/Mark_Kilgard/blend-modes-for-opengl
http://www.java-gaming.org/topics/some-new-blendmodes-add-multiply-overlay-etc/24529/view.htmlhttp://www.java-gaming.org/topics/some-new-blendmodes-add-multiply-overlay-etc/24529/view.html
codeanticodehttps://github.com/codeanticode
enhancementhttps://github.com/processing/processing/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.