00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 @import <Foundation/CPObject.j>
00024
00025
00030 @implementation CPShadow : CPObject
00031 {
00032 CPSize _offset;
00033 float _blurRadius;
00034 CPColor _color;
00035
00036 CPString _cssString;
00037 }
00038
00046 + (id)shadowWithOffset:(CGSize)anOffset blurRadius:(float)aBlurRadius color:(CPColor)aColor
00047 {
00048 return [[CPShadow alloc] _initWithOffset:anOffset blurRadius:aBlurRadius color:aColor];
00049 }
00050
00051
00052 - (id)_initWithOffset:(CPSize)anOffset blurRadius:(float)aBlurRadius color:(CPColor)aColor
00053 {
00054 self = [super init];
00055
00056 if (self)
00057 {
00058 _offset = anOffset;
00059 _blurRadius = aBlurRadius;
00060 _color = aColor;
00061
00062 _cssString = [_color cssString] + " " + Math.round(anOffset.width) + @"px " + Math.round(anOffset.height) + @"px " + Math.round(_blurRadius) + @"px";
00063 }
00064
00065 return self;
00066 }
00067
00071 - (CGSize)shadowOffset
00072 {
00073 return _offset;
00074 }
00075
00079 - (float)shadowBlurRadius
00080 {
00081 return _blurRadius;
00082 }
00083
00087 - (CPColor)shadowColor
00088 {
00089 return _color;
00090 }
00091
00095 - (CPString)cssString
00096 {
00097 return _cssString;
00098 }
00099
00100 @end