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 #ifndef GRAPHICS_EFFECT_EXT_DOT_MATRIX_SHADER_PARAMS_H 16 #define GRAPHICS_EFFECT_EXT_DOT_MATRIX_SHADER_PARAMS_H 17 18 #include <vector> 19 20 #include "draw/color.h" 21 #include "ge_common.h" 22 #include "parcel.h" 23 #include "utils/point.h" 24 #include "utils/rect.h" 25 26 namespace OHOS { 27 namespace Rosen { 28 enum class DotMatrixEffectType { 29 NONE, 30 ROTATE, 31 RIPPLE, 32 }; 33 34 enum class DotMatrixDirection { 35 TOP, 36 TOP_RIGHT, 37 RIGHT, 38 BOTTOM_RIGHT, 39 BOTTOM, 40 BOTTOM_LEFT, 41 LEFT, 42 TOP_LEFT, 43 MAX = TOP_LEFT, 44 }; 45 46 struct RotateEffectParams { 47 DotMatrixDirection pathDirection_ = DotMatrixDirection::TOP_LEFT; 48 std::vector<Drawing::Color> effectColors_; 49 50 bool Marshalling(Parcel& parcel); 51 bool Unmarshalling(Parcel& parcel); 52 }; 53 54 struct RippleEffectParams { 55 std::vector<Drawing::Color> effectColors_; 56 std::vector<float> colorFractions_; 57 std::vector<Drawing::Point> startPoints_; 58 float pathWidth_ = 0.; 59 bool inverseEffect_ = false; 60 61 bool Marshalling(Parcel& parcel); 62 bool Unmarshalling(Parcel& parcel); 63 }; 64 65 struct DotMatrixNormalParams { 66 Drawing::Color dotColor_; 67 float dotSpacing_ = 0.f; 68 float dotRadius_ = 0.f; 69 Drawing::Color bgColor_; 70 71 bool Marshalling(Parcel& parcel); 72 bool Unmarshalling(Parcel& parcel); 73 }; 74 75 struct GE_EXPORT DotMatrixShaderParams { 76 DotMatrixEffectType effectType_ = DotMatrixEffectType::NONE; 77 DotMatrixNormalParams normalParams_; 78 RotateEffectParams rotateEffectParams_; 79 RippleEffectParams rippleEffectParams_; 80 81 bool Marshalling(Parcel& parcel); 82 bool Unmarshalling(Parcel& parcel); 83 }; 84 85 } // namespace Rosen 86 } // namespace OHOS 87 88 #endif // GRAPHICS_EFFECT_EXT_DOT_MATRIX_SHADER_PARAMS_H