initWithFocusedViewRect:
フォーカスされているビューからビットマップ画像を初期化して返します
-(id)initWithFocusedViewRect:(NSRect)rect:
解説
フォーカスされているビューからビットマップ画像を初期化して返します。
返り値
( id )
NSBitmapImageRep
引数
( NSRect )rect
範囲
フレームワーク
ApplicationKit
クラス
NSBitmapImageRep
Instance Methods
使用可能
10.0
参照
例文
#import "SetImage.h" @implementation SetImage - (IBAction)set:(id)sender { //Imageを作る NSImage *img = [[NSImage alloc] initWithSize:NSMakeSize(200,200)]; NSBitmapImageRep *bmpRep; [[[sender window] contentView] lockFocus]; bmpRep =[[NSBitmapImageRep alloc] initWithFocusedViewRect:[image frame]]; [[[sender window] contentView] unlockFocus]; [img addRepresentation:bmpRep]; [image setImage:img]; NSLog([NSString stringWithFormat:@"bit / pixel:%d",[bmpRep bitsPerPixel]]); } @end