2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
25 #include <dali/internal/imaging/common/pixel-buffer-impl.h>
31 PixelBuffer PixelBuffer::New(uint32_t width,
33 Dali::Pixel::Format pixelFormat)
35 Internal::Adaptor::PixelBufferPtr internal =
36 Internal::Adaptor::PixelBuffer::New(width, height, pixelFormat);
37 return Devel::PixelBuffer(internal.Get());
40 Dali::PixelData PixelBuffer::Convert(PixelBuffer& pixelBuffer)
42 Dali::PixelData pixelData =
43 Internal::Adaptor::PixelBuffer::Convert(GetImplementation(pixelBuffer));
48 Dali::PixelData PixelBuffer::CreatePixelData() const
50 return GetImplementation(*this).CreatePixelData();
53 PixelBuffer::PixelBuffer()
57 PixelBuffer::~PixelBuffer()
61 PixelBuffer::PixelBuffer(Internal::Adaptor::PixelBuffer* internal)
62 : BaseHandle(internal)
66 PixelBuffer::PixelBuffer(const PixelBuffer& handle) = default;
68 PixelBuffer& PixelBuffer::operator=(const PixelBuffer& rhs) = default;
70 PixelBuffer::PixelBuffer(PixelBuffer&& handle) = default;
72 PixelBuffer& PixelBuffer::operator=(PixelBuffer&& rhs) = default;
74 uint32_t PixelBuffer::GetWidth() const
76 return GetImplementation(*this).GetWidth();
79 uint32_t PixelBuffer::GetHeight() const
81 return GetImplementation(*this).GetHeight();
84 uint32_t PixelBuffer::GetStride() const
86 return GetImplementation(*this).GetStride();
89 Pixel::Format PixelBuffer::GetPixelFormat() const
91 return GetImplementation(*this).GetPixelFormat();
94 uint8_t* PixelBuffer::GetBuffer()
96 return GetImplementation(*this).GetBuffer();
99 const uint8_t* PixelBuffer::GetBuffer() const
101 return GetImplementation(*this).GetConstBuffer();
104 void PixelBuffer::ApplyMask(PixelBuffer mask, float contentScale, bool cropToMask)
106 GetImplementation(*this).ApplyMask(GetImplementation(mask), contentScale, cropToMask);
109 void PixelBuffer::ApplyGaussianBlur(const float blurRadius)
111 GetImplementation(*this).ApplyGaussianBlur(blurRadius);
114 void PixelBuffer::Crop(uint16_t x, uint16_t y, uint16_t width, uint16_t height)
116 GetImplementation(*this).Crop(x, y, ImageDimensions(width, height));
119 void PixelBuffer::Resize(uint16_t width, uint16_t height)
121 GetImplementation(*this).Resize(ImageDimensions(width, height));
124 void PixelBuffer::MultiplyColorByAlpha()
126 GetImplementation(*this).MultiplyColorByAlpha();
129 bool PixelBuffer::GetMetadata(Property::Map& metadata) const
131 return GetImplementation(*this).GetMetadata(metadata);
134 bool PixelBuffer::Rotate(Degree angle)
136 return GetImplementation(*this).Rotate(angle);
139 bool PixelBuffer::IsAlphaPreMultiplied() const
141 return GetImplementation(*this).IsAlphaPreMultiplied();
144 uint32_t PixelBuffer::GetBrightness() const
146 return GetImplementation(*this).GetBrightness();