Hi #PB_All,
I encountered a difference between using icons or PNGs on gadgets.
Example ButtonImage (please ignore that the screenshots are slightly different, don't know why the sizes differ):
Icon/PNG enabled
Icon disabled
PNG disabled
The pictures are basically the same (32 bit with alpha). Also multiple reconversion between icon and png doesn't alter the picture itself.
Is the difference normal?
Difference between icons and PNGs on gadgets
Difference between icons and PNGs on gadgets
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
- Michael Vogel
- Addict
- Posts: 2666
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Difference between icons and PNGs on gadgets
Maybe you could make the two files available for investigation, but...
...the icon file format does include an additional bit mask information which can be found at the end of the file.
...the icon file format does include an additional bit mask information which can be found at the end of the file.
Re: Difference between icons and PNGs on gadgets
Yes, it's normal as we use the icon directly and Windows has its own greying routine for icons. When using images we use our color to grey routine which looks different.
Re: Difference between icons and PNGs on gadgets
Thanks you both, I suspected that.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
- Michael Vogel
- Addict
- Posts: 2666
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Difference between icons and PNGs on gadgets
I wrote a function which may be helpful for you to convert the icon to "purebasic image format"
Something else I have done for creating dynamic icons (useful for systray animation, etc.), maybe helpful somewhen...
Code: Select all
Procedure CopyImageWithDepth(Source.i,Destination.i,Depth=32)
If ImageDepth(Source,#PB_Image_OriginalDepth)<>Depth Or ImageFormat(Source)=#PB_ImagePlugin_ICON Or ImageFrameCount(Source)<>1 CreateImage(Destination,ImageWidth(Source)+Border<<1,ImageHeight(Source)+Border<<1,Depth,#PB_Image_Transparent);
StartDrawing(ImageOutput(Destination))
DrawingMode(#PB_2DDrawing_AllChannels); Alpha-Channel=255 bei 24-Bit-Bildern (im Default-Modus=0)
DrawImage(ImageID(Source),Border,Border)
StopDrawing()
Else
CopyImage(Source,Destination)
EndIf
EndProcedure
Something else I have done for creating dynamic icons (useful for systray animation, etc.), maybe helpful somewhen...
Code: Select all
; File-Header 6 Bytes
Data.w 0; 0 (File Identifier)
Data.w 1; 1=Ico, 2=Cur
Data.w 1; [n]=Number of Images
; List of Icons 16 Bytes * [n]
Data.a 20; Width (0=256)
Data.a 20; Height (0=256)
Data.a 0; [c]=Color Count (0=256 Colors)
Data.a 0; 0 (Reserved)
Data.w 1; Ico: Color Planes (0 or 1), Cur: X-Hotspot
Data.w 32; Ico: Bits per Pixel, Cur: Y-Hotspot
Data.l 1720; Bitmap Data Size (in bytes, z.B. InfoHeader+20*20*4+XorBitmap)
Data.l 22; File Offset (InfoHeader)
; Icon Data I InfoHeader: 40 Bytes
Data.l 40; Size of InfoHeader
Data.l 20; Icon Width
Data.l 40; Icon Height (=XorBitmap + And-Bitmap)
Data.w 1; Number of Planes (1)
Data.w 32; Ico: Bits per Pixel
Data.l 0; Compression-Type (0=uncompressed)
Data.l 0; Size of Image in Bytes (0=uncompressed)
Data.l 0; X-PixelsPerM (0=unused)
Data.l 0; Y-PixelsPerM (0=unused)
Data.l 0; Colors used (0=unused)
Data.l 0; Colors important (0=unused)
; Icon Data II Color Map for Xor-Bitmap: 4 Bytes * [c]
Data.a 255; red
Data.a 255; green
Data.a 255; blue
Data.a 0; reserved (0)
; Icon Data III Bitmaps
Data.a 0;... And-Bitmap (z.B. 20x20x4 Bytes)
Data.l 0;... Xor-Bitmap (z.B. 20x4* Bytes) *) 8 Pixel pro Byte > 20/8=2.5 > 4, weil pro Zeile auf 32 Bit aufgerundet wird
Re: Difference between icons and PNGs on gadgets
or let them scroll
(Not sure, if that stone old code still works, though)
(Not sure, if that stone old code still works, though)
{Home}.:|:.{Dialog Design0R}.:|:.{Codes}.:|:.{Downloads}.:|:.{History Viewer Online}
Re: Difference between icons and PNGs on gadgets
Nah, it's ok. I included the PNGs now, they look better when disabled. I would prefer to have them a bit faded, but that's just my liking (also I know, I can do it myself and create a second image that is used when the button is disabled or use a canvas).
I was just curious and my question was answered.
I was just curious and my question was answered.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB