| Home 目次>ApplicationKit>NSImage | |
isFlipped
y軸の極性が逆か返します
-(BOOL) isFlipped
【返り値】 | |
| BOOL | 逆かYES/NO |
【解説】
y軸の極性が逆か返します。
逆ならYESを返します、そうでなければNOを返します。
初期設定はNOです。
【例文】
#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 setFlipped:YES];
[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];
if ([img2 isFlipped]){
[info setStringValue:@"flip"];
}
else{
[info setStringValue:@"NO"];
}
}
}
@end
![]() | |
この記事を評価してください。
| Home 目次>ApplicationKit>NSImage | 修正日2006.12.26 |