Пример #1
0
        internal NikonThumbnail(NkMAIDImageInfo imageInfo, IntPtr data)
        {
            _stride     = (int)imageInfo.ulRowBytes;
            _width      = (int)imageInfo.szTotalPixels.w;
            _height     = (int)imageInfo.szTotalPixels.h;
            _colorSpace = imageInfo.ulColorSpace;
            _pixels     = new byte[_stride * _height];

            Marshal.Copy(data, _pixels, 0, _pixels.Length);
        }
Пример #2
0
        //
        // Data Callback
        //
        eNkMAIDResult DataProc(
            IntPtr refClient,
            IntPtr pDataInfo,
            IntPtr pData)
        {
            NkMAIDDataInfo info = *((NkMAIDDataInfo *)pDataInfo.ToPointer());

            switch (info.ulType)
            {
            case eNkMAIDDataObjType.kNkMAIDDataObjType_File:
            case eNkMAIDDataObjType.kNkMAIDDataObjType_File | eNkMAIDDataObjType.kNkMAIDDataObjType_Image:
            case eNkMAIDDataObjType.kNkMAIDDataObjType_File | eNkMAIDDataObjType.kNkMAIDDataObjType_Sound:
            case eNkMAIDDataObjType.kNkMAIDDataObjType_File | eNkMAIDDataObjType.kNkMAIDDataObjType_Thumbnail:
            case eNkMAIDDataObjType.kNkMAIDDataObjType_File | eNkMAIDDataObjType.kNkMAIDDataObjType_Video:
                if (DataFile != null)
                {
                    NkMAIDFileInfo fileInfo = *((NkMAIDFileInfo *)pDataInfo.ToPointer());
                    DataFile(this, fileInfo, pData);
                }
                break;

            case eNkMAIDDataObjType.kNkMAIDDataObjType_Thumbnail:
                if (DataImage != null)
                {
                    NkMAIDImageInfo imageInfo = *((NkMAIDImageInfo *)pDataInfo.ToPointer());
                    DataImage(this, imageInfo, pData);
                }
                break;

            case eNkMAIDDataObjType.kNkMAIDDataObjType_Sound:
                if (DataSound != null)
                {
                    NkMAIDSoundInfo soundInfo = *((NkMAIDSoundInfo *)pDataInfo.ToPointer());
                    DataSound(this, soundInfo, pData);
                }
                break;

            default:
                Debug.Print("Unexpected data object type: {0}", info.ulType);
                break;
            }

            return(eNkMAIDResult.kNkMAIDResult_NoError);
        }
Пример #3
0
 void data_DataImage(NikonObject sender, NkMAIDImageInfo imageInfo, IntPtr data)
 {
     NikonThumbnail thumbnail = new NikonThumbnail(imageInfo, data);
     Scheduler.Callback(new ThumbnailReadyDelegate(OnThumbnailReady), this, thumbnail);
 }
Пример #4
0
        internal NikonThumbnail(NkMAIDImageInfo imageInfo, IntPtr data)
        {
            _stride = (int)imageInfo.ulRowBytes;
            _width = (int)imageInfo.szTotalPixels.w;
            _height = (int)imageInfo.szTotalPixels.h;
            _colorSpace = imageInfo.ulColorSpace;
            _pixels = new byte[_stride * _height];

            Marshal.Copy(data, _pixels, 0, _pixels.Length);
        }
Пример #5
0
        void data_DataImage(NikonObject sender, NkMAIDImageInfo imageInfo, IntPtr data)
        {
            NikonThumbnail thumbnail = new NikonThumbnail(imageInfo, data);

            Scheduler.Callback(new ThumbnailReadyDelegate(OnThumbnailReady), this, thumbnail);
        }