DALI_TEST_EQUALS( true, visualUrl3.IsValid(), TEST_LOCATION );
DALI_TEST_EQUALS( visualUrl3.GetType(), VisualUrl::GIF, TEST_LOCATION );
DALI_TEST_EQUALS( visualUrl3.GetProtocolType(), VisualUrl::LOCAL, TEST_LOCATION );
-
- VisualUrl visualUrl4("dali://0");
- visualUrl4 = visualUrl;
- DALI_TEST_EQUALS( true, visualUrl4.IsValid(), TEST_LOCATION );
- DALI_TEST_EQUALS( visualUrl4.GetType(), VisualUrl::GIF, TEST_LOCATION );
- DALI_TEST_EQUALS( visualUrl4.GetProtocolType(), VisualUrl::LOCAL, TEST_LOCATION );
-
- VisualUrl visualUrl5("dali://1");
- visualUrl4 = visualUrl5;
- DALI_TEST_EQUALS( true, visualUrl4.IsValid(), TEST_LOCATION );
- DALI_TEST_EQUALS( visualUrl4.GetType(), VisualUrl::REGULAR_IMAGE, TEST_LOCATION );
- DALI_TEST_EQUALS( visualUrl4.GetProtocolType(), VisualUrl::TEXTURE, TEST_LOCATION );
END_TEST;
}
utc-Dali-Image.cpp
utc-Dali-ImageView.cpp
utc-Dali-ImageVisual.cpp
- utc-Dali-ImageUrl.cpp
utc-Dali-JsonParser.cpp
utc-Dali-KeyInputFocusManager.cpp
utc-Dali-PageTurnView.cpp
#include <dali/public-api/rendering/frame-buffer.h>
#include <dali/public-api/adaptor-framework/native-image-source.h>
#include <dali-toolkit/public-api/image-loader/image.h>
-#include <dali-toolkit/public-api/image-loader/image-url.h>
using namespace Dali;
using namespace Dali::Toolkit;
FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
DALI_TEST_CHECK( frameBuffer );
- ImageUrl url = Dali::Toolkit::Image::GenerateUrl( frameBuffer, Pixel::Format::RGBA8888, width, height );
+ std::string url = Dali::Toolkit::Image::GenerateUrl( frameBuffer, Pixel::Format::RGBA8888, width, height );
- DALI_TEST_CHECK( url.GetUrl().size() > 0u );
+ DALI_TEST_CHECK( url.size() > 0u );
END_TEST;
}
Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
frameBuffer.AttachColorTexture( texture );
- DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( frameBuffer, 0 ).GetUrl().size() > 0u );
+ DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( frameBuffer, 0 ).size() > 0u );
END_TEST;
}
unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGB888, PixelData::FREE );
- DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( pixelData ).GetUrl().size() > 0u );
+ DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( pixelData ).size() > 0u );
END_TEST;
}
{
NativeImageSourcePtr nativeImageSource = NativeImageSource::New(width, height, NativeImageSource::COLOR_DEPTH_DEFAULT );
- DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( nativeImageSource ).GetUrl().size() > 0u );
+ DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( nativeImageSource ).size() > 0u );
}
catch(Dali::DaliException& e)
{
+++ /dev/null
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <iostream>
-#include <stdlib.h>
-#include <dali-toolkit-test-suite-utils.h>
-#include <dali-toolkit/public-api/image-loader/image-url.h>
-
-using namespace Dali;
-using namespace Dali::Toolkit;
-
-int UtcImageUrlConstructor(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcImageUrlValid ");
-
- // Test default constructor.
- ImageUrl imageUrl;
- DALI_TEST_CHECK( !imageUrl );
-
- // Test object creation
- Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u); // test texture
- imageUrl = ImageUrl::New(image);
- DALI_TEST_CHECK( imageUrl );
-
- // Test copy constructor
- ImageUrl ImageUrlCopy( imageUrl );
- DALI_TEST_CHECK( ImageUrlCopy );
-
- // Test down cast
- BaseHandle baseUrl;
- baseUrl = imageUrl;
- ImageUrl downcastUrl = ImageUrl::DownCast( baseUrl );
- DALI_TEST_CHECK( downcastUrl );
- END_TEST;
-}
\ No newline at end of file
#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
#include <dali-toolkit/public-api/image-loader/image.h>
-#include <dali-toolkit/public-api/image-loader/image-url.h>
#include <dali-toolkit/dali-toolkit.h>
#include "dummy-control.h"
tet_infoline( "Use Native Image as url" );
NativeImageSourcePtr nativeImageSource = NativeImageSource::New(500, 500, NativeImageSource::COLOR_DEPTH_DEFAULT);
- ImageUrl imageUrl = Dali::Toolkit::Image::GenerateUrl(nativeImageSource);
- std::string url = imageUrl.GetUrl();
+ std::string url = Dali::Toolkit::Image::GenerateUrl(nativeImageSource);
VisualFactory factory = VisualFactory::Get();
DALI_TEST_CHECK( factory );
END_TEST;
}
-int UtcDaliImageVisualWithNativeImageRemoved(void)
-{
- ToolkitTestApplication application;
- tet_infoline( "Use Native Image as url" );
-
- NativeImageSourcePtr nativeImageSource = NativeImageSource::New(500, 500, NativeImageSource::COLOR_DEPTH_DEFAULT);
- ImageUrl imageUrl = Dali::Toolkit::Image::GenerateUrl(nativeImageSource);
- std::string url = imageUrl.GetUrl();
-
- VisualFactory factory = VisualFactory::Get();
- DALI_TEST_CHECK( factory );
-
- Property::Map propertyMap;
- propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::IMAGE );
- propertyMap.Insert( ImageVisual::Property::URL, url );
-
- Visual::Base visual = factory.CreateVisual( propertyMap );
- DALI_TEST_CHECK( visual );
-
- DummyControl actor = DummyControl::New();
- DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
-
- DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
-
- application.GetScene().Add( actor );
-
- DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
-
- // For Coverage
- imageUrl.Reset();
- application.GetScene().Remove( actor );
- actor.Reset();
-
- END_TEST;
-}
-
int UtcDaliImageVisualTextureReuse1(void)
{
ToolkitTestApplication application;
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/public-api/image-loader/image.h>
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
-#include <dali-toolkit/public-api/image-loader/image-url.h>
namespace Dali
{
return Dali::Toolkit::ImageView();
}
- Dali::Toolkit::ImageUrl url = Dali::Toolkit::Image::GenerateUrl(pixel);
- Dali::Toolkit::ImageView imageView = Dali::Toolkit::ImageView::New(url.GetUrl());
+ std::string url = Dali::Toolkit::Image::GenerateUrl(pixel);
+ Dali::Toolkit::ImageView imageView = Dali::Toolkit::ImageView::New(url);
imageView.SetProperty(Dali::Actor::Property::SIZE, Vector2(pixel.GetWidth(), pixel.GetHeight()));
return imageView;
}
${toolkit_src_dir}/image-loader/atlas-packer.cpp
${toolkit_src_dir}/image-loader/image-atlas-impl.cpp
${toolkit_src_dir}/image-loader/image-load-thread.cpp
- ${toolkit_src_dir}/image-loader/image-url-impl.cpp
${toolkit_src_dir}/styling/style-manager-impl.cpp
${toolkit_src_dir}/text/bidirectional-support.cpp
${toolkit_src_dir}/text/character-set-conversion.cpp
+++ /dev/null
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali-toolkit/devel-api/image-loader/texture-manager.h>
-#include <dali-toolkit/internal/image-loader/image-url-impl.h>
-
-namespace Dali
-{
-namespace Toolkit
-{
-namespace Internal
-{
-ImageUrl::ImageUrl(Texture& texture)
-: mUrl("")
-{
- mUrl = Dali::Toolkit::TextureManager::AddTexture(texture);
-}
-
-ImageUrl::~ImageUrl()
-{
- Dali::Toolkit::TextureManager::RemoveTexture(mUrl);
-}
-
-ImageUrlPtr ImageUrl::New(Texture& texture)
-{
- ImageUrlPtr imageUrlPtr = new ImageUrl(texture);
- return imageUrlPtr;
-}
-
-const std::string& ImageUrl::GetUrl() const
-{
- return mUrl;
-}
-
-} // End of namespace Internal
-
-} // End of namespace Toolkit
-
-} // End of namespace Dali
+++ /dev/null
-#ifndef DALI_TOOLKIT_INTERNAL_IMAGE_URL_H
-#define DALI_TOOLKIT_INTERNAL_IMAGE_URL_H
-
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/object/base-object.h>
-#include <string>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/image-loader/image-url.h>
-
-namespace Dali
-{
-namespace Toolkit
-{
-namespace Internal
-{
-class ImageUrl;
-using ImageUrlPtr = IntrusivePtr<ImageUrl>;
-
-class ImageUrl : public BaseObject
-{
-public:
- /**
- * @brief Constructor.
- */
- ImageUrl(Texture& texture);
-
- /**
- * @copydoc Dali::Toolkit::ImageUrl::New
- */
- static ImageUrlPtr New(Texture& texture);
-
- /**
- * @copydoc Dali::Toolkit::ImageUrl::GetUrl
- */
- const std::string& GetUrl() const;
-
-protected:
- /**
- * @brief A reference counted object may only be deleted by calling Unreference()
- */
- virtual ~ImageUrl();
-
-private:
- // Undefined
- ImageUrl(const ImageUrl&);
-
- // Undefined
- ImageUrl& operator=(const ImageUrl& rhs);
-
-private:
- std::string mUrl;
-};
-
-} // namespace Internal
-} // namespace Toolkit
-
-// Helpers for public-api forwarding methods
-
-inline Toolkit::Internal::ImageUrl& GetImpl(Dali::Toolkit::ImageUrl& imageUrl)
-{
- DALI_ASSERT_ALWAYS(imageUrl && "ImageUrl handle is empty");
-
- BaseObject& handle = imageUrl.GetBaseObject();
-
- return static_cast<Toolkit::Internal::ImageUrl&>(handle);
-}
-
-inline const Toolkit::Internal::ImageUrl& GetImpl(const Dali::Toolkit::ImageUrl& imageUrl)
-{
- DALI_ASSERT_ALWAYS(imageUrl && "ImageUrl handle is empty");
-
- const BaseObject& handle = imageUrl.GetBaseObject();
-
- return static_cast<const Toolkit::Internal::ImageUrl&>(handle);
-}
-
-} // End of namespace Dali
-
-#endif // DALI_TOOLKIT_INTERNAL_IMAGE_URL_H
void TextureManager::Remove(const TextureManager::TextureId textureId, TextureUploadObserver* observer)
{
int textureInfoIndex = GetCacheIndexFromId(textureId);
-
if(textureInfoIndex != INVALID_INDEX)
{
TextureInfo& textureInfo(mTextureInfoContainer[textureInfoIndex]);
info.textureId = GenerateUniqueTextureId();
info.textureSet = textureSet;
mExternalTextures.emplace_back(info);
-
return VisualUrl::CreateTextureUrl(std::to_string(info.textureId));
}
if(url.size() > 0u)
{
// get the location from the Url
- if(VisualUrl::TEXTURE == VisualUrl::GetProtocolType(url))
+ VisualUrl parseUrl(url);
+ if(VisualUrl::TEXTURE == parseUrl.GetProtocolType())
{
- std::string location = VisualUrl::GetLocation(url);
+ std::string location = parseUrl.GetLocation();
if(location.size() > 0u)
{
TextureId id = std::stoi(location);
if(iter->textureId == id)
{
auto textureSet = iter->textureSet;
- if(--(iter->referenceCount) <= 0)
- {
- mExternalTextures.erase(iter);
- }
+ mExternalTextures.erase(iter);
return textureSet;
}
}
return TextureSet();
}
-void TextureManager::UseExternalTexture(const VisualUrl& url)
-{
- if(VisualUrl::TEXTURE == url.GetProtocolType())
- {
- std::string location = url.GetLocation();
- if(location.size() > 0u)
- {
- TextureId id = std::stoi(location);
- for(auto&& elem : mExternalTextures)
- {
- if(elem.textureId == id)
- {
- elem.referenceCount++;
- return;
- }
- }
- }
- }
-}
-
void TextureManager::AddObserver(TextureManager::LifecycleObserver& observer)
{
// make sure an observer doesn't observe the same object twice
TextureSet RemoveExternalTexture(const std::string& url);
/**
- * @brief Notify that external textures are used.
- * @param[in] url The URL of the texture to use.
- */
- void UseExternalTexture(const VisualUrl& url);
-
- /**
* Add an observer to the object.
* @param[in] observer The observer to add.
*/
{
TextureId textureId;
TextureSet textureSet;
- int16_t referenceCount{1};
};
private:
// EXTERNAL HEADERS
#include <cstring> // for toupper()
-// INTERNAL HEADERS
-#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
-#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
-
namespace Dali
{
namespace Toolkit
// TEXTURE location url doesn't need type resolving, REGULAR_IMAGE is fine
mType = ResolveType(url);
}
- else
- {
- Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
- if(factory)
- {
- GetImplementation(factory).GetTextureManager().UseExternalTexture(*this);
- }
- }
}
}
mType(url.mType),
mLocation(url.mLocation)
{
- if(VisualUrl::TEXTURE == mLocation)
- {
- Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
- if(factory)
- {
- GetImplementation(factory).GetTextureManager().UseExternalTexture(*this);
- }
- }
-}
-
-VisualUrl::~VisualUrl()
-{
- if(VisualUrl::TEXTURE == mLocation)
- {
- Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
- if(factory)
- {
- GetImplementation(factory).GetTextureManager().RemoveExternalTexture(mUrl);
- }
- }
}
VisualUrl& VisualUrl::operator=(const VisualUrl& url)
{
if(&url != this)
{
- if(VisualUrl::TEXTURE == mLocation)
- {
- Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
- if(factory)
- {
- GetImplementation(factory).GetTextureManager().RemoveExternalTexture(mUrl);
- }
- }
-
mUrl = url.mUrl;
mType = url.mType;
mLocation = url.mLocation;
-
- if(VisualUrl::TEXTURE == mLocation)
- {
- Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
- if(factory)
- {
- GetImplementation(factory).GetTextureManager().UseExternalTexture(*this);
- }
- }
}
return *this;
}
std::string VisualUrl::GetLocation() const
{
- return GetLocation(mUrl);
+ const auto location = mUrl.find("://");
+ if(std::string::npos != location)
+ {
+ return mUrl.substr(location + 3u); // 3 characters forwards from the start of ://
+ }
+ return mUrl;
}
std::string VisualUrl::CreateTextureUrl(const std::string& location)
return "dali://" + location;
}
-VisualUrl::ProtocolType VisualUrl::GetProtocolType(const std::string& url)
-{
- return ResolveLocation(url);
-}
-
-std::string VisualUrl::GetLocation(const std::string& url)
-{
- const auto location = url.find("://");
- if(std::string::npos != location)
- {
- return url.substr(location + 3u); // 3 characters forwards from the start of ://
- }
- return url;
-}
-
-
} // namespace Internal
} // namespace Toolkit
VisualUrl();
/**
- * Default Destructor.
- * Delete an external texture if if protocolType is TEXTURE.
- */
- ~VisualUrl();
-
- /**
* Constructor.
* Determines type of visual and whether the url is local or remote
- * Notify that it is using an external texture if if protocolType is TEXTURE.
- *
* @param[in] url The URL to store and resolve
*/
VisualUrl(const std::string& url);
*/
static std::string CreateTextureUrl(const std::string& location);
- /**
- * Helper to get a ProtocolType from url
- * @param url the url of the texture
- * @return the protocol type
- */
- static VisualUrl::ProtocolType GetProtocolType(const std::string& url);
-
- /**
- * Helper to get a location from url
- * @param url the location of the texture
- * @return the location
- */
- static std::string GetLocation(const std::string& url);
private:
std::string mUrl;
Type mType;
${public_api_src_dir}/controls/video-view/video-view.cpp
${public_api_src_dir}/controls/camera-view/camera-view.cpp
${public_api_src_dir}/image-loader/image.cpp
- ${public_api_src_dir}/image-loader/image-url.cpp
${public_api_src_dir}/image-loader/async-image-loader.cpp
${public_api_src_dir}/image-loader/sync-image-loader.cpp
${public_api_src_dir}/styling/style-manager.cpp
SET( public_api_image_loader_header_files
${public_api_src_dir}/image-loader/image.h
- ${public_api_src_dir}/image-loader/image-url.h
${public_api_src_dir}/image-loader/async-image-loader.h
${public_api_src_dir}/image-loader/sync-image-loader.h
)
+++ /dev/null
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// CLASS HEADER
-#include <dali-toolkit/public-api/image-loader/image-url.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/image-loader/image-url-impl.h>
-
-namespace Dali
-{
-namespace Toolkit
-{
-ImageUrl::ImageUrl()
-{
-}
-
-ImageUrl::~ImageUrl()
-{
-}
-
-ImageUrl ImageUrl::New(Texture& texture)
-{
- Toolkit::Internal::ImageUrlPtr internal = Toolkit::Internal::ImageUrl::New(texture);
- return ImageUrl(internal.Get());
-}
-
-ImageUrl ImageUrl::DownCast(BaseHandle handle)
-{
- return ImageUrl(dynamic_cast<Toolkit::Internal::ImageUrl*>(handle.GetObjectPtr()));
-}
-
-ImageUrl::ImageUrl(const ImageUrl& rhs) = default;
-
-ImageUrl& ImageUrl::operator=(const ImageUrl& url) = default;
-
-ImageUrl::ImageUrl(ImageUrl&& rhs) = default;
-
-ImageUrl& ImageUrl::operator=(ImageUrl&& rhs) = default;
-
-const std::string& ImageUrl::GetUrl() const
-{
- return GetImpl(*this).GetUrl();
-}
-
-ImageUrl::ImageUrl(Toolkit::Internal::ImageUrl* internal)
-: BaseHandle(internal)
-{
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_TOOLKIT_IMAGE_URL_H
-#define DALI_TOOLKIT_IMAGE_URL_H
-
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// EXTERNAL INCLUDES
-#include <string>
-#include <dali/public-api/rendering/texture.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/dali-toolkit-common.h>
-
-namespace Dali
-{
-namespace Toolkit
-{
-namespace Internal DALI_INTERNAL
-{
-class ImageUrl;
-}
-/**
- * @brief ImageUrl is a class for wrapping url that is get from external buffer.
- * An instance of ImageUrl can be created from GenerateUrl().
- * Application can get the ImageUrl at this time and use it by getting url from ImageUrl.
- * When application does not use this anymore, the destructor of the ImageUrl is called.
- * At this time, the buffer is deleted from the texture manager.
- */
-class DALI_TOOLKIT_API ImageUrl : public BaseHandle
-{
-public:
- /**
- * Default Constructor.
- * Resulting URL is not valid
- */
- ImageUrl();
-
- /**
- * Destructor
- */
- ~ImageUrl();
-
- /**
- * @brief Create an initialized ImageUrl.
- *
- * @param[in] texture The texture url is got from external buffer.
- * @return A handle to a newly allocated Dali resource.
- */
- static ImageUrl New(Texture& texture);
-
- /**
- * @brief Downcast an Object handle to ImageUrl handle.
- *
- * If handle points to a ImageUrl object the downcast produces valid
- * handle. If not the returned handle is left uninitialized.
- *
- * @param[in] handle to An object.
- * @return handle to a ImageUrl object or an uninitialized handle.
- */
- static ImageUrl DownCast(BaseHandle handle);
-
- /**
- * Copy constructor
- * @param[in] url The url to copy
- */
- ImageUrl(const ImageUrl& url);
-
- /**
- * Assignment operator
- * @param[in] url The url to copy
- */
- ImageUrl& operator=(const ImageUrl& url);
-
- /**
- * @brief Move constructor.
- * @param[in] rhs A reference to the moved handle
- */
- ImageUrl(ImageUrl&& rhs);
-
- /**
- * @brief Move assignment operator.
- * @param[in] rhs A reference to the moved handle
- * @return A reference to this handle
- */
- ImageUrl& operator=(ImageUrl&& rhs);
-
- /**
- * Get the url
- * @return Returns url's string
- */
- const std::string& GetUrl() const;
-
-public: // Not intended for application developers
- /// @cond internal
- /**
- * @brief This constructor is used by New() methods.
- *
- * @param[in] internal A pointer to a newly allocated Dali resource.
- */
- explicit DALI_INTERNAL ImageUrl(Toolkit::Internal::ImageUrl* internal);
- /// @endcond
-};
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif /* DALI_TOOLKIT_IMAGE_URL_H */
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/image-loader/texture-manager.h>
-#include <dali-toolkit/public-api/image-loader/image-url.h>
// EXTERNAL INCLUDES
#include <dali/devel-api/rendering/frame-buffer-devel.h>
{
namespace Image
{
-Dali::Toolkit::ImageUrl GenerateUrl(Dali::FrameBuffer frameBuffer, Pixel::Format pixelFormat, uint32_t width, uint32_t height)
+std::string GenerateUrl(Dali::FrameBuffer frameBuffer, Pixel::Format pixelFormat, uint32_t width, uint32_t height)
{
Texture texture = Texture::New(Dali::TextureType::TEXTURE_2D, pixelFormat, width, height);
frameBuffer.AttachColorTexture(texture, 0u, 0u);
- Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture);
- return imageUrl;
+ return Dali::Toolkit::TextureManager::AddTexture(texture);
}
-Dali::Toolkit::ImageUrl GenerateUrl(const Dali::FrameBuffer frameBuffer, uint8_t index)
+std::string GenerateUrl(const Dali::FrameBuffer frameBuffer, uint8_t index)
{
Texture texture = Dali::DevelFrameBuffer::GetColorTexture(frameBuffer, index);
- Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture);
- return imageUrl;
+ return Dali::Toolkit::TextureManager::AddTexture(texture);
}
-Dali::Toolkit::ImageUrl GenerateUrl(const Dali::PixelData pixelData)
+std::string GenerateUrl(const Dali::PixelData pixelData)
{
Texture texture = Texture::New(TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight());
texture.Upload(pixelData);
- Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture);
- return imageUrl;
+ return Dali::Toolkit::TextureManager::AddTexture(texture);
}
-Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource)
+std::string GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource)
{
Texture texture = Dali::Texture::New(*nativeImageSource);
- Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture);
- return imageUrl;
+ return Dali::Toolkit::TextureManager::AddTexture(texture);
}
} // namespace Image
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/dali-toolkit-common.h>
-#include <dali-toolkit/public-api/image-loader/image-url.h>
namespace Dali
{
* @param[in] pixelFormat the pixel format for this frame buffer
* @param[in] width the width for this frame buffer
* @param[in] height the height for this frame buffer
- * @return the ImageUrl representing this frame buffer
+ * @return the Url string representing this frame buffer
*/
-DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::FrameBuffer frameBuffer, Pixel::Format pixelFormat, uint32_t width, uint32_t height);
+DALI_TOOLKIT_API std::string GenerateUrl(const Dali::FrameBuffer frameBuffer, Pixel::Format pixelFormat, uint32_t width, uint32_t height);
/**
* @brief Generate a Url from frame buffer.
* This method does not check for duplicates, If same frame buffer is entered multiple times, a different URL is returned each time.
* @param[in] frameBuffer the frame buffer to converted to Url
* @param[in] index the index of the attached color texture.
- * @return the ImageUrl representing this frame buffer
+ * @return the Url string representing this frame buffer
*/
-DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::FrameBuffer frameBuffer, uint8_t index);
+DALI_TOOLKIT_API std::string GenerateUrl(const Dali::FrameBuffer frameBuffer, uint8_t index);
/**
* @brief Generate a Url from Pixel data.
* This Url can be used in visuals to render the pixel data.
* @note This method does not check for duplicates, If same pixel data is entered multiple times, a different URL is returned each time.
* @param[in] pixelData the pixel data to converted to Url
- * @return the ImageUrl representing this pixel data
+ * @return the Url string representing this pixel data
*/
-DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::PixelData pixelData);
+DALI_TOOLKIT_API std::string GenerateUrl(const Dali::PixelData pixelData);
/**
* @brief Generate a Url from native image source.
* This Url can be used in visuals to render the native image source.
* @note This method does not check for duplicates, If same native image source is entered multiple times, a different URL is returned each time.
* @param[in] nativeImageSource the native image source to converted to Url
- * @return the ImageUrl representing this native image source
+ * @return the Url string representing this native image source
*/
-DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource);
+DALI_TOOLKIT_API std::string GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource);
} // namespace Image