I just tested interactively using Ruby-Cocoa and the CIFilter returns
a 0x0 image if transparent, and an infinite extent image if opaque:


Yep, same results without Ruby too (not that the runtime would have anything to do with it). Running on both Leopard and Snow Leopard.

Also interesting that non-transparent colors get non-infinite extents (they're gigantic, but finite).

I guess I don't know if this is a CI or a QC bug -- CI's behavior isn't consistent, but potentially not wrong. It might be QC that isn't handling zero-sized images properly... (it treats 0x0 images as no image, just as it treats zero-length strings as non-strings... a gripe I've had since Tiger, personally...)

#import <Cocoa/Cocoa.h>
#import <Quartz/Quartz.h>

int main()
{
        NSAutoreleasePool *p = [NSAutoreleasePool new];
        
        CIColor *transparent = [CIColor colorWithRed:0 green:0 blue:0 alpha:0];
CIColor *translucent = [CIColor colorWithRed:0 green:0 blue:0 alpha: 0.5];
        CIColor *opaque = [CIColor colorWithRed:0 green:0 blue:0 alpha:1];
        
CIFilter *constantColor = [CIFilter filterWithName:@"CIConstantColorGenerator"];
        NSLog(@"filter: %@", constantColor);

        [constantColor setValue:transparent forKey:@"inputColor"];    
        CIImage *transparentImage = [constantColor valueForKey:@"outputImage"];
        
        [constantColor setValue:translucent forKey:@"inputColor"];
        CIImage *translucentImage = [constantColor valueForKey:@"outputImage"];

        [constantColor setValue:opaque forKey:@"inputColor"];
        CIImage *opaqueImage = [constantColor valueForKey:@"outputImage"];
        
NSLog(@"transparent image: %@ (%fx%f)", transparentImage, [transparentImage extent].size.width, [transparentImage extent].size.height); NSLog(@"translucent image: %@ (%fx%f)", translucentImage, [translucentImage extent].size.width, [translucentImage extent].size.height); NSLog(@"opaque image: %@ (%fx%f)", opaqueImage, [opaqueImage extent].size.width, [opaqueImage extent].size.height);
        
        return 0;
}

compile with     gcc ci.m -o ci -framework Cocoa -framework Quartz

produces the following:

2009-10-27 11:16:02.224 ci[16952:10b] filter: {CIConstantColorGenerator { inputColor = <null>; }} 2009-10-27 11:16:02.227 ci[16952:10b] transparent image: {CIImage: 0x14fa0 extent [inf inf 0 0]; format BGRA_8; null image} (0.000000x0.000000) 2009-10-27 11:16:02.235 ci[16952:10b] translucent image: {CIImage: 0x14f38 format BGRA_8; fill <CGColor 0x116520>} (340282346638528859811704183484516925440.000000x340282346638528859811704183484516925440.000000 ) 2009-10-27 11:16:02.236 ci[16952:10b] opaque image: {CIImage:0x14ed0 opaque DOD; format BGRA_8; fill <CGColor 0x116570> (340282346638528859811704183484516925440.000000x340282346638528859811704183484516925440.000000 )

--
[ christopher wright ]
[email protected]
http://kineme.net/

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to