Skip to content

Commit

Permalink
modified
Browse files Browse the repository at this point in the history
  • Loading branch information
authored and committed Mar 19, 2010
1 parent 55b132a commit ccbfd4a
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 511 deletions.
1 change: 0 additions & 1 deletion ImageFlippedSample/AppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ @implementation AppController

-(void)awakeFromNib
{
NSLog(@"test");
}

@end
34 changes: 14 additions & 20 deletions ImageFlippedSample/CustomView.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,22 @@ - (id)initWithFrame:(NSRect)frame {

- (void)drawRect:(NSRect)rect {

NSLog(@"self=%@", self);
NSLog(@"value=%@", [self valueForKey:@"self"]);
NSImage* image = [NSImage imageNamed:@"sample"];

if ([image respondsToSelector:@selector(lockFocusFlipped:)]) {

void (*lockFocusFlipped)(id, SEL, BOOL);
lockFocusFlipped = (void(*)(id, SEL, BOOL))[image methodForSelector:@selector(lockFocusFlipped:)];
lockFocusFlipped(image, @selector(methodForSelector:), YES);
[image drawInRect:[self bounds]
fromRect:NSZeroRect
operation:NSCompositeSourceOver
fraction:1.0];
[image unlockFocus];

} else {
// v10.5 earlier
[image setFlipped:YES];
[image drawInRect:[self bounds]
fromRect:NSZeroRect
operation:NSCompositeSourceOver
fraction:1.0];
}

[image setFlipped:YES];
[image drawInRect:[self bounds]
fromRect:NSZeroRect
operation:NSCompositeSourceOver
fraction:1.0];

[image drawInRect:[self bounds]
fromRect:NSZeroRect
operation:NSCompositeSourceOver
fraction:1.0
respectFlipped:YES
hints:nil];
}

- (BOOL)isFlipped
Expand Down
Loading

0 comments on commit ccbfd4a

Please sign in to comment.