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 BLEND_SHADER_OBJ_H 17 #define BLEND_SHADER_OBJ_H 18 19 #include "draw/blend_mode.h" 20 #include "effect/shader_effect.h" 21 #include "effect/shader_effect_obj.h" 22 23 namespace OHOS { 24 namespace Rosen { 25 namespace Drawing { 26 27 class BlendShaderObj final : public ShaderEffectObj { 28 public: 29 static std::shared_ptr<BlendShaderObj> CreateForUnmarshalling(); 30 static std::shared_ptr<BlendShaderObj> Create(const std::shared_ptr<ShaderEffect>& dst, 31 const std::shared_ptr<ShaderEffect>& src, 32 BlendMode mode); 33 ~BlendShaderObj() override = default; 34 35 #ifdef ROSEN_OHOS 36 bool Marshalling(Parcel& parcel) override; 37 bool Unmarshalling(Parcel& parcel, bool& isValid, int32_t depth = 0) override; 38 #endif 39 std::shared_ptr<void> GenerateBaseObject() override; 40 41 private: 42 BlendShaderObj(); 43 BlendShaderObj(const std::shared_ptr<ShaderEffect>& dst, 44 const std::shared_ptr<ShaderEffect>& src, 45 BlendMode mode); 46 std::shared_ptr<ShaderEffect> dstShader_ = nullptr; 47 std::shared_ptr<ShaderEffect> srcShader_ = nullptr; 48 BlendMode blendMode_ = BlendMode::SRC_OVER; 49 }; 50 } // namespace Drawing 51 } // namespace Rosen 52 } // namespace OHOS 53 54 #endif // BLEND_SHADER_OBJ_H