Le 4 janv. 05, à 14:54, M. Uli Kusterer a écrit :

At 12:07 Uhr +0100 04.01.2005, Quentin Mathé wrote:

yes +setCompositor: :-)

Oh, one more thing: I just realized it'll be nearly impossible to specify a compositor on MacOS. Because Icon Services takes care of all that for me. I would basically have to write my own version of the entire Icon Services icon badging code... So, could we maybe take that out of the "cross-platform standard"?

You may could make +setCompositor: a method in a GNUstep-specific category on IKIcon, of course, and your internal implementation would use that, but on OS X it'd be really hard to implement, and IMHO that wouldn't be worth the hassle for those two fringe cases that need something like that.

Come to think of it, I'm not even sure I can do the compositing operation. I can do alpha by simply doing a copy of the icon with the alpha applied and compositing that, but the actual compositing is done by Icon Services on MacOS.

From the Carbon documentation, it seems doable :

Using IconRef Data

CompositeIconRef
Superimposes one IconRef onto another.

GetIconRefVariant
Specifies a transformation for a given IconRef.

IconRefToRgn
Converts an IconRef-derived icon into a QuickDraw region.

PlotIconRef
Draws an icon using appropriate size and depth data from an IconRef.

PlotIconRefInContext
Plots an IconRef using Quartz.

PtInIconRef
Tests whether a specified point falls within an icon’s mask.

RectInIconRef
Tests whether a specified rectangle falls within an icon’s mask.

The problem is a GNUstep application ported to Cocoa, but which links the IconKit, has to be able to use IKIcon in the GNUstep way internally especially when it is relying on IKApplicationIconProvider… Then we need to be able to use the GNUstep related IconKit compositor in a Cocoa application, I don't think it is a problem because the IKCompositor could be compiled with Cocoa.

We could code like that :

-methodXXX
{
        if (_compositor == IKCompositorGNUstep)
        {
                icon = [iconServicesProvider iconForPath: path]
                [gnustepCompositor addIcon: icon toRect: rect];
                return
        }
        else
        {
icon = [iconServicesProvider iconForPath: path: withBadge: badgeWhatever];
                [carbonCompositor addIcon:icon toRect:rect];
// If the carbon compositor cannot be implemented, write the carbon code here… // In the case IconServices can retrieve and badge icons in just one function, you could use it to replace the both messages sent above
        }
        return icon;
}

Quentin.

--
Quentin Mathé
[EMAIL PROTECTED]


Reply via email to