| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
// return TRUE if we're using 10.4 behavor.
- (BOOL)linearGradient_10_4_Behavior
{
static BOOL checked = NO;
static BOOL behavior_10_4 = YES;
if ( !checked )
{
CIFilter *gradient_filter = [CIFilter filterWithName:@"CILinearGradient"];
[gradient_filter setValue:[CIVector vectorWithX:0 Y:0] forKey:@"inputPoint0"];
[gradient_filter setValue:[CIVector vectorWithX:32 Y:0] forKey:@"inputPoint1"];
[gradient_filter setValue:[[[CIColor alloc] initWithColor:[NSColor blueColor]] autorelease] forKey:@"inputColor0"];
[gradient_filter setValue:[[[CIColor alloc] initWithColor:[NSColor redColor]] autorelease] forKey:@"inputColor1"];
CIImage *ci_image = [gradient_filter valueForKey:@"outputImage"];
CIFilter *ci_crop = [CIFilter filterWithName:@"CICrop"];
[ci_crop setValue:ci_image forKey:@"inputImage"];
[ci_crop setValue:[CIVector vectorWithX:0 Y:0 Z:32 W:8] forKey:@"inputRectangle"];
CIImage *final_image = [ci_crop valueForKey:@"outputImage"];
NSImage *image = [[[NSImage alloc] initWithSize:NSMakeSize(32,8)] autorelease];
[image addRepresentation:[NSCIImageRep imageRepWithCIImage:final_image]];
NSBitmapImageRep *bitmap = [[[NSBitmapImageRep alloc] initWithData:[image TIFFRepresentation]] autorelease];
NSColor *color = [bitmap colorAtX:0 y:4];
float red, green, blue, alpha;
[color getRed:&red green:&green blue:&blue alpha:&alpha];
// should be blue. if it is not, then it is NOT the 10.4 (buggy) behavior.
if ( blue > red )
behavior_10_4 = NO;
checked = YES;
}
return behavior_10_4;
}
FWIW, we noticed that the documented behavior was broken when 10.5
On Mar 20, 2008, at 4:07 PM, Chris Meyer wrote:
> > I don't know exactly what they assumed or how this was implemented,
> > but I do think that the behavior you're describing sounds like a bug
> > in CoreImage.
>
> At this point, fixing it is only going break any code that I write
> to work around it. Not a great situation. Maybe I'll just write code
> that makes a gradient, samples it, and chooses based on empirical
> evidence. Ugh!
came out and worked around it using
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4) {
// assume gradients are in sensible order
}
else {
// assume gradients are in 10.4 order
}
If Apple fixes this to work as documented, it will probably break
numerous apps.
It's useful for cases like this, where functionality changes based on
> > Most apps don't need to know what SDK they were built against; they
> > need to know what the current OS version is. That's what
> > NSAppKitVersionNumber is meant to provide - what version of AppKit
> are
> > you currently running against. It has _never_ been meant to indicate
> > what version of the SDK you linked against.
>
> OK. No reason to bang my head against a wall even though this
> behavior seems to be of limited usefulness. But it is what it is.
framework version instead of linkage (as it was apparently supposed to).
--
adam
> _______________________________________________
>
>
> On Thu, Mar 20, 2008 at 3:48 PM, Eric Schlegel <email@hidden>
> wrote:
>
> On Mar 20, 2008, at 3:45 PM, Chris Meyer wrote:
> > How would an application ever tell which SDK it was built against?
>
> Most apps don't need to know what SDK they were built against; they
> need to know what the current OS version is. That's what
> NSAppKitVersionNumber is meant to provide - what version of AppKit are
> you currently running against. It has _never_ been meant to indicate
> what version of the SDK you linked against.
>
> > Before you dismiss this message (Eric), I think the case in point is
> > how CILinearGradient works. It is NOT backwards compatible. The Core
> > Image guys probably (correctly) assumed that NSAppKitVersionNumber
> > would return the version of AppKit _linked_ against rather than
> > _available on the system_.
>
> I don't know exactly what they assumed or how this was implemented,
> but I do think that the behavior you're describing sounds like a bug
> in CoreImage.
>
> -eric
>
>
> Do not post admin requests to the list. They will be ignored.
> Quartz-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/quartz-dev/email@hidden
>
> This email sent to email@hidden
Attachment:
snippet.m
Description: Binary data
_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartz-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quartz-dev/email@hidden This email sent to email@hidden
| References: | |
| >CILinearGradient and 10.5 mess (From: "Chris Meyer" <email@hidden>) | |
| >Re: CILinearGradient and 10.5 mess (From: Jack Small <email@hidden>) | |
| >Re: CILinearGradient and 10.5 mess (From: "Chris Meyer" <email@hidden>) | |
| >Re: CILinearGradient and 10.5 mess (From: Eric Schlegel <email@hidden>) | |
| >Re: CILinearGradient and 10.5 mess (From: "Chris Meyer" <email@hidden>) | |
| >Re: CILinearGradient and 10.5 mess (From: Eric Schlegel <email@hidden>) | |
| >Re: CILinearGradient and 10.5 mess (From: "Chris Meyer" <email@hidden>) | |
| >Re: CILinearGradient and 10.5 mess (From: "Adam R. Maxwell" <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.