2025-12-25 19:37:41 +03:00
|
|
|
#include "SerializedBlendMode.hpp"
|
2026-01-08 12:59:24 +03:00
|
|
|
#include <unordered_set>
|
2025-12-25 19:37:41 +03:00
|
|
|
|
|
|
|
|
SkBlendMode serialized_blend_mode_to_sk_blend_mode(SerializedBlendMode serializedBlendMode) {
|
|
|
|
|
int skBlendModeStartVal = static_cast<int>(SkBlendMode::kClear);
|
|
|
|
|
return static_cast<SkBlendMode>(skBlendModeStartVal + static_cast<uint8_t>(serializedBlendMode));
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-08 12:59:24 +03:00
|
|
|
const std::vector<SerializedBlendMode>& get_blend_mode_useful_list() {
|
|
|
|
|
static std::vector<SerializedBlendMode> blendModeList;
|
2025-12-25 19:37:41 +03:00
|
|
|
if(blendModeList.empty()) {
|
2026-01-08 19:44:42 +03:00
|
|
|
std::unordered_set<SerializedBlendMode> exclusionList = {SerializedBlendMode::BLEND_CLEAR, SerializedBlendMode::BLEND_SRC, SerializedBlendMode::BLEND_DST};
|
|
|
|
|
for(uint8_t i = 0; i < static_cast<uint8_t>(SerializedBlendMode::BLEND_LAST_MODE); i++) {
|
2026-01-08 12:59:24 +03:00
|
|
|
if(!exclusionList.contains(static_cast<SerializedBlendMode>(i)))
|
|
|
|
|
blendModeList.emplace_back(static_cast<SerializedBlendMode>(i));
|
|
|
|
|
}
|
2025-12-25 19:37:41 +03:00
|
|
|
}
|
|
|
|
|
return blendModeList;
|
|
|
|
|
}
|
2026-01-08 12:59:24 +03:00
|
|
|
|
|
|
|
|
const std::vector<std::string>& get_blend_mode_useful_name_list() {
|
|
|
|
|
static std::vector<std::string> blendModeNameList;
|
|
|
|
|
if(blendModeNameList.empty()) {
|
|
|
|
|
for(SerializedBlendMode i : get_blend_mode_useful_list())
|
|
|
|
|
blendModeNameList.emplace_back(nlohmann::json(static_cast<SerializedBlendMode>(i)));
|
|
|
|
|
}
|
|
|
|
|
return blendModeNameList;
|
|
|
|
|
}
|