fix fillOpacity with gradients

This commit is contained in:
Horcrux
2016-07-21 19:11:36 +08:00
parent 16a1f89bf6
commit 63f793c54e
7 changed files with 39 additions and 23 deletions
+1 -1
View File
@@ -59,7 +59,7 @@
CGContextAddPath(context, self.d);
CGContextClip(context);
RNSVGBrushConverter *brushConverter = [[self getSvgView] getDefinedBrushConverter:[self.fill brushRef]];
[self.fill paint:context opacity:self.strokeOpacity brushConverter:brushConverter];
[self.fill paint:context opacity:self.fillOpacity brushConverter:brushConverter];
CGContextRestoreGState(context);
if (!self.stroke) {
return;
+2 -11
View File
@@ -23,21 +23,12 @@
{
RNSVGNode* template = [[self getSvgView] getDefinedTemplate:self.href];
if (template) {
CGFloat opacity = self.opacity;
BOOL transparent = opacity < 1;
if (transparent) {
CGContextBeginTransparencyLayer(context, NULL);
}
[self beginTransparencyLayer:context];
[self clip:context];
[template mergeProperties:self mergeList:self.mergeList];
[template renderTo:context];
[template resetProperties];
if (transparent) {
CGContextEndTransparencyLayer(context);
}
[self endTransparencyLayer:context];
} else if (self.href) {
// TODO: calling yellow box here
RCTLogWarn(@"`Use` element expected a pre-defined svg template as `href` prop, template named: %@ is not defined.", self.href);