[MACTCL] IconServices and tkMacOSXBitmap.c
by Kevin Walzer other posts by this author
Mar 8 2007 8:15AM messages near this date
Re: [MACTCL] The 'sometimes buttons don't draw' bug.
|
Re: [MACTCL] IconServices and tkMacOSXBitmap.c
I'm revisiting an earlier interest in getting Tk to display Mac-native
icons under Aqua. Tk had this capability under Classic, but it is
currently broken. My current method to display Mac-native icons is to
use an external command-line tool to retrieve the icon, then convert it
to a PNG via the sips tool. I would prefer to have a method to get icon
data in the same manner as other Carbon applications, via IconServices;
given a file path, Carbon would display the correct icon/image data in Tk.
Because I'm not an expert with C, my question is whether this could be
accomplished by patching tkMacOSXBitmap.c, or whether I would need to
delve much deeper into defining a new image format or doing some
conversion of icon data at the C level to display in Tk. Looking at
tkMacOSXBitmap.c, it appears to make at least some use of IconServices
(the function "GetIcon" is defined in IconServices). However, it focuses
mainly on old-style resource files (and uses QuickDraw calls--aren't
these deprecated?). The modern API for obtaining icon data is GetIconRef
and related functions. Is there any way to add this API to the
tkMacOSXBitmap.c file?
The alternative approach I've envisioned involves creating a new image
format for Tk that could read data from GetIconRef, or alternatively,
doing some conversion of IconRef to a bitmap format that Tk can
recognize, via CoreGraphics or CoreImage. But creating a new image
format for Tk is out of my depth, and I have not found any method to
convert IconRef's into a standard image format, at least in Carbon.
(There are some methods that go the other way, i.e. convert a PNG to an
IconRef or something similar.)
Any advice is appreciated.
--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Tcl-mac mailing list
tcl-mac@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-mac
Thread:
Kevin Walzer
Bernard Desgraupes
Kevin Walzer
|