12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #import "SVGGradientStop.h"
- #import "SVGElement_ForParser.h"
- #import "SVGUtils.h"
- #import "SVGKParser.h"
- #import "SVGLength.h"
- @implementation SVGGradientStop
- @synthesize offset = _offset;
- @synthesize stopColor = _stopColor;
- @synthesize stopOpacity = _stopOpacity;
- -(void)loadDefaults
- {
- _stopOpacity = 1.0f;
- }
- -(void)postProcessAttributesAddingErrorsTo:(SVGKParseResult *)parseResult
- {
- [super postProcessAttributesAddingErrorsTo:parseResult];
-
- if( [self getAttribute:@"offset"].length > 0 )
- _offset = [[SVGLength svgLengthFromNSString:[self getAttribute:@"offset"]] numberValue];
-
-
- NSString *stopColor = [self cascadedValueForStylableProperty:@"stop-color" inherit:NO];
- if( stopColor.length > 0 )
- _stopColor = SVGColorFromString( [stopColor UTF8String] );
-
- NSString *stopOpacity = [self cascadedValueForStylableProperty:@"stop-opacity" inherit:NO];
- if( stopOpacity.length > 0 )
- _stopOpacity = [stopOpacity floatValue];
-
- _stopColor.a = (_stopOpacity * 255);
- }
- @end
|