13#ifndef ML_GET_TILE_JOB_H
14#define ML_GET_TILE_JOB_H
28class PageRequestProcessor;
48 bool hasError()
const {
return _request->hasError(); }
113 _request->setAllocationPolicy(TileRequest::ExternalBuffer);
114 _request->setExternalDataBuffer(data);
119 return _request->getSubImage();
Base class for TileRequest based jobs.
void updateProgress()
Called by host to allow custom progress updates.
TileRequest * _request
The root TileRequest that is used internally.
bool hasFinished()
Returns if the request has finished (If an error happened, true will be returned as well).
void setTileRequestFinishedCB(TileRequestFinishedCB *cb, void *data)
Sets the tile request finished cb, which is called when the tile is ready.
void * _progressCBUserData
MLRequestProgressCB * _progressCB
virtual MLErrorCode init(PageRequestProcessor &processor)=0
Initializes the tile request and add it to the processor if no error occurs.
virtual void delegateProgressUpdate(double)
Emits the progress when it changes, to be reimplemented in derived classes.
bool hasError() const
Returns if the request has an error (and the data is thus unusable/invalid).
virtual ~GetTileJobBase()
MLErrorCode getError() const
Returns the error that happened (return ML_RESULT_OK if everything is ok).
void setProgressCB(MLRequestProgressCB *progressCallback, void *progressCallbackUserData)
Set the progress callback. It will be called when updateProgress() is called.
double getProgress() const
Returns the current progress of the tile request ([0..1] range).
void cancel()
Cancels the GetTileJob, this only sets the flag, the real cancellation needs to be done on the PageRe...
Public interface for requesting a tile from a an ML PagedImage using the PageRequestProcessor.
MLErrorCode init(PageRequestProcessor &processor) override
Initializes the tile request and add it to the processor if no error occurs.
const SubImage & getSubImage()
Returns access to the stored subimage (including the data, which is allocated using the AllocationPol...
GetTileJob(PagedImage &image, const SubImageBox &box, MLDataType datatype, const ScaleShiftData &scaleShiftData=ScaleShiftData())
Creates a GetTileJob for the given PagedImage image with the requested box, datatype and optional shi...
void setAllocationPolicy(TileRequest::AllocationPolicy policy)
Sets which allocation policy should be used.
void setRequestAsReadOnlyPage()
Sets that the tile is used read-only (so that a ML page can be passed directly as tile data) This wil...
void setExternalDataBuffer(void *data)
This allows to set the data buffer from an external buffer.
~GetTileJob() override
Destructor.
Class which represents an image, which manages properties of an image and image data which is located...
This class manages/represents a rectangular 6d image region which is organized linearly in memory.
A TileRequest either represents the input sub image that is needed by a PageRequest or if it is a roo...
AllocationPolicy
Defines how the TileRequest will allocate its memory.
MLint32 MLDataType
MLDataType.
MLint32 MLErrorCode
Type of an ML Error code.
#define MLEXPORT
To export symbols from a dll/shared object, we need to mark them with the MLEXPORT symbol.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
void MLRequestProgressCB(void *usrData, double progress)