Dali 3D User Interface Engine
List of all members | Public Member Functions
Dali::Integration::PlatformAbstraction Class Referenceabstract

PlatformAbstraction is an abstract interface, used by Dali to access platform specific services. More...

#include <platform-abstraction.h>

Inheritance diagram for Dali::Integration::PlatformAbstraction:
Inheritance graph
[legend]

Public Member Functions

virtual ~PlatformAbstraction ()
 Virtual destructor. More...
 
virtual void Suspend ()=0
 Tell the platform abstraction that Dali is ready to pause, such as when the application enters a background state. More...
 
virtual void Resume ()=0
 Tell the platform abstraction that Dali is resuming from a pause, such as when it has transitioned from a background state to a foreground one. More...
 
virtual ImageDimensions GetClosestImageSize (const std::string &filename, ImageDimensions size=ImageDimensions(0, 0), FittingMode::Type fittingMode=FittingMode::SHRINK_TO_FIT, SamplingMode::Type samplingMode=SamplingMode::BOX, bool orientationCorrection=true)=0
 Determine the size of an image the resource loaders will provide when given the same image loading parameters. More...
 
virtual ImageDimensions GetClosestImageSize (ResourcePointer resourceBuffer, ImageDimensions size=ImageDimensions(0, 0), FittingMode::Type fittingMode=FittingMode::SHRINK_TO_FIT, SamplingMode::Type samplingMode=SamplingMode::BOX, bool orientationCorrection=true)=0
 Determine the size of an image the resource loaders will provide when given the same image loading parameters. More...
 
virtual void LoadResource (const ResourceRequest &request)=0
 Request a resource from the native filesystem. More...
 
virtual ResourcePointer LoadResourceSynchronously (const ResourceType &resourceType, const std::string &resourcePath)=0
 Request a resource from the native filesystem. More...
 
virtual BitmapPtr DecodeBuffer (const ResourceType &resourceType, uint8_t *buffer, size_t bufferSize)=0
 Decode a buffer of data synchronously. More...
 
virtual void CancelLoad (ResourceId id, ResourceTypeId typeId)=0
 Cancel an ongoing LoadResource() request. More...
 
virtual void GetResources (ResourceCache &cache)=0
 Retrieve newly loaded resources. More...
 
virtual void JoinLoaderThreads ()=0
 Waits for the asynchronous loader threads (if any) to finish. More...
 
virtual int GetDefaultFontSize () const =0
 Called by Dali to retrieve the default font size for the platform. More...
 
virtual bool LoadFile (const std::string &filename, Dali::Vector< unsigned char > &buffer) const =0
 Load a file into a buffer. More...
 
virtual bool LoadShaderBinaryFile (const std::string &filename, Dali::Vector< unsigned char > &buffer) const =0
 Load a shader binary file into a buffer. More...
 
virtual bool SaveShaderBinaryFile (const std::string &filename, const unsigned char *buffer, unsigned int numBytes) const =0
 Save a shader binary file to the resource file system. More...
 

Detailed Description

PlatformAbstraction is an abstract interface, used by Dali to access platform specific services.

A concrete implementation must be created for each platform, and provided when creating the Dali::Integration::Core object.

Definition at line 39 of file platform-abstraction.h.

Constructor & Destructor Documentation

virtual Dali::Integration::PlatformAbstraction::~PlatformAbstraction ( )
inlinevirtual

Virtual destructor.

Definition at line 46 of file platform-abstraction.h.

Member Function Documentation

virtual void Dali::Integration::PlatformAbstraction::CancelLoad ( ResourceId  id,
ResourceTypeId  typeId 
)
pure virtual

Cancel an ongoing LoadResource() request.

Multi-threading note: this method will be called from the main thread only i.e. not from within the Core::Render() method.

Parameters
[in]idThe ID of the resource to cancel.
[in]typeIdThe ID type of the resource to cancel.

Implemented in Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, and Dali::TizenPlatform::TizenPlatformAbstraction.

Referenced by UtcDaliCancelAllLoads(), and UtcDaliCancelSomeLoads().

Here is the caller graph for this function:

virtual BitmapPtr Dali::Integration::PlatformAbstraction::DecodeBuffer ( const ResourceType resourceType,
uint8_t *  buffer,
size_t  bufferSize 
)
pure virtual

