Page 2 of 2
Re: More saving icons: updated Nov 15, 2009
Posted: Tue May 10, 2016 6:54 pm
by netmaestro
This doesn't make cursors per se it only writes them out to disk. That said, all you need for a complete solution is a valid object to save, just feed it to this code and you're there. In my first year of coding with PB I asked on these forums how I might create a cursor from a bitmap of my choosing. Sparkle replied with a sample and I still use variations of his code today. Here is the topic I found so helpful:
http://purebasic.fr/english/viewtopic.p ... sor+bitmap
Re: More saving icons: updated Nov 15, 2009
Posted: Wed May 11, 2016 5:00 am
by collectordave
Thats a good piece of code got it working with my .png files.
Thanks
Re: More saving icons: updated Nov 15, 2009
Posted: Thu May 12, 2016 1:46 pm
by collectordave
Just a quick question hopefully.
I am now saving .png files and .ico files. I have found that some colours do not appear in the .ico format. Downloaded and tried a .png to .ico convertor from the net with exactly the same results.
Is there a limited range of colours that can be used for icons?
Regards
CD
Re: More saving icons: updated Nov 15, 2009
Posted: Thu May 12, 2016 2:05 pm
by netmaestro
Afaik an icon can display 24-bit colours so that should cover the spectrum, however they don't use the alpha channel. Transparency is realized with the use of a mask. Therefore any colour that has an alpha component may not receive a perfectly true rendering. That said, my code does have a size-minimization routine that first counts the colours actually used in the image and then chooses the smallest possible output format that will display them all. I suppose it's possible that I've outsmarted myself somewhere in there but I do remember that it all made sense at the time. But then, many a fiasco of galactic proportions "made sense at the time".