ML Reference
|
Public interface for requesting a tile from a an ML PagedImage using the PageRequestProcessor. More...
#include <mlGetTileJob.h>
Public Member Functions | |
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 shifting/scaling. | |
~GetTileJob () override | |
Destructor. | |
MLErrorCode | init (PageRequestProcessor &processor) override |
Initializes the tile request and add it to the processor if no error occurs. | |
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 will only work under special conditions: The tile's box/datatype/shiftScale needs to exactly match the input page. | |
void | setExternalDataBuffer (void *data) |
This allows to set the data buffer from an external buffer. | |
const SubImage & | getSubImage () |
Returns access to the stored subimage (including the data, which is allocated using the AllocationPolicy). | |
Public Member Functions inherited from ml::GetTileJobBase | |
GetTileJobBase () | |
virtual | ~GetTileJobBase () |
double | getProgress () const |
Returns the current progress of the tile request ([0..1] range). | |
bool | hasFinished () |
Returns if the request has finished (If an error happened, true will be returned as well). | |
bool | hasError () const |
Returns if the request has an error (and the data is thus unusable/invalid). | |
MLErrorCode | getError () const |
Returns the error that happened (return ML_RESULT_OK if everything is ok). | |
void | setTileRequestFinishedCB (TileRequestFinishedCB *cb, void *data) |
Sets the tile request finished cb, which is called when the tile is ready. | |
void | cancel () |
Cancels the GetTileJob, this only sets the flag, the real cancellation needs to be done on the PageRequestProcessor. | |
void | updateProgress () |
Called by host to allow custom progress updates. | |
virtual void | delegateProgressUpdate (double) |
Emits the progress when it changes, to be reimplemented in derived classes. | |
void | setProgressCB (MLRequestProgressCB *progressCallback, void *progressCallbackUserData) |
Set the progress callback. It will be called when updateProgress() is called. | |
Additional Inherited Members | |
Protected Attributes inherited from ml::GetTileJobBase | |
TileRequest * | _request |
The root TileRequest that is used internally. | |
MLRequestProgressCB * | _progressCB |
void * | _progressCBUserData |
double | _lastProgress |
Public interface for requesting a tile from a an ML PagedImage using the PageRequestProcessor.
Definition at line 80 of file mlGetTileJob.h.
ml::GetTileJob::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 shifting/scaling.
After creation, the job needs to be initialized using init(), see below.
|
override |
Destructor.
|
inline |
Returns access to the stored subimage (including the data, which is allocated using the AllocationPolicy).
Definition at line 118 of file mlGetTileJob.h.
|
overridevirtual |
Initializes the tile request and add it to the processor if no error occurs.
It returns ML_REQUEST_OUTSIDE_OF_IMAGE if the request lies completely outside of the image. In that case, the data is allocated as uninitialized memory according to the allocation policy.
Implements ml::GetTileJobBase.
|
inline |
Sets which allocation policy should be used.
NOTE: This can only be changed directly after the constructor of the class, it has no affect when the data is already allocated. The default policy is to use the MLMemoryManager.
Definition at line 101 of file mlGetTileJob.h.
|
inline |
This allows to set the data buffer from an external buffer.
The buffer will not be managed by the GetTileJob, the ownership stays with the user.
Definition at line 112 of file mlGetTileJob.h.
|
inline |
Sets that the tile is used read-only (so that a ML page can be passed directly as tile data) This will only work under special conditions: The tile's box/datatype/shiftScale needs to exactly match the input page.
This sets the allocation policy to NoAllocation, since the data should be taken from the existing page. If it fails to get the data read-only, no data will be received.
Definition at line 108 of file mlGetTileJob.h.