-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mix-blend-mode effects to iOS (#45304)
Summary: Pull Request resolved: #45304 Add support for most keyword values of mix-blend-mode on iOS and added RNTester Example Missing compositing operators and global values Changelog: [Internal] Differential Revision: D59402969
- Loading branch information
1 parent
820a884
commit d1fc5d2
Showing
6 changed files
with
156 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
packages/react-native/ReactCommon/react/renderer/graphics/MixBlendMode.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <react/renderer/graphics/Float.h> | ||
|
||
#include <string> | ||
#include <string_view> | ||
#include <vector> | ||
|
||
namespace facebook::react { | ||
|
||
enum class MixBlendMode { | ||
Normal, | ||
Multiply, | ||
Screen, | ||
Overlay, | ||
Darken, | ||
Lighten, | ||
ColorDodge, | ||
ColorBurn, | ||
HardLight, | ||
SoftLight, | ||
Difference, | ||
Exclusion, | ||
Hue, | ||
Saturation, | ||
Color, | ||
Luminosity, | ||
}; | ||
|
||
inline MixBlendMode mixBlendModeFromString(std::string_view mixBlendModeName) { | ||
if (mixBlendModeName == "normal") { | ||
return MixBlendMode::Normal; | ||
} else if (mixBlendModeName == "multiply") { | ||
return MixBlendMode::Multiply; | ||
} else if (mixBlendModeName == "screen") { | ||
return MixBlendMode::Screen; | ||
} else if (mixBlendModeName == "overlay") { | ||
return MixBlendMode::Overlay; | ||
} else if (mixBlendModeName == "darken") { | ||
return MixBlendMode::Darken; | ||
} else if (mixBlendModeName == "lighten") { | ||
return MixBlendMode::Lighten; | ||
} else if (mixBlendModeName == "color-dodge") { | ||
return MixBlendMode::ColorDodge; | ||
} else if (mixBlendModeName == "color-burn") { | ||
return MixBlendMode::ColorBurn; | ||
} else if (mixBlendModeName == "hard-light") { | ||
return MixBlendMode::HardLight; | ||
} else if (mixBlendModeName == "soft-light") { | ||
return MixBlendMode::SoftLight; | ||
} else if (mixBlendModeName == "difference") { | ||
return MixBlendMode::Difference; | ||
} else if (mixBlendModeName == "exclusion") { | ||
return MixBlendMode::Exclusion; | ||
} else if (mixBlendModeName == "hue") { | ||
return MixBlendMode::Hue; | ||
} else if (mixBlendModeName == "saturation") { | ||
return MixBlendMode::Saturation; | ||
} else if (mixBlendModeName == "color") { | ||
return MixBlendMode::Color; | ||
} else if (mixBlendModeName == "luminosity") { | ||
return MixBlendMode::Luminosity; | ||
} else { | ||
throw std::invalid_argument(std::string(mixBlendModeName)); | ||
} | ||
} | ||
} // namespace facebook::react |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters