forked from nippysaurus/WeatherRock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRadarView.m
83 lines (65 loc) · 1.3 KB
/
RadarView.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//
// RadarView.m
// BrissyBom
//
// Created by Michael Dawson on 15/01/11.
// Copyright 2011 Nippysaurus. All rights reserved.
//
#import "RadarView.h"
@implementation RadarView
@synthesize radarImage;
//-(id)init
//{
// self = [super init];
//
// if (self != nil)
// {
// self.radarImage = nil;
//
// [self setHidden:NO];
// [self setAlphaValue:1.0f];
//
// [self setAutoresizesSubviews:YES];
// }
//
// return self;
//}
//-(void)awakeFromNib
//{
// NSLog(@"%@", self);
// //
//}
-(id)initWithImage:(NSImage*)image
{
self = [super init];
if (self != nil)
{
self.radarImage = image;
NSRect imageBounds = NSMakeRect(0.0f, 0.0f, image.size.width, image.size.height);
[self setFrame:imageBounds];
[self setBounds:imageBounds];
// [self setHidden:NO];
// [self setAlphaValue:1.0f];
//
// [self setAutoresizesSubviews:YES];
}
return self;
}
-(void)drawRect:(NSRect)dirtyRect
{
if (radarImage == nil)
return;
NSRect imageBounds = NSMakeRect(0.0f, 0.0f, radarImage.size.width, radarImage.size.height);
// [self setBounds:imageBounds];
// [self setFrame:imageBounds];
[radarImage drawInRect:[self bounds]
fromRect:imageBounds
operation:NSCompositeSourceAtop
fraction:1.0f];
}
-(void)dealloc
{
[radarImage dealloc];
[super dealloc];
}
@end