2 * Copyright (c) 2016 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/rendering/texture.h> // Dali::Texture
22 #include <dali/internal/event/rendering/texture-impl.h> // Dali::Internal::Texture
28 Texture Texture::New( TextureType::Type type, Pixel::Format format, unsigned int width, unsigned int height )
30 Internal::NewTexturePtr texture = Internal::NewTexture::New(type, format, width, height );
31 return Texture( texture.Get() );
34 Texture Texture::New( NativeImageInterface& nativeImageInterface )
36 Internal::NewTexturePtr texture = Internal::NewTexture::New( nativeImageInterface );
37 return Texture( texture.Get() );
48 Texture::Texture( const Texture& handle )
49 : BaseHandle( handle )
53 Texture Texture::DownCast( BaseHandle handle )
55 return Texture( dynamic_cast<Dali::Internal::NewTexture*>(handle.GetObjectPtr()));
58 Texture& Texture::operator=( const Texture& handle )
60 BaseHandle::operator=( handle );
64 void Texture::Upload( Vector<unsigned char>& buffer )
66 return GetImplementation(*this).Upload( buffer );
69 void Texture::Upload( Vector<unsigned char>& buffer,
70 unsigned int layer, unsigned int mipmap,
71 unsigned int xOffset, unsigned int yOffset,
72 unsigned int width, unsigned int height )
74 return GetImplementation(*this).Upload( buffer, layer, mipmap, xOffset, yOffset, width, height );
77 void Texture::Upload( PixelData pixelData )
79 //TODO: Implement this method once PixelData uses handle/body pattern
80 DALI_ASSERT_ALWAYS( false && "Not implemented yet");
83 void Texture::GenerateMipmaps()
85 return GetImplementation(*this).GenerateMipmaps();
88 unsigned int Texture::GetWidth() const
90 return GetImplementation(*this).GetWidth();
93 unsigned int Texture::GetHeight() const
95 return GetImplementation(*this).GetHeight();
98 Texture::Texture( Internal::NewTexture* pointer )
99 : BaseHandle( pointer )