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/public-api/rendering/texture.h> // Dali::Texture
22 #include <dali/internal/event/rendering/texture-impl.h> // Dali::Internal::Texture
23 #include <dali/internal/event/images/pixel-data-impl.h> // Dali::Internal::PixelData
29 Texture Texture::New( TextureType::Type type, Pixel::Format format, unsigned int width, unsigned int height )
31 Internal::NewTexturePtr texture = Internal::NewTexture::New(type, format, width, height );
32 return Texture( texture.Get() );
35 Texture Texture::New( NativeImageInterface& nativeImageInterface )
37 Internal::NewTexturePtr texture = Internal::NewTexture::New( nativeImageInterface );
38 return Texture( texture.Get() );
49 Texture::Texture( const Texture& handle )
50 : BaseHandle( handle )
54 Texture Texture::DownCast( BaseHandle handle )
56 return Texture( dynamic_cast<Dali::Internal::NewTexture*>(handle.GetObjectPtr()));
59 Texture& Texture::operator=( const Texture& handle )
61 BaseHandle::operator=( handle );
65 bool Texture::Upload( PixelData pixelData )
67 Internal::PixelData& internalPixelData = GetImplementation( pixelData );
68 return GetImplementation(*this).Upload( &internalPixelData );
71 bool Texture::Upload( PixelData pixelData,
72 unsigned int layer, unsigned int mipmap,
73 unsigned int xOffset, unsigned int yOffset,
74 unsigned int width, unsigned int height )
76 Internal::PixelData& internalPixelData = GetImplementation( pixelData );
77 return GetImplementation(*this).Upload( &internalPixelData, layer, mipmap, xOffset, yOffset, width, height );
80 void Texture::GenerateMipmaps()
82 return GetImplementation(*this).GenerateMipmaps();
85 unsigned int Texture::GetWidth() const
87 return GetImplementation(*this).GetWidth();
90 unsigned int Texture::GetHeight() const
92 return GetImplementation(*this).GetHeight();
95 Texture::Texture( Internal::NewTexture* pointer )
96 : BaseHandle( pointer )