Esempio n. 1
0
 void OnThumbnailReady(NikonDevice sender, NikonThumbnail thumbnail)
 {
     if (_thumbnailReady != null)
     {
         _thumbnailReady(sender, thumbnail);
     }
 }
Esempio n. 2
0
        void device_ThumbnailReady(NikonDevice sender, NikonThumbnail thumbnail)
        {
            // We're expecting to get RGB24 data, make sure that the format is correct
            if (thumbnail.Stride / thumbnail.Width < 3)
            {
                return;
            }

            // Note: Thumbnail pixels are uncompressed RGB24 - here's an example of how to jpeg encode it

            JpegBitmapEncoder encoder = new JpegBitmapEncoder();
            encoder.QualityLevel = 90;

            BitmapSource source = BitmapFrame.Create(
                thumbnail.Width,
                thumbnail.Height,
                96.0,
                96.0,
                System.Windows.Media.PixelFormats.Rgb24,
                null,
                thumbnail.Pixels,
                thumbnail.Stride);

            BitmapFrame frame = BitmapFrame.Create(source);
            encoder.Frames.Add(frame);

            MemoryStream stream = new MemoryStream();
            encoder.Save(stream);

            Save(stream.GetBuffer(), "thumbnail.jpg");
        }
Esempio n. 3
0
 void OnThumbnailReady(NikonDevice sender, NikonThumbnail thumbnail)
 {
     if (_thumbnailReady != null)
     {
         _thumbnailReady(sender, thumbnail);
     }
 }
Esempio n. 4
0
 void data_DataImage(NikonObject sender, NkMAIDImageInfo imageInfo, IntPtr data)
 {
     NikonThumbnail thumbnail = new NikonThumbnail(imageInfo, data);
     Scheduler.Callback(new ThumbnailReadyDelegate(OnThumbnailReady), this, thumbnail);
 }
Esempio n. 5
0
        void data_DataImage(NikonObject sender, NkMAIDImageInfo imageInfo, IntPtr data)
        {
            NikonThumbnail thumbnail = new NikonThumbnail(imageInfo, data);

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