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 GRAPHICS_EFFECT_AURORA_NOISE_SHADER_H 17 #define GRAPHICS_EFFECT_AURORA_NOISE_SHADER_H 18 19 #include "ge_shader.h" 20 #include "ge_shader_filter_params.h" 21 #include "effect/runtime_shader_builder.h" 22 #include "utils/matrix.h" 23 namespace OHOS { 24 namespace Rosen { 25 class GE_EXPORT GEAuroraNoiseShader : public GEShader { 26 public: 27 GEAuroraNoiseShader(); 28 GEAuroraNoiseShader(Drawing::GEAuroraNoiseShaderParams& auroraNoiseParams); 29 ~GEAuroraNoiseShader() override = default; 30 void MakeDrawingShader(const Drawing::Rect& rect, float progress) override; GetDescription()31 const std::string GetDescription() const { return "GEAuroraNoiseShader"; } SetAuroraNoiseParams(const Drawing::GEAuroraNoiseShaderParams & params)32 void SetAuroraNoiseParams(const Drawing::GEAuroraNoiseShaderParams& params) 33 { 34 auroraNoiseParams_ = params; 35 } 36 void Preprocess(Drawing::Canvas& canvas, const Drawing::Rect& rect) override; 37 std::shared_ptr<Drawing::Image> MakeAuroraNoiseGeneratorShader(Drawing::Canvas& canvas, 38 const Drawing::ImageInfo& imageInfo); 39 std::shared_ptr<Drawing::Image> MakeAuroraNoiseVerticalBlurShader(Drawing::Canvas& canvas, 40 const Drawing::ImageInfo& imageInfo); 41 std::shared_ptr<Drawing::ShaderEffect> MakeAuroraNoiseShader(const Drawing::Rect& rect); 42 static std::shared_ptr<GEAuroraNoiseShader> CreateAuroraNoiseShader(Drawing::GEAuroraNoiseShaderParams& param); 43 std::shared_ptr<Drawing::RuntimeShaderBuilder> GetAuroraNoiseBuilder(); 44 std::shared_ptr<Drawing::RuntimeShaderBuilder> GetAuroraNoiseVerticalBlurBuilder(); 45 std::shared_ptr<Drawing::RuntimeShaderBuilder> GetAuroraNoiseUpSamplingBuilder(); 46 private: 47 GEAuroraNoiseShader(const GEAuroraNoiseShader&) = delete; 48 GEAuroraNoiseShader(const GEAuroraNoiseShader&&) = delete; 49 GEAuroraNoiseShader& operator=(const GEAuroraNoiseShader&) = delete; 50 GEAuroraNoiseShader& operator=(const GEAuroraNoiseShader&&) = delete; 51 Drawing::GEAuroraNoiseShaderParams auroraNoiseParams_; 52 std::shared_ptr<Drawing::RuntimeShaderBuilder> builder_; 53 std::shared_ptr<Drawing::RuntimeShaderBuilder> verticalBlurBuilder_; 54 std::shared_ptr<Drawing::RuntimeShaderBuilder> upSamplingBuilder_; 55 std::shared_ptr<Drawing::Image> noiseImg_; 56 std::shared_ptr<Drawing::Image> verticalBlurImg_; 57 }; 58 } // namespace Rosen 59 } // namespace OHOS 60 #endif // GRAPHICS_EFFECT_EXT_DOT_MATRIX_SHADER_H