Decode a buffer of data synchronously.

Parameters
[in]resourceTypeThe type of resource to load
[in]bufferThe decoded data
[in]bufferSizeThe size of the buffer used by the decoded data.
Returns
A pointer to the decoded buffer.

Implemented in Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, and Dali::TizenPlatform::TizenPlatformAbstraction.

Referenced by Dali::Internal::EncodedBufferImage::New().

Here is the caller graph for this function:

virtual ImageDimensions Dali::Integration::PlatformAbstraction::GetClosestImageSize ( const std::string &  filename,
ImageDimensions  size = ImageDimensions(0, 0),
FittingMode::Type  fittingMode = FittingMode::SHRINK_TO_FIT,
SamplingMode::Type  samplingMode = SamplingMode::BOX,
bool  orientationCorrection = true 
)
pure virtual

Determine the size of an image the resource loaders will provide when given the same image loading parameters.

This is a synchronous request. This function is used to determine the size of an image before it has loaded.

Parameters
[in]filenamename of the image.
[in]sizeThe requested size for the image.
[in]fittingModeThe method to use to map the source image to the desired dimensions.
[in]samplingModeThe image filter to use if the image needs to be downsampled to the requested size.
[in]orientationCorrectionWhether to use image metadata to rotate or flip the image, e.g., from portrait to landscape.
Returns
dimensions that image will have if it is loaded with given parameters.

Implemented in Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, and Dali::TizenPlatform::TizenPlatformAbstraction.

Referenced by Dali::ResourceImage::GetImageSize(), Dali::Internal::ImageFactory::GetImageSize(), Dali::Internal::EncodedBufferImage::New(), and Dali::Internal::ImageFactory::Reload().

Here is the caller graph for this function:

virtual ImageDimensions Dali::Integration::PlatformAbstraction::GetClosestImageSize ( ResourcePointer  resourceBuffer,
ImageDimensions  size = ImageDimensions(0, 0),
FittingMode::Type  fittingMode = FittingMode::SHRINK_TO_FIT,
SamplingMode::Type  samplingMode = SamplingMode::BOX,
bool  orientationCorrection = true 
)
pure virtual

Determine the size of an image the resource loaders will provide when given the same image loading parameters.

This is a synchronous request. This function is used to determine the size of an image before it has loaded.

Parameters
[in]filenamename of the image.
[in]sizeThe requested size for the image.
[in]fittingModeThe method to use to map the source image to the desired dimensions.
[in]samplingModeThe image filter to use if the image needs to be downsampled to the requested size.
[in]orientationCorrectionWhether to use image metadata to rotate or flip the image, e.g., from portrait to landscape.
Returns
dimensions that image will have if it is loaded with given parameters.

Implemented in Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, and Dali::TizenPlatform::TizenPlatformAbstraction.

virtual int Dali::Integration::PlatformAbstraction::GetDefaultFontSize ( ) const
pure virtual

Called by Dali to retrieve the default font size for the platform.

This is an accessibility size, which is mapped to a UI Control specific point-size in stylesheets. For example if zero the smallest size, this could potentially map to TextLabel point-size 8. Multi-threading note: this method will be called from the main thread only i.e. not from within the Core::Render() method.

Returns
The default font size.

Implemented in Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, and Dali::TizenPlatform::TizenPlatformAbstraction.

Referenced by Dali::Internal::Adaptor::StyleMonitor::StyleChanged(), and Dali::Internal::Adaptor::StyleMonitor::StyleMonitor().

Here is the caller graph for this function:

virtual void Dali::Integration::PlatformAbstraction::GetResources ( ResourceCache cache)
pure virtual

Retrieve newly loaded resources.

If no resources have finished loading, then this method returns immediately. Multi-threading note: this method will be called from the update thread, from within the UpdateManager::Update() method.

Parameters
[in]cacheThe resource cache to fill.

Implemented in Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, and Dali::TizenPlatform::TizenPlatformAbstraction.

Referenced by Dali::Internal::Platform::PollForNotification(), UtcDaliCancelAllLoads(), UtcDaliCancelSomeLoads(), and UtcDaliLoadCompletion().

Here is the caller graph for this function:

virtual void Dali::Integration::PlatformAbstraction::JoinLoaderThreads ( )
pure virtual

