2 * Copyright (c) 2018 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>
32 PixelBuffer PixelBuffer::New( unsigned int width,
34 Dali::Pixel::Format pixelFormat )
36 Internal::Adaptor::PixelBufferPtr internal =
37 Internal::Adaptor::PixelBuffer::New( width, height, pixelFormat );
38 return Devel::PixelBuffer( internal.Get() );
41 Dali::PixelData PixelBuffer::Convert( PixelBuffer& pixelBuffer )
43 Dali::PixelData pixelData =
44 Internal::Adaptor::PixelBuffer::Convert( GetImplementation(pixelBuffer) );
49 Dali::PixelData PixelBuffer::CreatePixelData() const
51 return GetImplementation(*this).CreatePixelData();
55 PixelBuffer::PixelBuffer()
59 PixelBuffer::~PixelBuffer()
63 PixelBuffer::PixelBuffer( Internal::Adaptor::PixelBuffer* internal )
64 : BaseHandle( internal )
68 PixelBuffer::PixelBuffer(const PixelBuffer& handle)
69 : BaseHandle( handle )
73 PixelBuffer& PixelBuffer::operator=(const PixelBuffer& rhs)
75 BaseHandle::operator=(rhs);
79 unsigned int PixelBuffer::GetWidth() const
81 return GetImplementation(*this).GetWidth();
84 unsigned int PixelBuffer::GetHeight() const
86 return GetImplementation(*this).GetHeight();
89 Pixel::Format PixelBuffer::GetPixelFormat() const
91 return GetImplementation(*this).GetPixelFormat();
94 unsigned char* PixelBuffer::GetBuffer()
96 return GetImplementation(*this).GetBuffer();
99 const unsigned char* const 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();