Ejemplo n.º 1
0
        protected override void OnShowPicture(object sender, PictureChangedEventArgs arg)
        {
            base.OnShowPicture(sender, arg);
            var image       = arg.Picture;
            var orientation = GetImageOrientation(image);

            imagePathText.Content = FormatImageDescription(image, arg.Path, arg.FileDate, orientation);

            switch (DisplayMode)
            {
            case DisplayMode.OriginalOrFit:
                slideShowImage.Stretch = canImageFitScreen(image, orientation)? Stretch.None : Stretch.Uniform;
                break;

            case DisplayMode.OriginalOrFillCrop:
                slideShowImage.Stretch = canImageFitScreen(image, orientation) ? Stretch.None : Stretch.UniformToFill;
                break;
                // default just ignore.
            }
            slideShowImage.Source  = image;
            imageOrientation.Angle = -(orientation ?? 0);
            if (!IsLandscape(orientation))
            {
                var parentWindow = (FrameworkElement)Parent;
                slideShowImage.Width  = parentWindow.Height;
                slideShowImage.Height = parentWindow.Width;
            }
            else
            {
                slideShowImage.Width = slideShowImage.Height = double.NaN;
            }
        }
Ejemplo n.º 2
0
        protected override void OnShowPicture(object sender, PictureChangedEventArgs arg)
        {
            var picture        = arg.Picture;
            var angle          = ((double)arg.Random(0, 2 * ViewAngle * AnglePrecision) / AnglePrecision) - ViewAngle;
            var r3             = (double)arg.Random(1, int.MaxValue) / int.MaxValue;
            var orientation    = GetImageOrientation(picture);
            var newPictureSize = getNiceSize(picture, r3, orientation);

            // make point (newX,newY) becoming the center of the picture.
            var newX = arg.Random(2, pageWidth) - newPictureSize.Width / 2;
            var newY = arg.Random(3, pageHeight) - newPictureSize.Height / 2;

            imagePathText.Content = FormatImageDescription(picture, arg.Path, arg.FileDate, orientation);

            postcard.Opacity = 0;
            Canvas.SetLeft(postcard, newX);
            Canvas.SetTop(postcard, newY);
            postcard.Size   = newPictureSize;
            postcard.Angle  = angle - (orientation ?? 0);
            postcard.Source = picture;

            var rawBitmap = desaturate(viewBitmap);

            currentViewBitmap.WritePixels(new Int32Rect(0, 0, rawBitmap.Width, rawBitmap.Height), rawBitmap.Data,
                                          rawBitmap.Stride, 0);

            var animation = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromSeconds(2)))
            {
                AccelerationRatio = 0.8
            };

            animation.Completed += onFadeInCompleted;

            postcard.Visibility = Visibility.Visible;
            postcard.BeginAnimation(OpacityProperty, animation);
        }
Ejemplo n.º 3
0
 protected virtual void OnShowPicture(object sender, PictureChangedEventArgs arg)
 {
 }
Ejemplo n.º 4
0
 void ISlidePage.OnShowPicture(object sender, PictureChangedEventArgs arg)
 {
     OnShowPicture(sender, arg);
 }
Ejemplo n.º 5
0
 void OnPictureChanged(object sender, PictureChangedEventArgs e)
 {
     HandleFloatingObjectChanged(e.Picture, e.Property, AutoRefresh);
 }