dissolveToPoint:fraction:
不透明度を指定して画像を表示します
-(void)dissolveToPoint:(NSPoint)aPoint: fraction:(float)sFloat:
解説
不透明度を指定して画像を表示します。
返り値
( void )
なし
引数
( NSPoint )aPoint
表示位置
( float )sFloat
0.0透明-1.0不透明
フレームワーク
ApplicationKit
クラス
NSImage
Instance Methods
使用可能
10.0
参照
例文
#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) fraction:0.5]; //合成後のimgをImageViewに表示する [image setImage:img]; //imgを描画から外す [img unlockFocus]; } } @end