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/public-api/adaptor-framework/native-image-source.h>
22 #include <dali/public-api/object/any.h>
25 #include <dali/internal/imaging/common/native-image-source-impl.h>
26 #include <dali/internal/imaging/common/native-image-source-factory.h>
31 NativeImageSourcePtr NativeImageSource::New( unsigned int width, unsigned int height, ColorDepth depth )
34 NativeImageSourcePtr image = new NativeImageSource( width, height, depth, empty );
38 Any NativeImageSource::GetNativeImageSource()
40 return mImpl->GetNativeImageSource();
43 NativeImageSourcePtr NativeImageSource::New( Any nativeImageSource )
45 NativeImageSourcePtr image = new NativeImageSource(0, 0, COLOR_DEPTH_DEFAULT, nativeImageSource);
49 bool NativeImageSource::GetPixels( std::vector<unsigned char> &pixbuf, unsigned int &width, unsigned int &height, Pixel::Format& pixelFormat ) const
51 return mImpl->GetPixels( pixbuf, width, height, pixelFormat );
54 bool NativeImageSource::EncodeToFile(const std::string& filename) const
56 return mImpl->EncodeToFile(filename);
59 void NativeImageSource::SetSource( Any source )
61 mImpl->SetSource( source );
64 bool NativeImageSource::IsColorDepthSupported( ColorDepth colorDepth )
66 return mImpl->IsColorDepthSupported( colorDepth );
69 bool NativeImageSource::GlExtensionCreate()
71 return mImpl->GlExtensionCreate();
74 void NativeImageSource::GlExtensionDestroy()
76 mImpl->GlExtensionDestroy();
79 unsigned int NativeImageSource::TargetTexture()
81 return mImpl->TargetTexture();
84 void NativeImageSource::PrepareTexture()
86 mImpl->PrepareTexture();
89 unsigned int NativeImageSource::GetWidth() const
91 return mImpl->GetWidth();
94 unsigned int NativeImageSource::GetHeight() const
96 return mImpl->GetHeight();
99 bool NativeImageSource::RequiresBlending() const
101 return mImpl->RequiresBlending();
104 NativeImageInterface::Extension* NativeImageSource::GetExtension()
106 return mImpl->GetNativeImageInterfaceExtension();
109 NativeImageSource::NativeImageSource( unsigned int width, unsigned int height, ColorDepth depth, Any nativeImageSource )
111 auto factory = Dali::Internal::Adaptor::GetNativeImageSourceFactory();
112 mImpl = factory->CreateNativeImageSource( width, height, depth, nativeImageSource ).release();
115 NativeImageSource::~NativeImageSource()