View Single Post
Old 28 March 2011, 13:21   #28
PeterK
Registered User
 
Join Date: Apr 2005
Location: Hangover
Posts: 1,668
In icon.library 46.4.195 the PNG icon loading is much faster now if a small sample PNG image exists as Prefs/ENV-Archive/Datatypes/1.PNG. This is used to find the installed PNG datatype only once and then establish it as the default decoder to avoid wasting a lot of time with trying out all other picture datatype descriptors again and again for every icon.

You can use akPNG, PNGdt or WarpPNG. The latter has two possible settings:
1.) Use the AplhaChannel with a black background, which is better for the GlowRevolution icons, but worse for others. This is also the way PNGdt works.
2.) Ignore the AlphaChannel like akPNG, which is better for the samples of PowerIcons and most other icon collections.

Unfortunately, akPNG has a memory loss of 48 bytes per icon and WarpPNG loses 24 bytes per icon. Only the PNGdt from Gunther Nikl has no memory losses.

There is still no DualPNG support yet. Give me some more time please.
Btw, the icon snapshot is only possible after converting them with WB:icon->information. Just select a bunch of icons all together with the lasso and then save them at once with WB:icon->info from a big stack of requesters. Of course, that will remove the TrueColor data and the second image atm !

Update below: http://eab.abime.net/showpost.php?p=751162&postcount=67

@James
Thanks a lot for your suggestion. I've seen that already before but didn' play with it yet. I'm missing something like a SDK or an autodoc description. Another possibility could be the iconobject.library system from Scalos. It supports ARGB directly, but not everybody has these files installed.

@Minous
Quote:
...You are not happy with the current toolbar and want transparent PNG toolbar icons!? I would still have to pick a default background colour so I don't think the effect would be really different...
Sorry, I don't know anything about your tooolbar, but since I couldn't use the AlphaChannel data for transparency I decided to fake Alpha data with these two simple rules: If either a pixels ARGB is 0/0/0/0 or the same as the ARGB of the first pixel (upper left corner) then make it transparent. In any other case its color is 100% visible. This is indeed a really big assumption, but it seems to work in more than 95% of all cases.The only sideeffect are sometimes some transparent holes in the image.
Code:
                    MOVEA.L        $34(SP),A0               ; start of image
                    MOVE.L         (A0),D2                  ; color of first pixel
                    MOVE.L         D4,D0
                    LSL.L          #2,D0                    ; 4 * full size
                    ADDA.L         D0,A0                    ; + start of image
                    MOVE.L         A0,$38(SP)               ; = end of image
                    SUBQ.B         #mskHasAlpha,bmh_Masking(A4)
                    BEQ.S          .hasAlphaChannel
                    MOVE.L         D4,D0
                    SUBQ.L         #1,D0
.fakeAlphaChannel   MOVE.L         -(A0),D1                 ; color = black ?
                    BEQ.S          .settransparency
                    CMP.L          D2,D1                    ; color of 1. pixel ?
.settransparency    SNE.B          (A0)                     ; if not make visible
                    DBRA.S         D0,.fakeAlphaChannel
.hasAlphaChannel   .....

Last edited by PeterK; 21 April 2011 at 07:53.
PeterK is offline  
 
Page generated in 0.05405 seconds with 9 queries