• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "modifier_ng/geometry/rs_bounds_clip_modifier.h"
17 
18 namespace OHOS::Rosen::ModifierNG {
SetClipRectWithRadius(const Vector4f & clipRect,const Vector4f & clipRadius)19 void RSBoundsClipModifier::SetClipRectWithRadius(const Vector4f& clipRect, const Vector4f& clipRadius)
20 {
21     auto rrectPtr = std::make_shared<RRect>(clipRect, clipRadius);
22     Setter(RSPropertyType::CLIP_RRECT, rrectPtr ? *rrectPtr : RRect());
23 }
24 
SetClipRRect(const std::shared_ptr<RRect> & rrect)25 void RSBoundsClipModifier::SetClipRRect(const std::shared_ptr<RRect>& rrect)
26 {
27     Setter(RSPropertyType::CLIP_RRECT, rrect ? *rrect : RRect());
28 }
29 
SetClipBounds(const std::shared_ptr<RSPath> & clipToBounds)30 void RSBoundsClipModifier::SetClipBounds(const std::shared_ptr<RSPath>& clipToBounds)
31 {
32     Setter<RSProperty>(RSPropertyType::CLIP_BOUNDS, clipToBounds);
33 }
34 
SetClipToBounds(bool clipToBounds)35 void RSBoundsClipModifier::SetClipToBounds(bool clipToBounds)
36 {
37     Setter<RSProperty>(RSPropertyType::CLIP_TO_BOUNDS, clipToBounds);
38 }
39 
SetCornerRadius(const Vector4f & cornerRadius)40 void RSBoundsClipModifier::SetCornerRadius(const Vector4f& cornerRadius)
41 {
42     Setter(RSPropertyType::CORNER_RADIUS, cornerRadius);
43 }
44 
GetCornerRadius() const45 Vector4f RSBoundsClipModifier::GetCornerRadius() const
46 {
47     return Getter(RSPropertyType::CORNER_RADIUS, Vector4f(0.f));
48 }
49 } // namespace OHOS::Rosen::ModifierNG
50