1 /* 2 * Copyright (c) 2021 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_CLIENT_CORE_RENDER_SKIA_RS_SKIA_FILTER_H 16 #define RENDER_SERVICE_CLIENT_CORE_RENDER_SKIA_RS_SKIA_FILTER_H 17 18 #include <optional> 19 20 #include "common/rs_vector2.h" 21 #include "draw/brush.h" 22 #include "draw/canvas.h" 23 #include "effect/image_filter.h" 24 #include "render/rs_filter.h" 25 26 namespace OHOS { 27 namespace Rosen { 28 class RSPaintFilterCanvas; 29 class RSDrawingFilterOriginal : public RSFilter { 30 public: 31 RSDrawingFilterOriginal(std::shared_ptr<Drawing::ImageFilter> imagefilter); 32 ~RSDrawingFilterOriginal() override; 33 Drawing::Brush GetBrush() const; 34 virtual void DrawImageRect(Drawing::Canvas& canvas, const std::shared_ptr<Drawing::Image>& image, 35 const Drawing::Rect& src, const Drawing::Rect& dst) const; 36 std::shared_ptr<Drawing::ImageFilter> GetImageFilter() const; 37 virtual std::shared_ptr<RSDrawingFilterOriginal> Compose( 38 const std::shared_ptr<RSDrawingFilterOriginal>& other) const = 0; PreProcess(std::shared_ptr<Drawing::Image> image)39 virtual void PreProcess(std::shared_ptr<Drawing::Image> image) {}; PostProcess(Drawing::Canvas & canvas)40 virtual void PostProcess(Drawing::Canvas& canvas) {}; SetGreyCoef(const std::optional<Vector2f> & greyCoef)41 virtual void SetGreyCoef(const std::optional<Vector2f>& greyCoef) {}; CanSkipFrame()42 virtual bool CanSkipFrame() const { return false; }; SetGeometry(Drawing::Canvas & canvas,float geoWidth,float geoHeight)43 virtual void SetGeometry(Drawing::Canvas& canvas, float geoWidth, float geoHeight) {}; IsOffscreenCanvas(bool isOffscreenCanvas)44 virtual void IsOffscreenCanvas(bool isOffscreenCanvas) {}; DisableMotionBlur(bool isDisableMotionBlur)45 virtual void DisableMotionBlur(bool isDisableMotionBlur) {}; 46 47 protected: 48 std::shared_ptr<Drawing::ImageFilter> imageFilter_ = nullptr; 49 }; 50 } // namespace Rosen 51 } // namespace OHOS 52 53 #endif // RENDER_SERVICE_CLIENT_CORE_RENDER_SKIA_RS_SKIA_FILTER_H