ページ

2008年10月10日金曜日

波紋(その13)

このエントリーをブックマークに追加 このエントリーを含むはてなブックマーク

NSViewに描画した内容を CIImage へ変換し、トランジションをかける。

 NSData* data = [_view2 dataWithPDFInsideRect:[_view2 bounds]];
NSImage *image1a = [[[NSImage alloc] initWithData:data] autorelease];

data = [image1a TIFFRepresentation];
NSBitmapImageRep* bitmap = [NSBitmapImageRep imageRepWithData:data];
CIImage* image1b = [[CIImage alloc] initWithBitmapImageRep:bitmap];
CIImage* image2b = [[CIImage alloc] initWithBitmapImageRep:bitmap];
[_filter setValue:image1b forKey:kCIInputImageKey];
[_filter setValue:image2b forKey:kCIInputTargetImageKey];


_view2 がトランジションをかけたいビュー。これを dataWithPDFInsideRect: で一旦 NSData へ変換した後、NSImage、NSBitmapImageRepを経由して最後に CIImage を作成する。CIImage#initWithData はうまくいかなかった。

作ってみたのがこれ。



下の NSViewに描画し、これを CIImageへ変換し、上のエリアでトランジションをかけている。