MrSID Decode SDK for Raster Reference Manual  9.5.5.5244
ProgressDelegate.cpp
//
// This code is property of Celartem, Inc dba Extensis.
// Copyright (c) 1995-2023. All rights reserved.
// Use permitted only under license from Extensis.
//
/* PUBLIC */
// This demonstrates how to derive your own progress meter class.
// This example class just prints out the current percent-complete
// each time it is called.
#include "main.h"
#include "support.h"
#include "lt_fileSpec.h"
#include "lti_delegates.h"
#include "lti_scene.h"
LT_USE_NAMESPACE(LizardTech);
class MyProgress : public LTIProgressDelegate
{
public:
MyProgress() :
m_cnt(0)
{
return;
}
{
printf("%d: %f\n", m_cnt, x);
++m_cnt;
}
public:
int m_cnt;
};
LT_STATUS ProgressDelegate()
{
//
MyProgress progress;
// make the image reader
const LTFileSpec fileSpec(INPUT_PATH("meg_cr20.sid"));
TEST_BOOL(reader != nullptr);
TEST_SUCCESS(reader->initialize(fileSpec));
reader->setProgressDelegate(&progress);
const LTIScene scene(0, 0, 640, 480, 1.0);
LTISceneBuffer bufData(reader->getPixelProps(),
scene.getNumCols(),
scene.getNumRows(),
nullptr);
// the decode will fail, return 999 from within the delegate
sts = reader->read(scene, bufData);
TEST_BOOL(sts == LT_STS_Success);
// verify the interrupt handler was called several times
TEST_BOOL(progress.m_cnt == 9);
reader->release();
reader = nullptr;
}
lt_uint32 LT_STATUS
An integral status code.
Definition: lt_status.h:30
#define LT_STS_Uninit
status code indicating unintialized variable
Definition: lt_status.h:60
#define LT_STS_Success
status code indicating success
Definition: lt_status.h:43
Represents a file or directory path.
Definition: lt_fileSpec.h:35
progress delegate (callback) base class
Definition: lti_delegates.h:68
virtual LT_STATUS setProgressStatus(float percentComplete)=0
set percent completed
const LTIPixel & getPixelProps() const
get the pixel properties of the image
void setProgressDelegate(LTIProgressDelegate *delegate)
set progress delegate
LT_STATUS read(const LTIScene &scene, LTISceneBuffer &buffer)
read (decode) a scene from the image
virtual void release(void) const
decrement the reference counter and delete the object when the counter is zero
representation of a scene
Definition: lti_scene.h:60
class to hold data passed between image stages
reader for MrSID images (MG2, MG3 and MG4)
LT_STATUS initialize(const LTFileSpec &fileSpec, bool useWorldFile=false, MrSIDMemoryUsage memoryUsage=MRSID_MEMORY_USAGE_DEFAULT, MrSIDStreamUsage streamUsage=MRSID_STREAM_USAGE_DEFAULT)
initializer
static MrSIDImageReader * create(void)

Extensis