Kanzi Connect 3.9.10
kanzi::connect::LoadImageTask Class Reference

A resource loading task that can be used to retrieve an image from the network using HTTP or HTTPS. More...

#include <load_image_task.hpp>

Inheritance diagram for kanzi::connect::LoadImageTask:
kanzi::connect::LoadImageTaskHttp

Public Member Functions

virtual void finishFunction (const KzuResourceLoaderThreadContext *context) override
 A function that is called when the loading is finished.
 
virtual ResourceSharedPtr getResult () override
 A function that is called to retrieve the result of the loading.
 
virtual void loadFunction (const KzuResourceLoaderThreadContext *context) override
 A function that performs the actual resource loading.
 
 LoadImageTask (const string &url, Domain *domain)
 Constructor.
 
virtual ~LoadImageTask ()=default
 Desctructor.
 

Protected Types

enum class  ImageType { JPG , PNG , UNSUPPORTED }
 Specifies the supported file types. More...
 

Protected Member Functions

virtual void decodeKanziBitmap (const KzuResourceLoaderThreadContext *context)
 
 LoadImageTask (const LoadImageTask &other)=delete
 No copying.
 
LoadImageTaskoperator= (const LoadImageTask &other)=delete
 No assignment.
 

Static Protected Member Functions

static ImageType detectImageType (const unsigned char *buffer, size_t lenght)
 Detect image type based on buffer contents.
 
static bool isJpgImage (const unsigned char *buffer, size_t size)
 Check if the given buffer contains a valid signature for JPG file.
 
static bool isPngImage (const unsigned char *buffer, size_t size)
 Check if the given buffer contains a valid signature for PNG file.
 

Protected Attributes

Domain * m_domain
 
BitmapImageUniquePtr m_image
 
vector< char > m_imageData
 
int m_loadResult
 
bool m_statusReported
 
TextureSharedPtr m_texture
 
string m_url
 

Detailed Description

A resource loading task that can be used to retrieve an image from the network using HTTP or HTTPS.

Member Enumeration Documentation

◆ ImageType

enum class kanzi::connect::LoadImageTask::ImageType
strongprotected

Specifies the supported file types.

Enumerator
JPG 
PNG 
UNSUPPORTED 

Constructor & Destructor Documentation

◆ LoadImageTask() [1/2]

kanzi::connect::LoadImageTask::LoadImageTask ( const string & url,
Domain * domain )
explicit

Constructor.

Parameters
urlHTTP url of the resource.
domainKanzi UI Domain.

◆ ~LoadImageTask()

virtual kanzi::connect::LoadImageTask::~LoadImageTask ( )
virtualdefault

Desctructor.

◆ LoadImageTask() [2/2]

kanzi::connect::LoadImageTask::LoadImageTask ( const LoadImageTask & other)
protecteddelete

No copying.

Member Function Documentation

◆ decodeKanziBitmap()

virtual void kanzi::connect::LoadImageTask::decodeKanziBitmap ( const KzuResourceLoaderThreadContext * context)
protectedvirtual

◆ detectImageType()

static ImageType kanzi::connect::LoadImageTask::detectImageType ( const unsigned char * buffer,
size_t lenght )
staticprotected

Detect image type based on buffer contents.

Parameters
bufferContains the image

◆ finishFunction()

virtual void kanzi::connect::LoadImageTask::finishFunction ( const KzuResourceLoaderThreadContext * context)
overridevirtual

A function that is called when the loading is finished.

Parameters
contextThread context, unused

◆ getResult()

virtual ResourceSharedPtr kanzi::connect::LoadImageTask::getResult ( )
overridevirtual

A function that is called to retrieve the result of the loading.

Returns
A shared pointer to the resource that was loaded.

◆ isJpgImage()

static bool kanzi::connect::LoadImageTask::isJpgImage ( const unsigned char * buffer,
size_t size )
staticprotected

Check if the given buffer contains a valid signature for JPG file.

Parameters
bufferContains the image

◆ isPngImage()

static bool kanzi::connect::LoadImageTask::isPngImage ( const unsigned char * buffer,
size_t size )
staticprotected

Check if the given buffer contains a valid signature for PNG file.

Parameters
bufferContains the image

◆ loadFunction()

virtual void kanzi::connect::LoadImageTask::loadFunction ( const KzuResourceLoaderThreadContext * context)
overridevirtual

A function that performs the actual resource loading.

Parameters
contextThread context, unused

Reimplemented in kanzi::connect::LoadImageTaskHttp.

◆ operator=()

LoadImageTask & kanzi::connect::LoadImageTask::operator= ( const LoadImageTask & other)
protecteddelete

No assignment.

Member Data Documentation

◆ m_domain

Domain* kanzi::connect::LoadImageTask::m_domain
protected

◆ m_image

BitmapImageUniquePtr kanzi::connect::LoadImageTask::m_image
protected

◆ m_imageData

vector<char> kanzi::connect::LoadImageTask::m_imageData
protected

◆ m_loadResult

int kanzi::connect::LoadImageTask::m_loadResult
protected

◆ m_statusReported

bool kanzi::connect::LoadImageTask::m_statusReported
protected

◆ m_texture

TextureSharedPtr kanzi::connect::LoadImageTask::m_texture
protected

◆ m_url

string kanzi::connect::LoadImageTask::m_url
protected

The documentation for this class was generated from the following file: