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 #include "utils/region.h"
17
18 #include "impl_factory.h"
19
20 namespace OHOS {
21 namespace Rosen {
22 namespace Drawing {
Region()23 Region::Region() : impl_(ImplFactory::CreateRegionImpl()) {}
24
Region(const Region & other)25 Region::Region(const Region& other) : Region()
26 {
27 impl_->Clone(other);
28 }
29
operator =(const Region & other)30 Region& Region::operator=(const Region& other)
31 {
32 impl_->Clone(other);
33 return *this;
34 }
35
SetRect(const RectI & rectI)36 bool Region::SetRect(const RectI& rectI)
37 {
38 return impl_->SetRect(rectI);
39 }
40
SetPath(const Path & path,const Region & clip)41 bool Region::SetPath(const Path& path, const Region& clip)
42 {
43 return impl_->SetPath(path, clip);
44 }
45
GetBoundaryPath(Path * path) const46 bool Region::GetBoundaryPath(Path* path) const
47 {
48 return impl_->GetBoundaryPath(path);
49 }
50
IsIntersects(const Region & other) const51 bool Region::IsIntersects(const Region& other) const
52 {
53 return impl_->IsIntersects(other);
54 }
55
IsEmpty() const56 bool Region::IsEmpty() const
57 {
58 return impl_->IsEmpty();
59 }
60
IsRect() const61 bool Region::IsRect() const
62 {
63 return impl_->IsRect();
64 }
65
Op(const Region & region,RegionOp op)66 bool Region::Op(const Region& region, RegionOp op)
67 {
68 return impl_->Op(region, op);
69 }
70
Serialize() const71 std::shared_ptr<Data> Region::Serialize() const
72 {
73 return impl_->Serialize();
74 }
75
Deserialize(std::shared_ptr<Data> data)76 bool Region::Deserialize(std::shared_ptr<Data> data)
77 {
78 return impl_->Deserialize(data);
79 }
80 } // namespace Drawing
81 } // namespace Rosen
82 } // namespace OHOS
83