1 /*
2  * Copyright (c) 2023-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 "image/bitmap.h"
17 
18 #include "impl_factory.h"
19 
20 namespace OHOS {
21 namespace Rosen {
22 namespace Drawing {
Pixmap()23 Pixmap::Pixmap()
24     : pixmapImplPtr_(ImplFactory::CreatePixmapImpl())
25 {}
26 
Pixmap(const ImageInfo & imageInfo,const void * addr,size_t rowBytes)27 Pixmap::Pixmap(const ImageInfo& imageInfo, const void* addr, size_t rowBytes)
28     : pixmapImplPtr_(ImplFactory::CreatePixmapImpl(imageInfo, addr, rowBytes))
29 {}
30 
GetColorSpace() const31 std::shared_ptr<ColorSpace> Pixmap::GetColorSpace() const
32 {
33     return pixmapImplPtr_->GetColorSpace();
34 }
35 
GetColorType() const36 ColorType Pixmap::GetColorType() const
37 {
38     return pixmapImplPtr_->GetColorType();
39 }
40 
GetAlphaType() const41 AlphaType Pixmap::GetAlphaType() const
42 {
43     return pixmapImplPtr_->GetAlphaType();
44 }
45 
GetColor(int x,int y) const46 ColorQuad Pixmap::GetColor(int x, int y) const
47 {
48     return pixmapImplPtr_->GetColor(x, y);
49 }
50 
GetRowBytes() const51 size_t Pixmap::GetRowBytes() const
52 {
53     return pixmapImplPtr_->GetRowBytes();
54 }
55 
GetAddr() const56 const void* Pixmap::GetAddr() const
57 {
58     return pixmapImplPtr_->GetAddr();
59 }
60 
GetWidth() const61 int32_t Pixmap::GetWidth() const
62 {
63     return pixmapImplPtr_->GetWidth();
64 }
65 
GetHeight() const66 int32_t Pixmap::GetHeight() const
67 {
68     return pixmapImplPtr_->GetHeight();
69 }
70 
ScalePixels(const Pixmap & dst,const SamplingOptions & options) const71 bool Pixmap::ScalePixels(const Pixmap& dst, const SamplingOptions& options) const
72 {
73     return pixmapImplPtr_->ScalePixels(dst, options);
74 }
75 
~Pixmap()76 Pixmap::~Pixmap() {}
77 } // namespace Drawing
78 } // namespace Rosen
79 } // namespace OHOS
80