52 lines
1.2 KiB
Objective-C
52 lines
1.2 KiB
Objective-C
/**
|
|
* Copyright (c) 2015-present, Horcrux.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the MIT-style license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
|
|
#import "RNSVGTextPath.h"
|
|
#import "RNSVGBezierTransformer.h"
|
|
|
|
@implementation RNSVGTextPath
|
|
|
|
- (void)renderLayerTo:(CGContextRef)context
|
|
{
|
|
[self renderGroupTo:context];
|
|
}
|
|
|
|
- (RNSVGBezierTransformer *)getBezierTransformer
|
|
{
|
|
RNSVGSvgView *svg = [self getSvgView];
|
|
RNSVGNode *template = [svg getDefinedTemplate:self.href];
|
|
|
|
if ([template class] != [RNSVGPath class]) {
|
|
// warning about this.
|
|
return nil;
|
|
}
|
|
|
|
RNSVGPath *path = (RNSVGPath *)template;
|
|
CGFloat startOffset = [self relativeOnWidth:self.startOffset];
|
|
return [[RNSVGBezierTransformer alloc] initWithBezierCurvesAndStartOffset:[path getBezierCurves]
|
|
startOffset:startOffset];
|
|
}
|
|
|
|
- (CGPathRef)getPath:(CGContextRef)context
|
|
{
|
|
return [self getGroupPath:context];
|
|
}
|
|
|
|
- (void)pushGlyphContext
|
|
{
|
|
// TextPath do not affect the glyphContext
|
|
}
|
|
|
|
- (void)popGlyphContext
|
|
{
|
|
// TextPath do not affect the glyphContext
|
|
}
|
|
|
|
@end
|