API
0.9.9
CPShadow.j
Go to the documentation of this file.
1
/*
2
* CPShadow.j
3
* AppKit
4
*
5
* Created by Francisco Tolmasky.
6
* Copyright 2008, 280 North, Inc.
7
*
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License as published by the Free Software Foundation; either
11
* version 2.1 of the License, or (at your option) any later version.
12
*
13
* This library is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
17
*
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with this library; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
*/
22
23
24
30
@implementation
CPShadow
:
CPObject
31
{
32
CGSize _offset;
33
float
_blurRadius;
34
CPColor
_color;
35
}
36
44
+ (id)shadowWithOffset:(CGSize)anOffset blurRadius:(
float
)aBlurRadius color:(
CPColor
)aColor
45
{
46
return
[[
CPShadow
alloc
] _initWithOffset:anOffset blurRadius:aBlurRadius color:aColor];
47
}
48
49
/* @ignore */
50
- (id)_initWithOffset:(CGSize)anOffset blurRadius:(float)aBlurRadius color:(
CPColor
)aColor
51
{
52
self
= [
super
init
];
53
54
if
(
self
)
55
{
56
_offset = anOffset;
57
_blurRadius = aBlurRadius;
58
_color = aColor;
59
}
60
61
return
self
;
62
}
63
64
- (void)
set
65
{
66
var context = [[
CPGraphicsContext
currentContext
]
graphicsPort
];
67
68
CGContextSetShadowWithColor
(context, _offset, _blurRadius, _color);
69
}
70
74
- (
CPString
)
cssString
75
{
76
return
[_color cssString] +
" "
+ ROUND(_offset.width) +
@"px "
+ ROUND(_offset.height) +
@"px "
+ ROUND(_blurRadius) +
@"px"
;
77
}
78
79
@end
80
81
@implementation
CPShadow (CPSynthesizedAccessors)
82
86
- (CGSize)
shadowOffset
87
{
88
return
_offset;
89
}
90
94
- (void)setShadowOffset:(CGSize)aValue
95
{
96
_offset = aValue;
97
}
98
102
- (float)
shadowBlurRadius
103
{
104
return
_blurRadius;
105
}
106
110
- (void)setShadowBlurRadius:(
float
)aValue
111
{
112
_blurRadius = aValue;
113
}
114
118
- (
CPColor
)
shadowColor
119
{
120
return
_color;
121
}
122
126
- (void)setShadowColor:(
CPColor
)aValue
127
{
128
_color = aValue;
129
}
130
131
@end
CPShadow(CPSynthesizedAccessors)
Definition:
CPShadow.j:81
CGContextSetShadowWithColor
function CGContextSetShadowWithColor(aContext, aSize, aBlur, aColor)
Definition:
CGContext.j:504
CPObject
Definition:
CPObject.j:103
-[CPShadow(CPSynthesizedAccessors) shadowOffset]
CGSize shadowOffset()
Definition:
CPShadow.j:86
+[CPGraphicsContext currentContext]
CPGraphicsContext currentContext()
Definition:
CPGraphicsContext.j:41
-[CPGraphicsContext graphicsPort]
CGContext graphicsPort()
Definition:
CPGraphicsContext.j:106
-[CPShadow cssString]
CPString cssString()
Definition:
CPShadow.j:74
-[CPShadow set]
void set()
Definition:
CPShadow.j:64
-[CPShadow(CPSynthesizedAccessors) shadowColor]
CPColor shadowColor()
Definition:
CPShadow.j:118
CPString
An immutable string (collection of characters).
Definition:
CPString.h:2
CPColor
Definition:
CPColor.j:77
-[CPObject init]
id init()
Definition:
CPObject.j:145
-[CPShadow(CPSynthesizedAccessors) shadowBlurRadius]
float shadowBlurRadius()
Definition:
CPShadow.j:102
CPGraphicsContext
Definition:
CPGraphicsContext.h:2
+[CPObject alloc]
id alloc()
Definition:
CPObject.j:130
CPShadow
Definition:
CPShadow.h:2
AppKit
CPShadow.j
Generated on Fri Apr 1 2016 23:03:25 for API by
1.8.11