Re: [AD] OSX IconTool

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> I've been working when I can on a tool to convert images to OSX .icns
> resource files.  I got a reply back from a certain Troy Stephens, whose
> IconFamily code I'm using -- he says that he doesn't object to letting
> allegro use the code as long as we don't interfere with other users
> using and modifying the code, but he's going to take a look and get
> back to me on it.  Regardless, I've moved ahead for now.

Guess what?
I've been working on a fixbundle version myself lately... And I also found
Troy Stephens code while searching for helpful material on the icns file
format.
I also found the layout of the file format, and on a first try I was
creating icons, but they didn't work because it happens the format is not
linear as I thought - instead it uses some kind of compression on image
data, and I have failed to find any reference to the algorithm used.
Some newsgroup messages confirmed me it's actually using compression though.

Anyway, after failing to write the icns file byte after byte, looking at
Troy's code as a reference I modified my app to use the Icon Services API,
as it seems to simplify the task a lot.
I didn't want to use Troy's code directly though as it adds a LOT of
unwanted overhead, and it uses Objective-C that I don't think is necessary
for the kind of application we're making. Also, the Icon Services API is
part of Carbon, and thus C only.
My fixbundle kinda works now, i.e. it writes an icns file with given input
images (Allegro supported formats allowed; datafile objects are supported
too. The images are scaled to one of 16x16, 32x32, 48x48 or 128x128 sizes,
using a small bicubic resampler).
The only problem (I was working on right now) is that the icns file doesn't
seem to work properly... It is recognized by the Icon Browser and Icon
Composer apps as a valid icns file, but the icons appear blank.
I have yet to find where is the problem, but I think mine is the right
approach...
Check it out and tell me what do you think.
Hopefully it'll be fixed in a couple of days!

> I seperated the tools into two programs -- fixbundle.sh, a shell script
> which makes a bundle out of an allegro executable and icon combo, and
> makeicns, an actual program that generates the icons from images.  I
> like the unix way of "many little programs each carrying out one
> specific task."

Humm, I prefer the single app approach, as with the *fixicon Allegro apps
under other platforms, but that's me.

>  However, I've hit a snag: I get a linker error that
> I'm missing __mangled_main_address:
> 
> ld: Undefined symbols:
> __mangled_main_address
> 
> 
> I'm guessing this has to do with the main() magic stuff that allegro
> does.  Has anyone else had any issues compiling an allegro program from
> the command line like this?

Using Allegro under OSX requires the use of the END_OF_MAIN() macro at the
end of the user main() function. Otherwise you'll get that error while
linking.

-- 
Angelo Mottola
a.mottola@xxxxxxxxxx

Attachment: fixbundle.c.gz
Description: Binary data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/