2 * Copyright (c) 2020 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(unsigned int 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)
71 PixelBuffer& PixelBuffer::operator=(const PixelBuffer& rhs)
73 BaseHandle::operator=(rhs);
77 unsigned int PixelBuffer::GetWidth() const
79 return GetImplementation(*this).GetWidth();
82 unsigned int PixelBuffer::GetHeight() const
84 return GetImplementation(*this).GetHeight();
87 Pixel::Format PixelBuffer::GetPixelFormat() const
89 return GetImplementation(*this).GetPixelFormat();
92 unsigned char* PixelBuffer::GetBuffer()
94 return GetImplementation(*this).GetBuffer();
97 const unsigned char* const PixelBuffer::GetBuffer() const
99 return GetImplementation(*this).GetConstBuffer();
102 void PixelBuffer::ApplyMask(PixelBuffer mask, float contentScale, bool cropToMask)
104 GetImplementation(*this).ApplyMask(GetImplementation(mask), contentScale, cropToMask);
107 void PixelBuffer::ApplyGaussianBlur(const float blurRadius)
109 GetImplementation(*this).ApplyGaussianBlur(blurRadius);
112 void PixelBuffer::Crop(uint16_t x, uint16_t y, uint16_t width, uint16_t height)
114 GetImplementation(*this).Crop(x, y, ImageDimensions(width, height));
117 void PixelBuffer::Resize(uint16_t width, uint16_t height)
119 GetImplementation(*this).Resize(ImageDimensions(width, height));
122 void PixelBuffer::MultiplyColorByAlpha()
124 GetImplementation(*this).MultiplyColorByAlpha();
127 bool PixelBuffer::GetMetadata(Property::Map& metadata) const
129 return GetImplementation(*this).GetMetadata(metadata);
132 bool PixelBuffer::Rotate(Degree angle)
134 return GetImplementation(*this).Rotate(angle);
137 bool PixelBuffer::IsAlphaPreMultiplied() const
139 return GetImplementation(*this).IsAlphaPreMultiplied();