1 /*
2  * Copyright (c) 2023 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 RENDER_SERVICE_BASE_PROPERTY_RS_PROPERTY_DRAWABLE_FRAME_GEOMETRY_H
17 #define RENDER_SERVICE_BASE_PROPERTY_RS_PROPERTY_DRAWABLE_FRAME_GEOMETRY_H
18 
19 #include "include/core/SkPaint.h"
20 
21 #include "property/rs_property_drawable.h"
22 
23 namespace OHOS::Rosen {
24 class RSFrameGeometryDrawable : public RSPropertyDrawable {
25 public:
26     explicit RSFrameGeometryDrawable() = default;
27     ~RSFrameGeometryDrawable() override = default;
28     void Draw(const RSRenderContent& content, RSPaintFilterCanvas& canvas) const override;
29 
30     static RSPropertyDrawable::DrawablePtr Generate(const RSRenderContent& content);
31 };
32 
33 // ============================================================================
34 // ClipFrame
35 class RSClipFrameDrawable : public RSPropertyDrawable {
36 public:
37     explicit RSClipFrameDrawable() = default;
38     ~RSClipFrameDrawable() override = default;
39     void Draw(const RSRenderContent& content, RSPaintFilterCanvas& canvas) const override;
40 
41     static RSPropertyDrawable::DrawablePtr Generate(const RSRenderContent& content);
42 };
43 
44 // ============================================================================
45 //
46 class RSColorFilterDrawable : public RSPropertyDrawable {
47 public:
RSColorFilterDrawable(Drawing::Brush && brush)48     explicit RSColorFilterDrawable(Drawing::Brush&& brush) : brush_(std::move(brush)) {}
49     ~RSColorFilterDrawable() override = default;
50     void Draw(const RSRenderContent& content, RSPaintFilterCanvas& canvas) const override;
51     static RSPropertyDrawable::DrawablePtr Generate(const RSRenderContent& content);
52     bool Update(const RSRenderContent& content) override;
53 
54 private:
55     Drawing::Brush brush_;
56 };
57 } // namespace OHOS::Rosen
58 #endif // RENDER_SERVICE_BASE_PROPERTY_RS_PROPERTY_DRAWABLE_FRAME_GEOMETRY_H
59