Waits for the asynchronous loader threads (if any) to finish.

This will be only be called before Core destruction; no resource loading requests will be made following this method.

Implemented in Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, and Dali::TizenPlatform::TizenPlatformAbstraction.

virtual bool Dali::Integration::PlatformAbstraction::LoadFile ( const std::string &  filename,
Dali::Vector< unsigned char > &  buffer 
) const
pure virtual

Load a file into a buffer.

Parameters
[in]filenameThe filename to load
[out]bufferA buffer to receive the file.
Returns
true if the file is loaded.

Implemented in Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, and Dali::TizenPlatform::TizenPlatformAbstraction.

virtual void Dali::Integration::PlatformAbstraction::LoadResource ( const ResourceRequest request)
pure virtual

Request a resource from the native filesystem.

This is an asynchronous request. After this method returns, FillResourceCache() will be called to retrieve the result(s) of the resource loading operation. Loading resources in separate worker thread is recommended. Multi-threading note: this method will be called from the main thread only i.e. not from within the Core::Render() method.

Parameters
[in]requestA unique resource request. This is not guaranteed to survive after LoadResource returns; the loading process should take a copy.

Implemented in Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, and Dali::TizenPlatform::TizenPlatformAbstraction.

Referenced by UtcDaliCancelAllLoads(), UtcDaliCancelSomeLoads(), and UtcDaliLoadCompletion().

Here is the caller graph for this function:

virtual ResourcePointer Dali::Integration::PlatformAbstraction::LoadResourceSynchronously ( const ResourceType resourceType,
const std::string &  resourcePath 
)
pure virtual

Request a resource from the native filesystem.

This is a synchronous request, i.e. it will block the main loop whilst executing. It should therefore be used sparingly.

Multi-threading note: this method will be called from the main thread only i.e. not from within the Core::Render() method.

Parameters
[in]resourceTypeThe type of resource to load
[in]resourcePathThe path to the resource
Returns
A pointer to a ref-counted resource

Implemented in Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, and Dali::TizenPlatform::TizenPlatformAbstraction.

Referenced by Dali::Internal::Atlas::LoadBitmap(), and Dali::Internal::NinePatchImage::NinePatchImage().

Here is the caller graph for this function:

virtual bool Dali::Integration::PlatformAbstraction::LoadShaderBinaryFile ( const std::string &  filename,
Dali::Vector< unsigned char > &  buffer 
) const
pure virtual

Load a shader binary file into a buffer.

Parameters
[in]filenameThe shader binary filename to load
[out]bufferA buffer to receive the file.
Returns
true if the file is loaded.

Implemented in Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, and Dali::TizenPlatform::TizenPlatformAbstraction.

Referenced by Dali::Internal::ShaderFactory::Load().

Here is the caller graph for this function:

virtual void Dali::Integration::PlatformAbstraction::Resume ( )
pure virtual

Tell the platform abstraction that Dali is resuming from a pause, such as when it has transitioned from a background state to a foreground one.

It is time to wake up sleeping background threads and recreate memory caches and other temporary data.

Implemented in Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, and Dali::TizenPlatform::TizenPlatformAbstraction.

virtual bool Dali::Integration::PlatformAbstraction::SaveShaderBinaryFile ( const std::string &  filename,
const unsigned char *  buffer,
unsigned int  numBytes 
) const
pure virtual

Save a shader binary file to the resource file system.

Parameters
[in]filenameThe shader binary filename to save to.
[in]bufferA buffer to write the file from.
[in]numbytesSize of the buffer.
Returns
true if the file is saved, else false.

Implemented in Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, and Dali::TizenPlatform::TizenPlatformAbstraction.

Referenced by Dali::Internal::ShaderFactory::SaveBinary().

Here is the caller graph for this function:

virtual void Dali::Integration::PlatformAbstraction::Suspend ( )
pure virtual

Tell the platform abstraction that Dali is ready to pause, such as when the application enters a background state.

Allows background threads to pause their work until Resume() is called. This is a good time to release recreatable data such as memory caches to cooperate with other apps and reduce the chance of this one being force-killed in a low memory situation.

Implemented in Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, Dali::TestPlatformAbstraction, and Dali::TizenPlatform::TizenPlatformAbstraction.


The documentation for this class was generated from the following file:
Dali Docs Home
Read more about Dali