mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 15:10:30 +00:00
NDK C-Api backgroundBlurStyle
Signed-off-by: aryawang <wangcaihui@huawei.com> Change-Id: I20488fc6e086a7edd9d83ffcc857ab9c5fe917a4
This commit is contained in:
parent
58f3ebbdf1
commit
4c2dbe8adf
@ -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;
|
||||
@ -8067,11 +8069,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;
|
||||
|
Loading…
Reference in New Issue
Block a user