Stuck again. :( I have the following code crammed into a procedure invoked when I click on a button on my application main window. I m just trying to tweak a CIIMage and then display the results. At this point I m not even worried about exactly where / how to display it. I m just trying to slam it up on the window to make sure my Transform worked. This code seems to work down through the drawAtPoint message. But I never see anything on the screen. What s wrong? Thanks.
而且,只要在窗户特定地点展示,......这是在窗户上设置某种框架的最佳技术,那么就将这个框架的坐标带上,并“重新划入”这个 rec子? 或者使用国际独立企业的具体控制? 还是什么? 再次感谢。
// earlier I initialize a NSImage from JPG file on disk.
// then create NSBitmapImageRep from the NSImage. This all works fine.
// then ...
CIImage * inputCIimage = [[CIImage alloc] initWithBitmapImageRep:inputBitmap];
if (inputCIimage == Nil)
NSLog(@"could not create CI Image");
else {
NSLog (@"CI Image created. working on transform");
CIFilter *transform = [CIFilter filterWithName:@"CIAffineTransform"];
[transform setDefaults];
[transform setValue:inputCIimage forKey:@"inputImage"];
NSAffineTransform *affineTransform = [NSAffineTransform transform];
[affineTransform rotateByDegrees:3];
[transform setValue:affineTransform forKey:@"inputTransform"];
CIImage * myResult = [transform valueForKey:@"outputImage"];
if (myResult == Nil)
NSLog(@"Transformation failed");
else {
NSLog(@"Created transformation successfully ... now render it");
[myResult drawAtPoint: NSMakePoint ( 0,0 )
fromRect: NSMakeRect ( 0,0,128,128 )
operation: NSCompositeSourceOver
fraction: 1.0]; //100% opaque
[inputCIimage release];
}
}
Edit #:
snip - 删除了下文提及的先前编码样本(在关于提纲的评论中),该样本不可行。
Edit #2: 添加一些法典,说明DOES为今后可能 st在同样事情上的任何人工作。 这不肯定是最佳环境方法......但是为了我的迅速和 d脏的目的。 因此,这部新的法典(下文)取代了我最初的提问中从上述全部[MResult der AtPoint......]信息。 该法典采用CIImage变造的形象,并在NSImageView控制中展示。
NSImage *outputImage;
NSCIImageRep *ir;
ir = [NSCIImageRep imageRepWithCIImage:myResult];
outputImage = [[[NSImage alloc] initWithSize: NSMakeSize(inputImage.size.width, inputImage.size.height)] autorelease];
[outputImage addRepresentation:ir];
[outputImageView setImage: outputImage]; //outputImageView is an NSImageView control on my application s main window