示例#1
0
    void OnCapturedPhotoToMemory(PhotoCaptureResult result, PhotoCaptureFrame photoCaptureFrame)
    {
        Debug.Log("2. TakePhotoAsync completed");

        if (!result.success)
        {
            Debug.LogError("VerifyPhotoResult is incorrect");
            return;
        }
        Debug.Log("3. Photo result verified");
        try
        {
            Debug.Log("4. Uploaded ImageDataToTexture");
            photoCaptureFrame.UploadImageDataToTexture(_targetTexture);

            Debug.Log("5. Set Pixels to UI Texture");
            toShow.SetPixels(_targetTexture.GetPixels());
            toShow.Apply();

            Debug.Log("6. Sending texture to UI");
            PhotoResultMethodHandler(toShow);
            _isPhotoBeingProcessed = false;
        }
        catch (Exception e)
        {
            Debug.LogError($"EXCEPTION: OnCapturedPhotoToMemory, {e.Message}");
        }
    }
示例#2
0
        static private PhotoCaptureResult MakeCaptureResult(CaptureResultType resultType, long hResult)
        {
            PhotoCaptureResult result = new PhotoCaptureResult();

            result.resultType = resultType;
            result.hResult    = hResult;

            return(result);
        }
示例#3
0
    public void OnPhotoCaptureStart(PhotoCaptureResult result)
    {
        if (!result.success)
        {
            Debug.Log("Photo Capture Object Failed to initialize");
            return;
        }

        Debug.Log("Photo Capture Object Started");
        _canStartPhotoCapture = true;
    }
示例#4
0
        public void StopPhotoModeAsync(OnPhotoModeStoppedCallback onPhotoModeStoppedCallback)
        {
            CaptureBehaviour.Stop();

            PhotoCaptureResult result = new PhotoCaptureResult();

            result.resultType = CaptureResultType.Success;
            if (onPhotoModeStoppedCallback != null)
            {
                onPhotoModeStoppedCallback(result);
            }
        }
示例#5
0
        public void StartPhotoModeAsync(CameraParameters setupParams, OnPhotoModeStartedCallback onPhotoModeStartedCallback)
        {
            CaptureBehaviour.SetConfig(setupParams);
            CaptureBehaviour.Play();
            PhotoCaptureResult result = new PhotoCaptureResult();

            result.resultType = CaptureResultType.Success;
            if (onPhotoModeStartedCallback != null)
            {
                onPhotoModeStartedCallback(result);
            }
        }
示例#6
0
        public void StopPhotoModeAsync(OnPhotoModeStoppedCallback onPhotoModeStoppedCallback)
        {
            PhotoCaptureResult result = new PhotoCaptureResult();

            try
            {
                m_CaptureContext.StopCaptureMode();
                result.resultType = CaptureResultType.Success;
                onPhotoModeStoppedCallback?.Invoke(result);
            }
            catch (Exception)
            {
                result.resultType = CaptureResultType.UnknownError;
                onPhotoModeStoppedCallback?.Invoke(result);
                throw;
            }
        }
示例#7
0
        private static PhotoCaptureResult MakeCaptureResult(long hResult)
        {
            CaptureResultType  success;
            PhotoCaptureResult result = new PhotoCaptureResult();

            if (hResult == HR_SUCCESS)
            {
                success = CaptureResultType.Success;
            }
            else
            {
                success = CaptureResultType.UnknownError;
            }
            result.resultType = success;
            result.hResult    = hResult;
            return(result);
        }
        public void StartPhotoModeAsync(CameraParameters setupParams, OnPhotoModeStartedCallback onPhotoModeStartedCallback)
        {
            PhotoCaptureResult result = new PhotoCaptureResult();

            try
            {
                setupParams.camMode = CamMode.PhotoMode;
                m_CaptureContext.StartCaptureMode(setupParams);
                m_CaptureContext.StartCapture();
                result.resultType = CaptureResultType.Success;
                onPhotoModeStartedCallback?.Invoke(result);
            }
            catch (Exception)
            {
                result.resultType = CaptureResultType.UnknownError;
                onPhotoModeStartedCallback?.Invoke(result);
                throw;
            }
        }
示例#9
0
        static private PhotoCaptureResult MakeCaptureResult(long hResult)
        {
            PhotoCaptureResult result = new PhotoCaptureResult();

            CaptureResultType resultType;

            if (hResult == HR_SUCCESS)
            {
                resultType = CaptureResultType.Success;
            }
            else
            {
                resultType = CaptureResultType.UnknownError;
            }

            result.resultType = resultType;
            result.hResult    = hResult;

            return(result);
        }
示例#10
0
 private static PhotoCaptureResult MakeCaptureResult(long hResult)
 {
     CaptureResultType success;
     PhotoCaptureResult result = new PhotoCaptureResult();
     if (hResult == HR_SUCCESS)
     {
         success = CaptureResultType.Success;
     }
     else
     {
         success = CaptureResultType.UnknownError;
     }
     result.resultType = success;
     result.hResult = hResult;
     return result;
 }
 public TakePhotoResult(PhotoCaptureResult captureResult, PhotoCaptureFrame frame)
 {
     CaptureResult = captureResult;
     Frame         = frame;
 }