Пример #1
0
        private Image RequestImages(ImageData imageData)
        {
            if (!_isRunning)
            {
                return(Image.Invalid);
            }

            LEAP_IMAGE_FRAME_DESCRIPTION imageSpecifier = new LEAP_IMAGE_FRAME_DESCRIPTION();

            imageSpecifier.frame_id   = imageData.frame_id;
            imageSpecifier.type       = imageData.type;
            imageSpecifier.pBuffer    = imageData.getPinnedHandle();
            imageSpecifier.buffer_len = (ulong)imageData.pixelBuffer.LongLength;
            LEAP_IMAGE_FRAME_REQUEST_TOKEN token;
            eLeapRS result = eLeapRS.eLeapRS_UnknownError;

            result = LeapC.RequestImages(_leapConnection, ref imageSpecifier, out token);

            if (result == eLeapRS.eLeapRS_Success)
            {
                imageData.isComplete = false;
                imageData.index      = token.requestID;
                Image futureImage = new Image(imageData);
                _pendingImageRequestList.Add(new ImageFuture(futureImage, imageData, LeapC.GetNow(), token));
                return(futureImage);
            }
            else
            {
                imageData.unPinHandle();
                reportAbnormalResults("LeapC Image Request call was ", result);
                return(Image.Invalid);
            }
        }