| Home 目次>ApplicationKit>NSImage | |
cacheDepthMatchesImageDepth
アプリケーションのデフォルトの色深度でキャッシュされるかを返します
-(BOOL) cacheDepthMatchesImageDepth
【返り値】 | |
| BOOL | YES/NO |
【解説】
アプリケーションのデフォルトの色深度でキャッシュされるかを返します。
【例文】
#import "SetImage.h"
@implementation SetImage
- ( IBAction )set:( id )sender
{
// 開けるファイル拡張子の配列
NSArray *imgTypes = [ NSArray arrayWithObject : @"tiff" ];
//OpenPanel を作る
NSOpenPanel *opImage = [ NSOpenPanel openPanel ];
//OpenPanel の結果のボタン番号
int opRet;
NSImageRep *imgRep;
NSImage *img=[[NSImage allocWithZone:[ self zone]] initWithSize:NSMakeSize( 100 , 100 )];
//OpenPanel でファイル選択
opRet = [ opImage runModalForDirectory : NSHomeDirectory() // どこのディレクトリを出すか
file : @"Pictures" // どのどのファイルを選択しておくか
types : imgTypes ]; // 選べるファイルタイプ
if ( opRet == NSOKButton ) { // OPENPanel のボタンが OK なら
imgRep = [NSImageRep imageRepWithContentsOfFile:[ opImage filename ]];
[img addRepresentation:imgRep];
[img setCacheDepthMatchesImageDepth: YES ];
if ([img cacheDepthMatchesImageDepth]){
NSLog( @"cacheDepthMatchesImageDepth YES" );
} else {
NSLog( @"cacheDepthMatchesImageDepth NO" );
}
[image setImage:img];
}
}
@end
![]() | |
この記事を評価してください。
| Home 目次>ApplicationKit>NSImage | 修正日2006.12.26 |