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 RENDER_SERVICE_BASE_CORE_RENDER_RS_BORDER_LIGHT_SHADER_H 16 #define RENDER_SERVICE_BASE_CORE_RENDER_RS_BORDER_LIGHT_SHADER_H 17 18 #include "common/rs_vector3.h" 19 #include "common/rs_vector4.h" 20 #include "render/rs_shader.h" 21 #include "transaction/rs_marshalling_helper.h" 22 23 namespace OHOS { 24 namespace Rosen { 25 class GEBorderLightShader; 26 struct RSBorderLightParams { 27 Vector3f lightPosition_; 28 Vector4f lightColor_; 29 float lightIntensity_ = 0.0f; 30 float lightWidth_ = 0.0f; 31 Vector3f rotationAngle_; 32 float cornerRadius_ = 0.0f; 33 }; 34 35 class RSB_EXPORT RSBorderLightShader : public RSShader { 36 public: 37 RSBorderLightShader(); 38 RSBorderLightShader(const RSBorderLightParams& borderLightParam); 39 RSBorderLightShader(const RSBorderLightShader&) = delete; 40 RSBorderLightShader operator=(const RSBorderLightShader&) = delete; 41 ~RSBorderLightShader() override = default; 42 43 void MakeDrawingShader(const RectF& rect, float progress) override; 44 const std::shared_ptr<Drawing::ShaderEffect>& GetDrawingShader() const override; 45 void SetRSBorderLightParams(const RSBorderLightParams& borderLightParam); 46 void SetRotationAngle(const Vector3f& rotationAngle); 47 void SetCornerRadius(float cornerRadius); 48 bool Marshalling(Parcel& parcel) override; 49 bool Unmarshalling(Parcel& parcel, bool& needReset) override; 50 51 private: 52 RSBorderLightParams borderLightParam_; 53 std::shared_ptr<GEBorderLightShader> geShader_ = nullptr; 54 }; 55 } // namespace Rosen 56 } // namespace OHOS 57 58 #endif