dissolveToPoint:fromRect:fraction:
表示範囲、不透明度を指定して画像を表示します
-(void)dissolveToPoint:(NSPoint)aPoint: fromRect:(NSRect)aRect: fraction:(float)aFloat:
解説
表示範囲、不透明度を指定して画像を表示します。
aPoint 表示する場所
fromRect 画像の表示範囲
fraction 不透明度 0.0透明-1.0不透明
返り値
( void )
なし
引数
( NSPoint )aPoint
表示位置
( NSRect )aRect
表示範囲
( float )aFloat
不透明度
フレームワーク
ApplicationKit
クラス
NSImage
Instance Methods
使用可能
10.0
参照
- dissolveToPoint:fraction:
例文
#import "SetImage.h" @implementation SetImage - (IBAction)set:(id)sender { //開けるファイル拡張子の配列 NSArray *imgTypes = [ NSArray arrayWithObject : @"tiff" ]; //OpenPanelを作る NSOpenPanel *opImage = [ NSOpenPanel openPanel ]; //Imageを作る NSImage *img; NSImage *img2; //OpenPanelの結果のボタン番号 int opRet; //OpenPanelでファイル選択 opRet = [ opImage runModalForDirectory : NSHomeDirectory() //どこのディレクトリを出すか file : @"Pictures" //どのどのファイルを選択しておくか types : imgTypes ];//選べるファイルタイプ if ( opRet == NSOKButton ) { // OPENPanelのボタンがOKなら //NSImageを作ってファイルから読み込む img = [ [ NSImage alloc ] initWithContentsOfFile: [ opImage filename ] ]; //NSImageをバンドルファイルからつくる img2 = [NSImage imageNamed: @"NSApplicationIcon" ]; //imgを描画対象にする [img lockFocus]; //描画対象にimg2を合成する [img2 dissolveToPoint:NSMakePoint(10,100) fromRect:NSMakeRect(0.0,0.0,80.0,80.0) fraction:0.5]; //合成後のimgをImageViewに表示する [image setImage:img]; //imgを描画から外す [img unlockFocus]; } } @end