On Dec 15, 2009, at 23:07, Maxwell, Adam R wrote:

> On 12/15/09 13:51, "Christiaan Hofman" <cmhof...@gmail.com> wrote:
> 
>> 
>> On Dec 15, 2009, at 22:31, Maxwell, Adam R wrote:
>> 
>>> On 12/15/09 13:04, "Christiaan Hofman" <cmhof...@gmail.com> wrote:
>>> 
>>>> 
>>>> On Dec 15, 2009, at 20:09, Maxwell, Adam R wrote:
>>>> 
>>>>> I notice this is removed, but recall that the centering/scaling is only
>>>>> part
>>>>> of that cell; using -[NSImage bestImageRepForSize:device:] is possibly the
>>>>> more important part, since NSImage often picks a poor representation at
>>>>> many
>>>>> sizes.  This is really noticeable with system images that have multiple
>>>>> reps.  It may be fixed on 10.6 if NSImage/NSImageCell uses
>>>>> -bestRepresentationForRect:context:hints:, but NSImage caching might still
>>>>> get in the way, unless they've fixed it.
>>>>> 
>>>>> -- 
>>>>> Adam
>>>> 
>>>> The release notes indicate a lot of changes to image caching.
>>> 
>>> Yeah, things improved a lot in 10.6.  NSImage is probably fixed as much as
>>> it can be, short of dumping it entirely.
>>> 
>>>> And AFAICS 
>>>> NSImageCell draws the correct rep, with the minimum size just larger or
>>>> equal
>>>> to the target rect. Would you have a test case where things were drawn
>>>> poorly?
>>> 
>>> Draw a URL icon in a tableview.  IIRC if the image has a rep of size 16 and
>>> the cell wants an image of that size, it will use it; otherwise, it uses the
>>> largest rep and scales it down.  You used to see this in the main table by
>>> playing with the icon column widths.  At one size it would draw just an "@"
>>> in sharp detail, but at a slightly different size it would draw the "@" with
>>> a fuzzy "HTTP" below it.
>> 
>> I don't see that, at least on 10.6.2. I'm pretty sure it's using the next
>> largest rep.
> 
> That's good, then; I'm not exactly sure what the behavior was, but I saw the
> symptoms often enough.  I tried to find a mailing list post that talked
> about the same thing, but I'm losing my touch with google.
> 
>>> It's also very worthwhile to badge individual reps of system icons, say if
>>> you want to apply a CIFilter and change the color (and maybe you do this...I
>>> haven't looked recently).  I found that you can end up with some nasty edge
>>> artifacts otherwise.
>> 
>> I'm not completely sure what you mean, but at least for group icons based on
>> system icons I create both a 16 and 32 rep (I don't think it's worthwhile to
>> have a 128 rep).
> 
> Basically that; I think I stole your idea of tinting the system images :).
> I just do it for(rep in [image representations]).  

That does not always work, because some system images (e.g. smart folder is 
one) have only one (NSCoreUIImageRep) rep that draws differently at different 
sizes, rather than different reps for the different sizes.

> The problem I was
> thinking of was actually in adding NSCIImageReps to an image; they were
> drawing with green edges.  Using
> 
> rep = [[NSBitmapImageRep alloc] initWithCIImage:[hueFilter
> valueForKey:kCIOutputImageKey]];
> 
> fixed that.
> 

I'm drawing the CIImage in a new image to create the rep (I don't think you can 
draw in a rep), and I haven't seen that problem. I'm not using bitmaps.

>> 
>>> 
>>> Note that I don't recall trying any of this on 10.6, but I can only use that
>>> at home anyway.
>> 
>> 10.6 does seem to have fixed these issues. For me it's a real hassle to check
>> 10.5 now ;)
> 
> 10.6 isn't allowed at work (yet), so I'm still on 10.5.8.  It'll be a real
> hassle for me to move to 10.6 here, since the compiler now defaults to
> x86_64.  A bunch of autoconf based stuff failed horribly last I tried.
> 
>> BTW, I got a problem with bestImageRepForSize:device:. The returned rep can 
>> be
>> nil, for instance when the target size is larger than the largest rep (or 
>> when
>> the colorspace name is different). You've got an idea?
> 
> Sorry, I could swear I checked in a fix for that!  The last line should be
> 
>    // if no rep of appropriate size, use NSImage's idea of the best one for
> the device
>    return toReturn ? toReturn : [self
> bestRepresentationForDevice:deviceDescription];

I just fixed the main problem by returning the largest rep when that's smaller 
than the required size. Actually, bestRepresentationForDevice: is now 
deprecated.

Christiaan


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Bibdesk-develop mailing list
Bibdesk-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-develop

Reply via email to