!34153 NDK C-Api backgroundBlurStyle greyScalestart end不生效

Merge pull request !34153 from aryawang/528master
This commit is contained in:
openharmony_ci 2024-05-29 01:17:23 +00:00 committed by Gitee
commit af65d9dd7d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -109,6 +109,8 @@ constexpr int32_t BLUR_STYLE_INDEX = 0;
constexpr int32_t COLOR_MODE_INDEX = 1;
constexpr int32_t ADAPTIVE_COLOR_INDEX = 2;
constexpr int32_t SCALE_INDEX = 3;
constexpr int32_t GRAY_SCALE_START = 4;
constexpr int32_t GRAY_SCALE_END = 5;
constexpr int32_t DECORATION_COLOR_INDEX = 1;
constexpr int32_t DECORATION_STYLE_INDEX = 2;
constexpr int32_t PROGRESS_TYPE_LINEAR = 1;
@ -8087,11 +8089,31 @@ int32_t SetBackgroundBlurStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem*
if (SCALE_INDEX < actualSize) {
scale = item->value[SCALE_INDEX].f32;
}
uint32_t grayScaleStart = 0;
if (GRAY_SCALE_START < actualSize) {
if (GreatOrEqual(item->value[GRAY_SCALE_START].f32, 0.0f)) {
grayScaleStart = static_cast<uint32_t>(item->value[GRAY_SCALE_START].f32);
} else {
return ERROR_CODE_PARAM_INVALID;
}
}
uint32_t grayScaleEnd = 0;
if (GRAY_SCALE_END < actualSize) {
if (GreatOrEqual(item->value[GRAY_SCALE_END].f32, 0.0f)
&& GreatOrEqual(item->value[GRAY_SCALE_END].f32, item->value[GRAY_SCALE_START].f32)) {
grayScaleEnd = static_cast<uint32_t>(item->value[GRAY_SCALE_END].f32);
} else {
return ERROR_CODE_PARAM_INVALID;
}
}
BlurOption blurOption;
int32_t intArray[NUM_3];
intArray[NUM_0] = blurStyle;
intArray[NUM_1] = colorMode;
intArray[NUM_2] = adaptiveColor;
std::vector<float> greyVector(NUM_2);
greyVector[NUM_0] = grayScaleStart;
greyVector[NUM_1] = grayScaleEnd;
fullImpl->getNodeModifiers()->getCommonModifier()->setBackgroundBlurStyle(
node->uiNodeHandle, intArray, scale, blurOption.grayscale.data(), blurOption.grayscale.size());
return ERROR_CODE_NO_ERROR;