• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 #include "effect/mask_filter.h"
17 
18 #include "impl_factory.h"
19 
20 #include "impl_interface/mask_filter_impl.h"
21 
22 namespace OHOS {
23 namespace Rosen {
24 namespace Drawing {
MaskFilter(FilterType t,BlurType blurType,scalar sigma,bool respectCTM)25 MaskFilter::MaskFilter(FilterType t, BlurType blurType, scalar sigma, bool respectCTM) noexcept : MaskFilter()
26 {
27     type_ = t;
28     impl_->InitWithBlur(blurType, sigma, respectCTM);
29 }
30 
MaskFilter()31 MaskFilter::MaskFilter() noexcept : type_(MaskFilter::FilterType::NO_TYPE), impl_(ImplFactory::CreateMaskFilterImpl())
32 {}
33 
MaskFilter(FilterType t)34 MaskFilter::MaskFilter(FilterType t) noexcept : type_(t), impl_(ImplFactory::CreateMaskFilterImpl())
35 {}
36 
GetType() const37 MaskFilter::FilterType MaskFilter::GetType() const
38 {
39     return type_;
40 }
41 
CreateBlurMaskFilter(BlurType blurType,scalar sigma,bool respectCTM)42 std::shared_ptr<MaskFilter> MaskFilter::CreateBlurMaskFilter(BlurType blurType, scalar sigma, bool respectCTM)
43 {
44     return std::make_shared<MaskFilter>(MaskFilter::FilterType::BLUR, blurType, sigma, respectCTM);
45 }
46 
Serialize() const47 std::shared_ptr<Data> MaskFilter::Serialize() const
48 {
49     return impl_->Serialize();
50 }
51 
Deserialize(std::shared_ptr<Data> data)52 bool MaskFilter::Deserialize(std::shared_ptr<Data> data)
53 {
54     return impl_->Deserialize(data);
55 }
56 
57 } // namespace Drawing
58 } // namespace Rosen
59 } // namespace OHOS