-
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] Reviewed By: NickGerleman Differential Revision: D59402969 fbshipit-source-id: b7e1aaed01fbf8f80e04ad0fa73d2ef63b5ad933
- Loading branch information
1 parent
a96272e
commit 944d40f
Showing
6 changed files
with
163 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
76 changes: 76 additions & 0 deletions
76
packages/react-native/ReactCommon/react/renderer/graphics/BlendMode.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,76 @@ | ||
/* | ||
* 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 <optional> | ||
#include <string> | ||
#include <string_view> | ||
#include <vector> | ||
|
||
namespace facebook::react { | ||
|
||
enum class BlendMode { | ||
Normal, | ||
Multiply, | ||
Screen, | ||
Overlay, | ||
Darken, | ||
Lighten, | ||
ColorDodge, | ||
ColorBurn, | ||
HardLight, | ||
SoftLight, | ||
Difference, | ||
Exclusion, | ||
Hue, | ||
Saturation, | ||
Color, | ||
Luminosity, | ||
}; | ||
|
||
inline std::optional<BlendMode> blendModeFromString( | ||
std::string_view blendModeName) { | ||
if (blendModeName == "normal") { | ||
return BlendMode::Normal; | ||
} else if (blendModeName == "multiply") { | ||
return BlendMode::Multiply; | ||
} else if (blendModeName == "screen") { | ||
return BlendMode::Screen; | ||
} else if (blendModeName == "overlay") { | ||
return BlendMode::Overlay; | ||
} else if (blendModeName == "darken") { | ||
return BlendMode::Darken; | ||
} else if (blendModeName == "lighten") { | ||
return BlendMode::Lighten; | ||
} else if (blendModeName == "color-dodge") { | ||
return BlendMode::ColorDodge; | ||
} else if (blendModeName == "color-burn") { | ||
return BlendMode::ColorBurn; | ||
} else if (blendModeName == "hard-light") { | ||
return BlendMode::HardLight; | ||
} else if (blendModeName == "soft-light") { | ||
return BlendMode::SoftLight; | ||
} else if (blendModeName == "difference") { | ||
return BlendMode::Difference; | ||
} else if (blendModeName == "exclusion") { | ||
return BlendMode::Exclusion; | ||
} else if (blendModeName == "hue") { | ||
return BlendMode::Hue; | ||
} else if (blendModeName == "saturation") { | ||
return BlendMode::Saturation; | ||
} else if (blendModeName == "color") { | ||
return BlendMode::Color; | ||
} else if (blendModeName == "luminosity") { | ||
return BlendMode::Luminosity; | ||
} else { | ||
return std::nullopt; | ||
} | ||
} | ||
} // 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