• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CIFilter - can not change value
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CIFilter - can not change value


  • Subject: Re: CIFilter - can not change value
  • From: Richard Salvatierra <email@hidden>
  • Date: Fri, 28 Oct 2005 15:57:26 -0400

FYI - my problem was with the context. In this case I used NSGraphicsContext with the process from:
http://developer.apple.com/samplecode/Reducer/listing16.html


- (NSImage*) updateImageWithHueFilter: (NSImage*)theImage
{
    float hueValue = 2.45;
    CIFilter            *myHueFilter;
    CIImage                *effectedImage;
    NSBitmapImageRep    *bitmapRep;

    bitmapRep = BitmapImageRepFromNSImage(theImage);

// Create an NSGraphicsContext that draws into the NSBitmapImageRep, and make it current.
NSGraphicsContext *nsContext = [NSGraphicsContext graphicsContextWithBitmapImageRep: bitmapRep];


effectedImage = [[CIImage alloc] initWithBitmapImageRep: bitmapRep];

myHueFilter = [CIFilter filterWithName:@"CIHueAdjust"];
[myHueFilter setDefaults];
[myHueFilter setValue: effectedImage forKey: @"inputImage"];
[myHueFilter setValue: [NSNumber numberWithFloat: hueValue] forKey: @"inputAngle"];
effectedImage = [myHueFilter valueForKey:@"outputImage"];


// Get a CIContext from the NSGraphicsContext, and use it to draw the CIImage into the NSBitmapImageRep.
[[nsContext CIContext] drawImage:effectedImage atPoint:CGPointZero fromRect:[effectedImage extent]];


    // Restore the previous graphics context and state.
    [NSGraphicsContext restoreGraphicsState];

NSImage *theImageOutput = [[NSImage alloc] initWithSize: NSMakeSize(extent.size.width, extent.size.height)];
NSCIImageRep *ciImageRep = [NSCIImageRep imageRepWithCIImage: effectedImage];
[theImageOutput addRepresentation:ciImageRep];


    [NSGraphicsContext restoreGraphicsState];
    return [theImageOutput autorelease];
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >re: CIFilter - can not change value (From: Steve Israelson <email@hidden>)
 >Re: CIFilter - can not change value (From: Richard Salvatierra <email@hidden>)

  • Prev by Date: NSDatePicker / bindings / validation
  • Next by Date: Re: Document Architecture question - newbie
  • Previous by thread: Re: CIFilter - can not change value
  • Next by thread: Complex Source List & Selection
  • Index(es):
    • Date
    • Thread