mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-06 07:06:11 +00:00
feat: FeBlend (#2489)
# Summary Continuation of #2362 implementing `FeBlend` filter https://www.w3.org/TR/SVG11/filters.html#feBlendElement ## Test Plan Example app → Filters → `FeBlend` ## Compatibility | OS | Implemented | | ------- | :---------: | | iOS | ✅ | | macOS | ✅ _*_ | | Android | ✅ | | Web | ✅ |
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#import <React/RCTConvert.h>
|
||||
#import "RCTConvert+RNSVG.h"
|
||||
#import "RNSVGBlendMode.h"
|
||||
#import "RNSVGCGFCRule.h"
|
||||
#import "RNSVGColorMatrixType.h"
|
||||
#import "RNSVGEdgeMode.h"
|
||||
|
||||
@@ -72,6 +72,19 @@ RCT_ENUM_CONVERTER(
|
||||
SVG_FECOLORMATRIX_TYPE_UNKNOWN,
|
||||
intValue)
|
||||
|
||||
RCT_ENUM_CONVERTER(
|
||||
RNSVGBlendMode,
|
||||
(@{
|
||||
@"unknown" : @(SVG_FEBLEND_MODE_UNKNOWN),
|
||||
@"normal" : @(SVG_FEBLEND_MODE_NORMAL),
|
||||
@"multiply" : @(SVG_FEBLEND_MODE_MULTIPLY),
|
||||
@"screen" : @(SVG_FEBLEND_MODE_SCREEN),
|
||||
@"darken" : @(SVG_FEBLEND_MODE_DARKEN),
|
||||
@"lighten" : @(SVG_FEBLEND_MODE_LIGHTEN),
|
||||
}),
|
||||
SVG_FEBLEND_MODE_UNKNOWN,
|
||||
intValue)
|
||||
|
||||
+ (RNSVGBrush *)RNSVGBrush:(id)json
|
||||
{
|
||||
if ([json isKindOfClass:[NSNumber class]]) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#ifdef RCT_NEW_ARCH_ENABLED
|
||||
#import <react/renderer/components/rnsvg/Props.h>
|
||||
#import "RNSVGBlendMode.h"
|
||||
#import "RNSVGColorMatrixType.h"
|
||||
#import "RNSVGEdgeMode.h"
|
||||
#import "RNSVGUnits.h"
|
||||
@@ -10,6 +11,7 @@ namespace react = facebook::react;
|
||||
|
||||
+ (RNSVGUnits)RNSVGUnitsFromFilterUnitsCppEquivalent:(react::RNSVGFilterFilterUnits)svgUnits;
|
||||
+ (RNSVGUnits)RNSVGUnitsFromPrimitiveUnitsCppEquivalent:(react::RNSVGFilterPrimitiveUnits)svgUnits;
|
||||
+ (RNSVGBlendMode)RNSVGBlendModeFromCppEquivalent:(react::RNSVGFeBlendMode)mode;
|
||||
+ (RNSVGColorMatrixType)RNSVGColorMatrixTypeFromCppEquivalent:(react::RNSVGFeColorMatrixType)type;
|
||||
+ (RNSVGEdgeMode)RNSVGEdgeModeFromCppEquivalent:(react::RNSVGFeGaussianBlurEdgeMode)edgeMode;
|
||||
|
||||
|
||||
@@ -23,6 +23,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ (RNSVGBlendMode)RNSVGBlendModeFromCppEquivalent:(react::RNSVGFeBlendMode)mode
|
||||
{
|
||||
switch (mode) {
|
||||
case react::RNSVGFeBlendMode::Unknown:
|
||||
return SVG_FEBLEND_MODE_UNKNOWN;
|
||||
case react::RNSVGFeBlendMode::Normal:
|
||||
return SVG_FEBLEND_MODE_NORMAL;
|
||||
case react::RNSVGFeBlendMode::Multiply:
|
||||
return SVG_FEBLEND_MODE_MULTIPLY;
|
||||
case react::RNSVGFeBlendMode::Screen:
|
||||
return SVG_FEBLEND_MODE_SCREEN;
|
||||
case react::RNSVGFeBlendMode::Darken:
|
||||
return SVG_FEBLEND_MODE_DARKEN;
|
||||
case react::RNSVGFeBlendMode::Lighten:
|
||||
return SVG_FEBLEND_MODE_LIGHTEN;
|
||||
}
|
||||
}
|
||||
|
||||
+ (RNSVGColorMatrixType)RNSVGColorMatrixTypeFromCppEquivalent:(react::RNSVGFeColorMatrixType)type
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
Reference in New Issue
Block a user