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
00032 @implementation CPShadow : CPObject
00033 {
00034 CPSize _offset;
00035 float _blurRadius;
00036 CPColor _color;
00037
00038 CPString _cssString;
00039 }
00040
00048 + (id)shadowWithOffset:(CGSize)anOffset blurRadius:(float)aBlurRadius color:(CPColor)aColor
00049 {
00050 return [[CPShadow alloc] _initWithOffset:anOffset blurRadius:aBlurRadius color:aColor];
00051 }
00052
00053
00054 - (id)_initWithOffset:(CPSize)anOffset blurRadius:(float)aBlurRadius color:(CPColor)aColor
00055 {
00056 self = [super init];
00057
00058 if (self)
00059 {
00060 _offset = anOffset;
00061 _blurRadius = aBlurRadius;
00062 _color = aColor;
00063
00064 _cssString = [_color cssString] + " " + Math.round(anOffset.width) + @"px " + Math.round(anOffset.height) + @"px " + Math.round(_blurRadius) + @"px";
00065 }
00066
00067 return self;
00068 }
00069
00073 - (CGSize)shadowOffset
00074 {
00075 return _offset;
00076 }
00077
00081 - (float)shadowBlurRadius
00082 {
00083 return _blurRadius;
00084 }
00085
00089 - (CPColor)shadowColor
00090 {
00091 return _color;
00092 }
00093
00097 - (CPString)cssString
00098 {
00099 return _cssString;
00100 }
00101
00102 @end