• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef UI_EFFECT_ANI_UIEFFECT_H
17 #define UI_EFFECT_ANI_UIEFFECT_H
18 
19 #undef LOG_TAG
20 #define LOG_TAG "UiEffect_Ani"
21 
22 #define UIEFFECT_LOG_D(fmt, ...) HILOG_DEBUG(LOG_CORE, fmt, ##__VA_ARGS__)
23 #define UIEFFECT_LOG_I(fmt, ...) HILOG_INFO(LOG_CORE, fmt, ##__VA_ARGS__)
24 #define UIEFFECT_LOG_E(fmt, ...) HILOG_ERROR(LOG_CORE, fmt, ##__VA_ARGS__)
25 
26 #include <iostream>
27 
28 #include "ani.h"
29 #include "effect/include/background_color_effect_para.h"
30 #include "effect/include/blender.h"
31 #include "effect/include/brightness_blender.h"
32 #include "effect/include/visual_effect.h"
33 #include "effect/include/visual_effect_para.h"
34 #include "filter/include/filter.h"
35 #include "filter/include/filter_pixel_stretch_para.h"
36 #include "filter/include/filter_blur_para.h"
37 #include "hilog/log.h"
38 
39 namespace OHOS {
40 namespace Rosen {
41 static const std::string ANI_UIEFFECT_SPACE = "L@ohos/graphics/uiEffect/uiEffect";
42 static const std::string ANI_UIEFFECT_VISUAL_EFFECT = ANI_UIEFFECT_SPACE + "/VisualEffectInternal;";
43 static const std::string ANI_UIEFFECT_BRIGHTNESS_BLENDER = ANI_UIEFFECT_SPACE + "/BrightnessBlenderInternal;";
44 static const std::string ANI_UIEFFECT_HDRBRIGHTNESS_BLENDER = ANI_UIEFFECT_SPACE + "/HdrBrightnessBlenderInternal;";
45 static const std::string ANI_UIEFFECT_FILTER = ANI_UIEFFECT_SPACE + "/FilterInternal;";
46 class AniEffect {
47 public:
48     AniEffect();
49     ~AniEffect();
50     static ani_status BindVisualEffectMethod(ani_env* env);
51     static ani_status BindFilterMethod(ani_env* env);
52     static ani_object CreateEffect(ani_env* env);
53     static ani_object CreateBrightnessBlender(ani_env* env, ani_object para);
54     static ani_object CreateHdrBrightnessBlender(ani_env* env, ani_object para);
55     static ani_object BackgroundColorBlender(ani_env* env, ani_object obj, ani_object para);
56     static ani_object CreateFilter(ani_env* env);
57     static ani_object PixelStretch(ani_env* env, ani_object obj, ani_object arrayObj, ani_enum_item enumItem);
58     static ani_object Blur(ani_env* env, ani_object obj, ani_double radius);
59 
60 private:
61     static ani_object CreateAniObject(ani_env* env, std::string name, const char* signature, ani_long addr);
62     static void ParseBrightnessBlender(ani_env* env, ani_object para_obj, std::unique_ptr<BrightnessBlender>& blender);
63 };
64 } // namespace Rosen
65 } // namespace OHOS
66 #endif