Jose's Read Only Forum 2023

General Category => General Discussion => Topic started by: Randall Glass on August 30, 2013, 04:16:13 AM

Title: What is the best way to use png with transparency?
Post by: Randall Glass on August 30, 2013, 04:16:13 AM
I would like to load a png to the screen, and blend on to the screen, a png with alpha transparency.

What would be the best way to do this?

What is the best, and easiest library to use for this?

Title: Re: What is the best way to use png with transparency?
Post by: Patrice Terrier on August 30, 2013, 10:16:31 AM
You need a graphic Library that is able to work in composited mode, very few indeed ;)
Title: Re: What is the best way to use png with transparency?
Post by: Brice Manuel on August 30, 2013, 10:52:03 AM
Quote from: Randall Glass on August 30, 2013, 04:16:13 AM
I would like to load a png to the screen, and blend on to the screen, a png with alpha transparency.

What would be the best way to do this?

What is the best, and easiest library to use for this?

GDImage.  It should be an industry standard (it is that good).
Title: Re: What is the best way to use png with transparency?
Post by: Patrice Terrier on August 30, 2013, 12:05:26 PM
Randall

see there: broken-glass.png (http://www.jose.it-berater.org/smfforum/index.php?topic=4084.msg19045#msg19045)
Title: Re: What is the best way to use png with transparency?
Post by: Edwin Knoppert on August 30, 2013, 01:59:11 PM
Ordinary Windows gdiplus..

On my site: http://www.hellobasic.com/ you can find iconbrowser.
When you load an icon with png image (App004.ico 32bit 256x256 for example)) you can see the drawing in action in the center part of the app.
Title: Re: What is the best way to use png with transparency?
Post by: Patrice Terrier on August 30, 2013, 02:19:05 PM
Edwin,

QuoteOrdinary Windows gdiplus..
No, it is not related to gdiplus, but to the layered composited mode. However because Windows icon based on png are rendered in composited mode the result looks the same, but for smaller images.

To display large image with variable opacity, you need to resort on DWM (AERO mode) and render the drawing onto the DirectDraw surface, at least this is what i am doing. This is also what does D2D, all the hard work being done by the GPU.

Added:
This HUD window is a good example of GPU composited mode (http://www.jose.it-berater.org/smfforum/index.php?topic=4017.msg13635#msg13635)

...