zcodeclib: PNG files with transparent pixels

C and PASCAL (or any other high-level languages) in here please

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

User avatar
jfl
Atari Super Hero
Atari Super Hero
Posts: 882
Joined: Tue Jul 18, 2006 10:55 pm
Location: Liège, Belgium
Contact:

zcodeclib: PNG files with transparent pixels

Postby jfl » Sun Dec 01, 2013 11:28 am

Hi,

I'm trying Zorro's zcodelic lib in one of my projects and it's working fine except that I can't get transparent pixels to be displayed transparent (instead of white). Since some of wongck's apps (PH Weather comes to mind) do it I suppose it must be possible but I can't find anything in the doc about this.

Any ideas from those who used this lib?

JFL
Jean-François
GEMDict – GEMClip

m0n0
Captain Atari
Captain Atari
Posts: 426
Joined: Mon Oct 05, 2009 3:13 am
Contact:

Re: zcodeclib: PNG files with transparent pixels

Postby m0n0 » Tue Dec 03, 2013 12:49 am

Hello,

I don't use the zcodecs, but... transparency is something that happens during blitting the image to the screen (or onto another image). I don't know if zcodec is also doing blits...

As there is no blit function available within VDI which handles True-Color blit's with an alpha channel, you first have to grab a screenshot... and then blit the bitmap onto that screenshot. That's how I do it with netsurf. Walk through each pixel and when the pixel has transparency, blend the color of the screenshot with the one of the image to blit. otherwise just replace the pixel.

I would like to know if there is any other option, but I doubt that. Maybe super-videl implements something for blitting bitmaps that have alpha channel?

Greets

instream
Nature
Nature
Posts: 173
Joined: Mon Aug 03, 2009 9:08 am
Location: Göteborg, Sweden
Contact:

Re: zcodeclib: PNG files with transparent pixels

Postby instream » Wed Dec 04, 2013 12:45 pm

In the supervidel there is alpha blitting support in the 32bit ARGB format, with 8bit alpha channel, and 16bit RGAB with one alpha bit in bit 5 of the 16 bits. There is also a byte based selective blitting, where a byte is not written to the destination if it is 0. This can be used in 8bit chunky mode, where color 0 is then transparent, and in 16bit mode where you need to make the whole pixel 0x0000, to make it transparent when blitting.

Unfortunately VDI has no support for this as you said. I know that NVDI 5.0x supports offscreen bitmaps and can convert on the fly between different bit depths. But I don't remember if it supports alpha copying also.

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12789
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: zcodeclib: PNG files with transparent pixels

Postby wongck » Sat Dec 14, 2013 2:54 pm

No special operations for my programs.
I just use the common white colour for my RSC box.
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

User avatar
jfl
Atari Super Hero
Atari Super Hero
Posts: 882
Joined: Tue Jul 18, 2006 10:55 pm
Location: Liège, Belgium
Contact:

Re: zcodeclib: PNG files with transparent pixels

Postby jfl » Sat Dec 14, 2013 6:31 pm

wongck wrote:No special operations for my programs.
I just use the common white colour for my RSC box.

The icon box in the "details" dialog (Tree003 in your RSC) of PHWeather is a userdef. The PNG file that is drawn there has no white background. If I use the same PNG file in a userdef in my program the image is drawn over a white background. Why the difference?
Jean-François
GEMDict – GEMClip

User avatar
jfl
Atari Super Hero
Atari Super Hero
Posts: 882
Joined: Tue Jul 18, 2006 10:55 pm
Location: Liège, Belgium
Contact:

Re: zcodeclib: PNG files with transparent pixels

Postby jfl » Sat Dec 14, 2013 8:38 pm

jfl wrote:
wongck wrote:No special operations for my programs.
I just use the common white colour for my RSC box.

The icon box in the "details" dialog (Tree003 in your RSC) of PHWeather is a userdef. The PNG file that is drawn there has no white background. If I use the same PNG file in a userdef in my program the image is drawn over a white background. Why the difference?

OK, I got it, it's the writing mode of vro_cpyfm(). With NOT_SXORD I get the same result as you, a transparent background -- but with other problems, so this is not ideal.
Jean-François
GEMDict – GEMClip

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12789
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: zcodeclib: PNG files with transparent pixels

Postby wongck » Sat Dec 14, 2013 10:16 pm

I think the key is what is the transparent colour of the PNG.
I don't remember doing anything special except looking for some appropriate graphics.
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list


Social Media

     

Return to “C / PASCAL etc.”

Who is online

Users browsing this forum: No registered users and 2 guests