package Test;

import Yoseen.*;

/**********************************************************************************************
 *
 * TestYoseenFile
 *
 *
 **********************************************************************************************/
public class TestYoseenFile {
    public static void main(String[] args) {
        String dddDebug = System.getProperty("user.dir")+"\\..\\build-Debug64";

        //
        int ret;
        ret = YoseenSDK.YoseenDevice.initSDK();
        YoseenSDK.YoseenFile file = new YoseenSDK.YoseenFile();
        ret = file.init();

        //
        YoseenData.TempFrameFile tff = new YoseenData.TempFrameFile();
        ret = file.open(dddDebug + "\\Data\\test.jpg", YoseenUtil.xxxmediafile_jpgx, tff);

        //
        YoseenData.DataFrame dataFrame = new YoseenData.DataFrame();
        ret = file.read(0, dataFrame);

        //
        YoseenData.strech_control sc = new YoseenData.strech_control();
        sc.flags = YoseenData.strech_control.SCF_DDELevel;
        sc.dde_level = 1;
        ret = file.setImage(sc, YoseenUtil.xxxpalette_IronBow);
        ret = file.read(0, dataFrame);

        //single measure
        YoseenData.xxxmeasure mea = new YoseenData.xxxmeasure();
        YoseenData.xxxresult result = new YoseenData.xxxresult();
        mea.emmi = 97;
        mea.measuretype = YoseenUtil.xxxmeasuretype_rectangle;
        mea.xydata[0] = 100;
        mea.xydata[1] = 100;
        mea.xydata[2] = 200;
        mea.xydata[3] = 200;
        ret = YoseenSDK.YoseenMeasure.getResult(tff.dfh, tff.dfd, mea, result);

        //
        tff.coverImageSize = 0;
        ret = file.save(dddDebug + "\\Data\\test_save.jpg", tff);

        //
        file.close();
        file.free();
        YoseenSDK.YoseenDevice.freeSDK();
    }
}
