Graphics Reference
In-Depth Information
The remaining sliders are connected in the same way as specified by the key-paths in
Table 6-1.
The complete application has a minimal number of lines of code, largely due to the
power of data bindings. The complete
AppDelegate
implementation is shown in
Listing 6-11.
LISTING 6-11
Complete AppDelegate Code
@interface
AppDelegate : NSObject {
IBOutlet
NSView *displayView;
CALayer
*imageLayer;
}
@property
(
retain
)
CALayer
*imageLayer;
- (
NSArray
*)filters;
- (
CGImageRef
)nsImageToCGImageRef:(NSImage*)image;
@end
@implementation
AppDelegate
@synthesize
imageLayer;
- (
void
)awakeFromNib;
{
[displayView setWantsLayer:
YES
];
imageLayer = [[
CALayer layer
]
retain
];
CGRect
frame =
CGRectMake
(0.0f,
0.0f,
[displayView
frame
].
size
.
width
,
[displayView
frame
].
size
.
height
);
[imageLayer
setFrame
:frame];
[imageLayer
setCornerRadius
:15.0f];
[imageLayer
setBorderWidth
:3.0f];
[imageLayer
setMasksToBounds
:
YES
];
NSString
*imagePath = [[
NSBundle mainBundle
]
pathForResource
:
@”balloon”
ofType
:
@”jpg”
];