mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-28 01:31:56 +00:00
!29239 Modifier中为blur属性和backdrop属性添加BlurOptions可选参数,invert属性添加支持InvertOptions类型参数
Merge pull request !29239 from yangziyong/AppendAttres
This commit is contained in:
commit
c17a459e34
@ -374,6 +374,28 @@ class ArkScrollEdgeEffect {
|
||||
}
|
||||
}
|
||||
|
||||
class ArkBlurOptions{
|
||||
value: number;
|
||||
options?: BlurOptions | undefined;
|
||||
constructor() {
|
||||
this.value = undefined;
|
||||
this.options = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
class InvertOptions{
|
||||
high: number;
|
||||
low: number;
|
||||
threshold: number;
|
||||
thresholdRange: number;
|
||||
constructor() {
|
||||
this.high = undefined;
|
||||
this.low = undefined;
|
||||
this.threshold = undefined;
|
||||
this.thresholdRange = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
class ArkMenuAlignType {
|
||||
alignType: number | MenuAlignType;
|
||||
dx: Length;
|
||||
|
@ -505,8 +505,8 @@ class AlignModifier extends ModifierWithKey<number> {
|
||||
}
|
||||
}
|
||||
|
||||
class BackdropBlurModifier extends ModifierWithKey<number> {
|
||||
constructor(value: number) {
|
||||
class BackdropBlurModifier extends ModifierWithKey<ArkBlurOptions> {
|
||||
constructor(value: ArkBlurOptions) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('backdropBlur');
|
||||
@ -514,9 +514,13 @@ class BackdropBlurModifier extends ModifierWithKey<number> {
|
||||
if (reset) {
|
||||
getUINativeModule().common.resetBackdropBlur(node);
|
||||
} else {
|
||||
getUINativeModule().common.setBackdropBlur(node, this.value);
|
||||
getUINativeModule().common.setBackdropBlur(node, this.value.value, this.value.options?.grayscale);
|
||||
}
|
||||
}
|
||||
checkObjectDiff(): boolean {
|
||||
return !((this.stageValue.value === this.value.value) &&
|
||||
(this.stageValue.options === this.value.options));
|
||||
}
|
||||
}
|
||||
|
||||
class HueRotateModifier extends ModifierWithKey<number | string> {
|
||||
@ -533,8 +537,8 @@ class HueRotateModifier extends ModifierWithKey<number | string> {
|
||||
}
|
||||
}
|
||||
|
||||
class InvertModifier extends ModifierWithKey<number> {
|
||||
constructor(value: number) {
|
||||
class InvertModifier extends ModifierWithKey<number | InvertOptions> {
|
||||
constructor(value: number | InvertOptions) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('invert');
|
||||
@ -542,10 +546,24 @@ class InvertModifier extends ModifierWithKey<number> {
|
||||
if (reset) {
|
||||
getUINativeModule().common.resetInvert(node);
|
||||
} else {
|
||||
getUINativeModule().common.setInvert(node, this.value);
|
||||
if(isNumber(this.value)) {
|
||||
getUINativeModule().common.setInvert(node, this.value, undefined, undefined, undefined, undefined);
|
||||
} else {
|
||||
getUINativeModule().common.setInvert(node, undefined,
|
||||
(this.value as InvertOptions).low,
|
||||
(this.value as InvertOptions).high,
|
||||
(this.value as InvertOptions).threshold,
|
||||
(this.value as InvertOptions).thresholdRange);
|
||||
}
|
||||
}
|
||||
}
|
||||
checkObjectDiff(): boolean {
|
||||
return !((this.stageValue as InvertOptions).high == (this.value as InvertOptions).high &&
|
||||
(this.stageValue as InvertOptions).low == (this.value as InvertOptions).low &&
|
||||
(this.stageValue as InvertOptions).threshold == (this.value as InvertOptions).threshold &&
|
||||
(this.stageValue as InvertOptions).thresholdRange == (this.value as InvertOptions).thresholdRange);
|
||||
}
|
||||
}
|
||||
|
||||
class SepiaModifier extends ModifierWithKey<number> {
|
||||
constructor(value: number) {
|
||||
@ -635,8 +653,8 @@ class BrightnessModifier extends ModifierWithKey<number> {
|
||||
}
|
||||
}
|
||||
|
||||
class BlurModifier extends ModifierWithKey<number> {
|
||||
constructor(value: number) {
|
||||
class BlurModifier extends ModifierWithKey<ArkBlurOptions> {
|
||||
constructor(value: ArkBlurOptions) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('blur');
|
||||
@ -644,9 +662,13 @@ class BlurModifier extends ModifierWithKey<number> {
|
||||
if (reset) {
|
||||
getUINativeModule().common.resetBlur(node);
|
||||
} else {
|
||||
getUINativeModule().common.setBlur(node, this.value);
|
||||
getUINativeModule().common.setBlur(node, this.value.value, this.value.options?.grayscale);
|
||||
}
|
||||
}
|
||||
checkObjectDiff(): boolean {
|
||||
return !((this.stageValue.value === this.value.value) &&
|
||||
(this.stageValue.options === this.value.options));
|
||||
}
|
||||
}
|
||||
|
||||
class LinearGradientModifier extends ModifierWithKey<{
|
||||
@ -2884,12 +2906,11 @@ class ArkComponent implements CommonMethod<CommonAttribute> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
blur(value: number): this {
|
||||
if (!isNumber(value)) {
|
||||
modifierWithKey(this._modifiersWithKeys, BlurModifier.identity, BlurModifier, undefined);
|
||||
} else {
|
||||
modifierWithKey(this._modifiersWithKeys, BlurModifier.identity, BlurModifier, value);
|
||||
}
|
||||
blur(value: number, options?: BlurOptions): this {
|
||||
let blur: ArkBlurOptions = new ArkBlurOptions();
|
||||
blur.value = value;
|
||||
blur.options = options;
|
||||
modifierWithKey(this._modifiersWithKeys, BlurModifier.identity, BlurModifier, blur);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -2958,11 +2979,11 @@ class ArkComponent implements CommonMethod<CommonAttribute> {
|
||||
return this;
|
||||
}
|
||||
|
||||
invert(value: number): this {
|
||||
if (!isNumber(value)) {
|
||||
modifierWithKey(this._modifiersWithKeys, InvertModifier.identity, InvertModifier, undefined);
|
||||
} else {
|
||||
invert(value: number | InvertOptions): this {
|
||||
if (!isUndefined(value)) {
|
||||
modifierWithKey(this._modifiersWithKeys, InvertModifier.identity, InvertModifier, value);
|
||||
} else {
|
||||
modifierWithKey(this._modifiersWithKeys, InvertModifier.identity, InvertModifier, undefined);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@ -2981,12 +3002,11 @@ class ArkComponent implements CommonMethod<CommonAttribute> {
|
||||
return this;
|
||||
}
|
||||
|
||||
backdropBlur(value: number): this {
|
||||
if (!isNumber(value)) {
|
||||
modifierWithKey(this._modifiersWithKeys, BackdropBlurModifier.identity, BackdropBlurModifier, undefined);
|
||||
} else {
|
||||
modifierWithKey(this._modifiersWithKeys, BackdropBlurModifier.identity, BackdropBlurModifier, value);
|
||||
}
|
||||
backdropBlur(value: number, options?: BlurOptions): this {
|
||||
let blur: ArkBlurOptions = new ArkBlurOptions();
|
||||
blur.value = value;
|
||||
blur.options = options;
|
||||
modifierWithKey(this._modifiersWithKeys, BackdropBlurModifier.identity, BackdropBlurModifier, blur);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -476,9 +476,14 @@ class BackdropBlurModifier extends ModifierWithKey {
|
||||
getUINativeModule().common.resetBackdropBlur(node);
|
||||
}
|
||||
else {
|
||||
getUINativeModule().common.setBackdropBlur(node, this.value);
|
||||
getUINativeModule().common.setBackdropBlur(
|
||||
node, this.value.value, (_a = this.value.options) === null || _a === void 0 ? void 0 : _a.grayscale);
|
||||
}
|
||||
}
|
||||
checkObjectDiff() {
|
||||
return !((this.stageValue.value === this.value.value) &&
|
||||
(this.stageValue.options === this.value.options));
|
||||
}
|
||||
}
|
||||
BackdropBlurModifier.identity = Symbol('backdropBlur');
|
||||
class HueRotateModifier extends ModifierWithKey {
|
||||
@ -504,8 +509,20 @@ class InvertModifier extends ModifierWithKey {
|
||||
getUINativeModule().common.resetInvert(node);
|
||||
}
|
||||
else {
|
||||
getUINativeModule().common.setInvert(node, this.value);
|
||||
if (isNumber(this.value)) {
|
||||
getUINativeModule().common.setInvert(node, this.value, undefined, undefined, undefined, undefined);
|
||||
}
|
||||
else {
|
||||
getUINativeModule().common.setInvert(
|
||||
node, undefined, this.value.low, this.value.high, this.value.threshold, this.value.thresholdRange);
|
||||
}
|
||||
}
|
||||
}
|
||||
checkObjectDiff() {
|
||||
return !(this.stageValue.high == this.value.high &&
|
||||
this.stageValue.low == this.value.low &&
|
||||
this.stageValue.threshold == this.value.threshold &&
|
||||
this.stageValue.thresholdRange == this.value.thresholdRange);
|
||||
}
|
||||
}
|
||||
InvertModifier.identity = Symbol('invert');
|
||||
@ -605,9 +622,14 @@ class BlurModifier extends ModifierWithKey {
|
||||
getUINativeModule().common.resetBlur(node);
|
||||
}
|
||||
else {
|
||||
getUINativeModule().common.setBlur(node, this.value);
|
||||
getUINativeModule().common.setBlur(
|
||||
node, this.value.value, (_a = this.value.options) === null || _a === void 0 ? void 0 : _a.grayscale);
|
||||
}
|
||||
}
|
||||
checkObjectDiff() {
|
||||
return !((this.stageValue.value === this.value.value) &&
|
||||
(this.stageValue.options === this.value.options));
|
||||
}
|
||||
}
|
||||
BlurModifier.identity = Symbol('blur');
|
||||
class LinearGradientModifier extends ModifierWithKey {
|
||||
@ -2797,13 +2819,11 @@ class ArkComponent {
|
||||
parallelGesture(gesture, mask) {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
blur(value) {
|
||||
if (!isNumber(value)) {
|
||||
modifierWithKey(this._modifiersWithKeys, BlurModifier.identity, BlurModifier, undefined);
|
||||
}
|
||||
else {
|
||||
modifierWithKey(this._modifiersWithKeys, BlurModifier.identity, BlurModifier, value);
|
||||
}
|
||||
blur(value, options) {
|
||||
let blur = new ArkBlurOptions();
|
||||
blur.value = value;
|
||||
blur.options = options;
|
||||
modifierWithKey(this._modifiersWithKeys, BlurModifier.identity, BlurModifier, blur);
|
||||
return this;
|
||||
}
|
||||
linearGradientBlur(value, options) {
|
||||
@ -2868,11 +2888,11 @@ class ArkComponent {
|
||||
return this;
|
||||
}
|
||||
invert(value) {
|
||||
if (!isNumber(value)) {
|
||||
modifierWithKey(this._modifiersWithKeys, InvertModifier.identity, InvertModifier, undefined);
|
||||
if (!isUndefined(value)) {
|
||||
modifierWithKey(this._modifiersWithKeys, InvertModifier.identity, InvertModifier, value);
|
||||
}
|
||||
else {
|
||||
modifierWithKey(this._modifiersWithKeys, InvertModifier.identity, InvertModifier, value);
|
||||
modifierWithKey(this._modifiersWithKeys, InvertModifier.identity, InvertModifier, undefined);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@ -2889,13 +2909,11 @@ class ArkComponent {
|
||||
modifierWithKey(this._modifiersWithKeys, UseEffectModifier.identity, UseEffectModifier, value);
|
||||
return this;
|
||||
}
|
||||
backdropBlur(value) {
|
||||
if (!isNumber(value)) {
|
||||
modifierWithKey(this._modifiersWithKeys, BackdropBlurModifier.identity, BackdropBlurModifier, undefined);
|
||||
}
|
||||
else {
|
||||
modifierWithKey(this._modifiersWithKeys, BackdropBlurModifier.identity, BackdropBlurModifier, value);
|
||||
}
|
||||
backdropBlur(value, options) {
|
||||
let blur = new ArkBlurOptions();
|
||||
blur.value = value;
|
||||
blur.options = options;
|
||||
modifierWithKey(this._modifiersWithKeys, BackdropBlurModifier.identity, BackdropBlurModifier, blur);
|
||||
return this;
|
||||
}
|
||||
renderGroup(value) {
|
||||
@ -9107,6 +9125,20 @@ class ArkScrollEdgeEffect {
|
||||
(this.options === another.options);
|
||||
}
|
||||
}
|
||||
class ArkBlurOptions {
|
||||
constructor() {
|
||||
this.value = undefined;
|
||||
this.options = undefined;
|
||||
}
|
||||
}
|
||||
class InvertOptions {
|
||||
constructor() {
|
||||
this.high = undefined;
|
||||
this.low = undefined;
|
||||
this.threshold = undefined;
|
||||
this.thresholdRange = undefined;
|
||||
}
|
||||
}
|
||||
class ArkMenuAlignType {
|
||||
constructor(alignType, offset) {
|
||||
this.alignType = alignType;
|
||||
|
@ -1889,13 +1889,21 @@ ArkUINativeModuleValue CommonBridge::SetBackdropBlur(ArkUIRuntimeCallInfo *runti
|
||||
EcmaVM *vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(NUM_0);
|
||||
Local<JSValueRef> secondArg = runtimeCallInfo->GetCallArgRef(NUM_1);
|
||||
Local<JSValueRef> blurArg = runtimeCallInfo->GetCallArgRef(NUM_1);
|
||||
Local<JSValueRef> blurOptionArg = runtimeCallInfo->GetCallArgRef(NUM_2);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
if (secondArg->IsNumber()) {
|
||||
GetArkUINodeModifiers()->getCommonModifier()->setBackdropBlur(nativeNode, secondArg->ToNumber(vm)->Value());
|
||||
} else {
|
||||
|
||||
double blur = 0.0;
|
||||
if (!ArkTSUtils::ParseJsDouble(vm, blurArg, blur)) {
|
||||
GetArkUINodeModifiers()->getCommonModifier()->resetBackdropBlur(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
BlurOption blurOption;
|
||||
if (blurOptionArg->IsArray(vm)) {
|
||||
ParseBlurOption(vm, blurOptionArg, blurOption);
|
||||
}
|
||||
GetArkUINodeModifiers()->getCommonModifier()->setBackdropBlur(
|
||||
nativeNode, blur, blurOption.grayscale.data(), blurOption.grayscale.size());
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
@ -1950,13 +1958,42 @@ ArkUINativeModuleValue CommonBridge::SetInvert(ArkUIRuntimeCallInfo *runtimeCall
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(NUM_0);
|
||||
Local<JSValueRef> secondArg = runtimeCallInfo->GetCallArgRef(NUM_1);
|
||||
Local<JSValueRef> invertValueArg = runtimeCallInfo->GetCallArgRef(NUM_1);
|
||||
Local<JSValueRef> optionLowArg = runtimeCallInfo->GetCallArgRef(NUM_2);
|
||||
Local<JSValueRef> optionHighArg = runtimeCallInfo->GetCallArgRef(NUM_3);
|
||||
Local<JSValueRef> optionThresholdArg = runtimeCallInfo->GetCallArgRef(NUM_4);
|
||||
Local<JSValueRef> optionThresholdRangeArg = runtimeCallInfo->GetCallArgRef(NUM_5);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
if (secondArg->IsNumber()) {
|
||||
GetArkUINodeModifiers()->getCommonModifier()->setInvert(nativeNode, secondArg->ToNumber(vm)->Value());
|
||||
|
||||
if (!invertValueArg->IsUndefined()) {
|
||||
double invertValue = 0.0;
|
||||
if (ArkTSUtils::ParseJsDouble(vm, invertValueArg, invertValue)) {
|
||||
ArkUI_Float32 invert[] = { invertValue };
|
||||
GetArkUINodeModifiers()->getCommonModifier()->setInvert(nativeNode, invert, NUM_1);
|
||||
} else {
|
||||
GetArkUINodeModifiers()->getCommonModifier()->resetInvert(nativeNode);
|
||||
}
|
||||
} else {
|
||||
ArkUI_Float32 invert[] = { 0.0, 0.0, 0.0, 0.0 };
|
||||
double low = 0.0;
|
||||
double high = 0.0;
|
||||
double threshold = 0.0;
|
||||
double thresholdRange = 0.0;
|
||||
if (ArkTSUtils::ParseJsDouble(vm, optionLowArg, low)) {
|
||||
invert[NUM_0] = std::clamp(low, 0.0, 1.0);
|
||||
}
|
||||
if (ArkTSUtils::ParseJsDouble(vm, optionHighArg, high)) {
|
||||
invert[NUM_1] = std::clamp(high, 0.0, 1.0);
|
||||
}
|
||||
if (ArkTSUtils::ParseJsDouble(vm, optionThresholdArg, threshold)) {
|
||||
invert[NUM_2] = std::clamp(threshold, 0.0, 1.0);
|
||||
}
|
||||
if (ArkTSUtils::ParseJsDouble(vm, optionThresholdRangeArg, thresholdRange)) {
|
||||
invert[NUM_3] = std::clamp(thresholdRange, 0.0, 1.0);
|
||||
}
|
||||
GetArkUINodeModifiers()->getCommonModifier()->setInvert(nativeNode, invert, NUM_4);
|
||||
}
|
||||
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
@ -2126,13 +2163,21 @@ ArkUINativeModuleValue CommonBridge::SetBlur(ArkUIRuntimeCallInfo *runtimeCallIn
|
||||
EcmaVM *vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(NUM_0);
|
||||
Local<JSValueRef> secondArg = runtimeCallInfo->GetCallArgRef(NUM_1);
|
||||
Local<JSValueRef> blurArg = runtimeCallInfo->GetCallArgRef(NUM_1);
|
||||
Local<JSValueRef> blurOptionArg = runtimeCallInfo->GetCallArgRef(NUM_2);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
if (secondArg->IsNumber()) {
|
||||
GetArkUINodeModifiers()->getCommonModifier()->setBlur(nativeNode, secondArg->ToNumber(vm)->Value());
|
||||
} else {
|
||||
double blur = 0.0;
|
||||
if (!ArkTSUtils::ParseJsDouble(vm, blurArg, blur)) {
|
||||
GetArkUINodeModifiers()->getCommonModifier()->resetBlur(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
BlurOption blurOption;
|
||||
if (blurOptionArg->IsArray(vm)) {
|
||||
ParseBlurOption(vm, blurOptionArg, blurOption);
|
||||
}
|
||||
GetArkUINodeModifiers()->getCommonModifier()->setBlur(
|
||||
nativeNode, blur, blurOption.grayscale.data(), blurOption.grayscale.size());
|
||||
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
|
@ -1605,7 +1605,7 @@ void ViewAbstract::SetBackdropBlur(const Dimension &radius, const BlurOption &bl
|
||||
}
|
||||
}
|
||||
|
||||
void ViewAbstract::SetBackdropBlur(FrameNode *frameNode, const Dimension &radius)
|
||||
void ViewAbstract::SetBackdropBlur(FrameNode *frameNode, const Dimension &radius, const BlurOption &blurOption)
|
||||
{
|
||||
CHECK_NULL_VOID(frameNode);
|
||||
auto target = frameNode->GetRenderContext();
|
||||
@ -1613,7 +1613,7 @@ void ViewAbstract::SetBackdropBlur(FrameNode *frameNode, const Dimension &radius
|
||||
if (target->GetBackgroundEffect().has_value()) {
|
||||
target->UpdateBackgroundEffect(std::nullopt);
|
||||
}
|
||||
target->UpdateBackBlurRadius(radius);
|
||||
target->UpdateBackBlur(radius, blurOption);
|
||||
if (target->GetBackBlurStyle().has_value()) {
|
||||
target->UpdateBackBlurStyle(std::nullopt);
|
||||
}
|
||||
@ -1653,12 +1653,12 @@ void ViewAbstract::SetFrontBlur(const Dimension &radius, const BlurOption &blurO
|
||||
}
|
||||
}
|
||||
|
||||
void ViewAbstract::SetFrontBlur(FrameNode *frameNode, const Dimension &radius)
|
||||
void ViewAbstract::SetFrontBlur(FrameNode *frameNode, const Dimension &radius, const BlurOption &blurOption)
|
||||
{
|
||||
CHECK_NULL_VOID(frameNode);
|
||||
auto target = frameNode->GetRenderContext();
|
||||
if (target) {
|
||||
target->UpdateFrontBlurRadius(radius);
|
||||
target->UpdateFrontBlur(radius, blurOption);
|
||||
if (target->GetFrontBlurStyle().has_value()) {
|
||||
target->UpdateFrontBlurStyle(std::nullopt);
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ public:
|
||||
static void SetOpacity(FrameNode* frameNode, double opacity);
|
||||
static void SetZIndex(FrameNode* frameNode, int32_t value);
|
||||
static void SetAlign(FrameNode* frameNode, Alignment alignment);
|
||||
static void SetBackdropBlur(FrameNode* frameNode, const Dimension& radius);
|
||||
static void SetBackdropBlur(FrameNode* frameNode, const Dimension& radius, const BlurOption &blurOption);
|
||||
static void SetInvert(FrameNode* frameNode, const InvertVariant& invert);
|
||||
static void SetSepia(FrameNode* frameNode, const Dimension& sepia);
|
||||
static void SetSaturate(FrameNode* frameNode, const Dimension& saturate);
|
||||
@ -407,7 +407,7 @@ public:
|
||||
static void SetGrayScale(FrameNode* frameNode, const Dimension& grayScale);
|
||||
static void SetContrast(FrameNode* frameNode, const Dimension& contrast);
|
||||
static void SetBrightness(FrameNode* frameNode, const Dimension& brightness);
|
||||
static void SetFrontBlur(FrameNode* frameNode, const Dimension& radius);
|
||||
static void SetFrontBlur(FrameNode* frameNode, const Dimension& radius, const BlurOption &blurOption);
|
||||
static void SetHueRotate(FrameNode* frameNode, float hueRotate);
|
||||
static void SetLinearGradient(FrameNode* frameNode, const NG::Gradient& gradient);
|
||||
static void SetSweepGradient(FrameNode* frameNode, const NG::Gradient& gradient);
|
||||
|
@ -1010,11 +1010,12 @@ struct ArkUICommonModifier {
|
||||
void (*resetOpacity)(ArkUINodeHandle node);
|
||||
void (*setAlign)(ArkUINodeHandle node, ArkUI_Int32 align);
|
||||
void (*resetAlign)(ArkUINodeHandle node);
|
||||
void (*setBackdropBlur)(ArkUINodeHandle node, ArkUI_Float32 value);
|
||||
void (*setBackdropBlur)(
|
||||
ArkUINodeHandle node, ArkUI_Float32 value, const ArkUI_Float32* blurValues, ArkUI_Int32 blurValuesSize);
|
||||
void (*resetBackdropBlur)(ArkUINodeHandle node);
|
||||
void (*setHueRotate)(ArkUINodeHandle node, ArkUI_Float32 deg);
|
||||
void (*resetHueRotate)(ArkUINodeHandle node);
|
||||
void (*setInvert)(ArkUINodeHandle node, ArkUI_Float32 invert);
|
||||
void (*setInvert)(ArkUINodeHandle node, ArkUI_Float32* invert, ArkUI_Int32 length);
|
||||
void (*resetInvert)(ArkUINodeHandle node);
|
||||
void (*setSepia)(ArkUINodeHandle node, ArkUI_Float32 sepia);
|
||||
void (*resetSepia)(ArkUINodeHandle node);
|
||||
@ -1028,7 +1029,8 @@ struct ArkUICommonModifier {
|
||||
void (*resetContrast)(ArkUINodeHandle node);
|
||||
void (*setBrightness)(ArkUINodeHandle node, ArkUI_Float32 brightness);
|
||||
void (*resetBrightness)(ArkUINodeHandle node);
|
||||
void (*setBlur)(ArkUINodeHandle node, ArkUI_Float32 value);
|
||||
void (*setBlur)(
|
||||
ArkUINodeHandle node, ArkUI_Float32 value, const ArkUI_Float32* blurValues, ArkUI_Int32 blurValuesSize);
|
||||
void (*resetBlur)(ArkUINodeHandle node);
|
||||
void (*setLinearGradient)(ArkUINodeHandle node, const ArkUI_Float32* values, ArkUI_Int32 valuesLength,
|
||||
const ArkUIInt32orFloat32* colors, ArkUI_Int32 colorsLength);
|
||||
|
@ -1006,7 +1006,8 @@ void ResetAlign(ArkUINodeHandle node)
|
||||
ViewAbstract::SetAlign(frameNode, Alignment::CENTER);
|
||||
}
|
||||
|
||||
void SetBackdropBlur(ArkUINodeHandle node, ArkUI_Float32 value)
|
||||
void SetBackdropBlur(
|
||||
ArkUINodeHandle node, ArkUI_Float32 value, const ArkUI_Float32* blurValues, ArkUI_Int32 blurValuesSize)
|
||||
{
|
||||
ArkUI_Float32 blur = 0.0f;
|
||||
auto* frameNode = reinterpret_cast<FrameNode*>(node);
|
||||
@ -1014,8 +1015,10 @@ void SetBackdropBlur(ArkUINodeHandle node, ArkUI_Float32 value)
|
||||
if (value > 0) {
|
||||
blur = value;
|
||||
}
|
||||
BlurOption blurOption;
|
||||
blurOption.grayscale.assign(blurValues, blurValues + blurValuesSize);
|
||||
CalcDimension dimensionRadius(blur, DimensionUnit::PX);
|
||||
ViewAbstract::SetBackdropBlur(frameNode, dimensionRadius);
|
||||
ViewAbstract::SetBackdropBlur(frameNode, dimensionRadius, blurOption);
|
||||
}
|
||||
|
||||
void ResetBackdropBlur(ArkUINodeHandle node)
|
||||
@ -1023,8 +1026,9 @@ void ResetBackdropBlur(ArkUINodeHandle node)
|
||||
auto* frameNode = reinterpret_cast<FrameNode*>(node);
|
||||
CHECK_NULL_VOID(frameNode);
|
||||
double blur = 0.0;
|
||||
BlurOption option;
|
||||
CalcDimension dimensionRadius(blur, DimensionUnit::PX);
|
||||
ViewAbstract::SetBackdropBlur(frameNode, dimensionRadius);
|
||||
ViewAbstract::SetBackdropBlur(frameNode, dimensionRadius, option);
|
||||
}
|
||||
|
||||
void SetHueRotate(ArkUINodeHandle node, ArkUI_Float32 deg)
|
||||
@ -1046,11 +1050,21 @@ void ResetHueRotate(ArkUINodeHandle node)
|
||||
ViewAbstract::SetHueRotate(frameNode, deg);
|
||||
}
|
||||
|
||||
void SetInvert(ArkUINodeHandle node, ArkUI_Float32 invert)
|
||||
void SetInvert(ArkUINodeHandle node, ArkUI_Float32* invert, ArkUI_Int32 length)
|
||||
{
|
||||
auto* frameNode = reinterpret_cast<FrameNode*>(node);
|
||||
CHECK_NULL_VOID(frameNode);
|
||||
InvertVariant invertVariant = static_cast<float>(invert);
|
||||
InvertVariant invertVariant;
|
||||
if (length == NUM_4) {
|
||||
InvertOption option;
|
||||
option.low_ = invert[NUM_0];
|
||||
option.high_ = invert[NUM_1];
|
||||
option.threshold_ = invert[NUM_2];
|
||||
option.thresholdRange_ = invert[NUM_3];
|
||||
invertVariant = option;
|
||||
} else {
|
||||
invertVariant = invert[NUM_0];
|
||||
}
|
||||
ViewAbstract::SetInvert(frameNode, invertVariant);
|
||||
}
|
||||
|
||||
@ -1175,16 +1189,18 @@ void ResetBrightness(ArkUINodeHandle node)
|
||||
ViewAbstract::SetBrightness(frameNode, value);
|
||||
}
|
||||
|
||||
void SetBlur(ArkUINodeHandle node, ArkUI_Float32 value)
|
||||
void SetBlur(ArkUINodeHandle node, ArkUI_Float32 value, const ArkUI_Float32* blurValues, ArkUI_Int32 blurValuesSize)
|
||||
{
|
||||
auto* frameNode = reinterpret_cast<FrameNode*>(node);
|
||||
CHECK_NULL_VOID(frameNode);
|
||||
ArkUI_Float32 blur = 0.0f;
|
||||
BlurOption blurOption;
|
||||
blurOption.grayscale.assign(blurValues, blurValues + blurValuesSize);
|
||||
if (value > 0) {
|
||||
blur = value;
|
||||
}
|
||||
CalcDimension dimensionBlur(blur, DimensionUnit::PX);
|
||||
ViewAbstract::SetFrontBlur(frameNode, dimensionBlur);
|
||||
ViewAbstract::SetFrontBlur(frameNode, dimensionBlur, blurOption);
|
||||
}
|
||||
|
||||
void ResetBlur(ArkUINodeHandle node)
|
||||
@ -1192,8 +1208,9 @@ void ResetBlur(ArkUINodeHandle node)
|
||||
auto* frameNode = reinterpret_cast<FrameNode*>(node);
|
||||
CHECK_NULL_VOID(frameNode);
|
||||
double blur = 0.0;
|
||||
BlurOption option;
|
||||
CalcDimension dimensionBlur(blur, DimensionUnit::PX);
|
||||
ViewAbstract::SetFrontBlur(frameNode, dimensionBlur);
|
||||
ViewAbstract::SetFrontBlur(frameNode, dimensionBlur, option);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2803,12 +2820,10 @@ void SetFlexBasis(ArkUINodeHandle node, const struct ArkUIStringAndFloat* flexBa
|
||||
Dimension result;
|
||||
if (flexBasisValue->valueStr != nullptr) {
|
||||
result = StringUtils::StringToDimensionWithUnit(std::string(flexBasisValue->valueStr), DimensionUnit::VP);
|
||||
if (Container::LessThanAPIVersion(PlatformVersion::VERSION_TEN)) {
|
||||
// flexbasis don't support percent case.
|
||||
if (result.Unit() == DimensionUnit::PERCENT) {
|
||||
result.SetUnit(DimensionUnit::AUTO);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result = Dimension(flexBasisValue->value, DimensionUnit::VP);
|
||||
}
|
||||
@ -4151,14 +4166,16 @@ void SetBlendMode(ArkUINodeHandle node, int32_t blendMode, ArkUI_Int32 blendAppl
|
||||
{
|
||||
auto* frameNode = reinterpret_cast<FrameNode*>(node);
|
||||
CHECK_NULL_VOID(frameNode);
|
||||
ViewAbstract::SetBlendMode(frameNode, static_cast<BlendMode>(blendMode));
|
||||
ViewAbstractModelNG::SetBlendMode(frameNode, static_cast<OHOS::Ace::BlendMode>(blendMode));
|
||||
ViewAbstractModelNG::SetBlendApplyType(frameNode, static_cast<OHOS::Ace::BlendApplyType>(blendApplyTypeValue));
|
||||
}
|
||||
|
||||
void ResetBlendMode(ArkUINodeHandle node)
|
||||
{
|
||||
auto* frameNode = reinterpret_cast<FrameNode*>(node);
|
||||
CHECK_NULL_VOID(frameNode);
|
||||
ViewAbstract::SetBlendMode(frameNode, BlendMode::NONE);
|
||||
ViewAbstractModelNG::SetBlendMode(frameNode, OHOS::Ace::BlendMode::NONE);
|
||||
ViewAbstractModelNG::SetBlendApplyType(frameNode, OHOS::Ace::BlendApplyType::FAST);
|
||||
}
|
||||
|
||||
void SetMonopolizeEvents(ArkUINodeHandle node, ArkUI_Bool value)
|
||||
|
@ -1001,7 +1001,9 @@ int32_t SetBlur(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
|
||||
}
|
||||
auto fullImpl = GetFullImpl();
|
||||
ArkUI_Float64 blur = item->value[NUM_0].f32;
|
||||
fullImpl->getNodeModifiers()->getCommonModifier()->setBlur(node->uiNodeHandle, blur);
|
||||
BlurOption blurOption;
|
||||
fullImpl->getNodeModifiers()->getCommonModifier()->setBlur(
|
||||
node->uiNodeHandle, blur, blurOption.grayscale.data(), blurOption.grayscale.size());
|
||||
return ERROR_CODE_NO_ERROR;
|
||||
}
|
||||
|
||||
@ -2471,7 +2473,8 @@ int32_t SetInvert(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
|
||||
return ERROR_CODE_PARAM_INVALID;
|
||||
}
|
||||
auto fullImpl = GetFullImpl();
|
||||
fullImpl->getNodeModifiers()->getCommonModifier()->setInvert(node->uiNodeHandle, item->value[0].f32);
|
||||
ArkUI_Float32 invert[] = { item->value[0].f32 };
|
||||
fullImpl->getNodeModifiers()->getCommonModifier()->setInvert(node->uiNodeHandle, invert, NUM_1);
|
||||
return ERROR_CODE_NO_ERROR;
|
||||
}
|
||||
|
||||
|
@ -818,9 +818,9 @@ HWTEST_F(ViewAbstractTestNg, ViewAbstractTest015, TestSize.Level1)
|
||||
Matrix4 matrix;
|
||||
ViewAbstract::SetTransformMatrix(std::move(matrix));
|
||||
ViewAbstract::SetBackdropBlur(RADIUS, blurOption);
|
||||
ViewAbstract::SetBackdropBlur(nullptr, RADIUS);
|
||||
ViewAbstract::SetBackdropBlur(nullptr, RADIUS, blurOption);
|
||||
ViewAbstract::SetFrontBlur(RADIUS, blurOption);
|
||||
ViewAbstract::SetFrontBlur(nullptr, RADIUS);
|
||||
ViewAbstract::SetFrontBlur(nullptr, RADIUS, blurOption);
|
||||
ViewAbstract::SetInspectorId(srcimages);
|
||||
|
||||
Vector5F scale(1.0f, 1.0f, 2.0f, 2.0f, 0.0f);
|
||||
|
Loading…
Reference in New Issue
Block a user