Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ TheIDE and Library: Releases and ChangeLogs » Unfortunate change in Image interface -> going premultiplied...
Unfortunate change in Image interface -> going premultiplied... [message #10745] Fri, 27 July 2007 12:40 Go to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
This is quite unfortunate and a result of my wrong design decision...

So far, Image RGBA format was "straight", unlike almost any other GUI library in existence.

Unfortunately, long term this is like uphill battle - many operations are really best implemented with premultiplied RGBA format. For example, *correct* rescaling would be many times slower with straight alpha, in fact the only reasonable way how to implement correct rescaling for straight format is to premultiply, rescale and unmultiply... Smile

Therefore it is now required that RGBA pixels in Image are premultiplied, at least if it goes to most operations or is to be painted.

OTOH, it is true that for some operations straight format is better. That is why there are now Premultiply and Unmultiply operations (for ImageBuffer and Image). Also, there are some straight operations, these usually have "Straight" in the name.

Also, to convert Color to RGBA, you can now use operator*, which will correctly premultiply all channels.

Warning, this change is going to break some code - it took me about 2 hours to "fix" my codebase. OTOH, only code that deals with RGBA pixels is going to be affected, and usually it can be easily fixed using Premultiply/Unmultiply...
Re: Unfortunate change in Image interface -> going premultiplied... [message #10940 is a reply to message #10745] Sun, 05 August 2007 22:27 Go to previous messageGo to next message
arturbac is currently offline  arturbac
Messages: 91
Registered: May 2007
Location: Reda, Poland
Member

So this will affect only code wich uses alpha, right ?
ThreadFractRenderer wich I made for examples that uses direct pixel seting dosn't need to be changed ?
Re: Unfortunate change in Image interface -> going premultiplied... [message #10941 is a reply to message #10940] Sun, 05 August 2007 23:36 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Only code using alpha and working with RGBA pixels directly.

And Multiply / Unmultiply provide quite simple fix.
Re: Unfortunate change in Image interface -> going premultiplied... [message #11051 is a reply to message #10941] Thu, 16 August 2007 16:50 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Transparency in imported PNGs is now broken in 708-dev3. see attached test case.
  • Attachment: IconTest.zip
    (Size: 4.68KB, Downloaded 253 times)
Re: Unfortunate change in Image interface -> going premultiplied... [message #11059 is a reply to message #11051] Fri, 17 August 2007 17:48 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
I've had time to look at this now and all that seems seems to be missing is a call to Premultiply.

Adding the call to Raster::GetImage fixes the problem.

Add to uppsrc please? Very Happy
Re: Unfortunate change in Image interface -> going premultiplied... [message #11060 is a reply to message #11059] Fri, 17 August 2007 18:59 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Thanks, fixed. However, the fix was rather needed in plugin/png and RasterFormat...
Previous Topic: fixed compiling SQL_PostgreSql reference (Bas)
Next Topic: Optimized painting when there is a lot of out of screen widgets...
Goto Forum:
  


Current Time: Tue Apr 23 12:18:58 CEST 2024

Total time taken to generate the page: 0.02176 seconds