Ejemplo n.º 1
0
        private void CaptureBeginState()
        {
            if (!CanZoom())
            {
                return;
            }

            IImageSpatialTransform originator = GetSelectedImageTransform();

            _applicator                  = new ImageOperationApplicator(this.SelectedPresentationImage, _operation);
            _memorableCommand            = new MemorableUndoableCommand(originator);
            _memorableCommand.BeginState = originator.CreateMemento();
        }
Ejemplo n.º 2
0
        private static Bitmap DrawWysiwygImageToBitmap(IPresentationImage image, Rectangle displayRectangle, float scale, float dpi)
        {
            IImageSpatialTransform transform = (IImageSpatialTransform)((ISpatialTransformProvider)image).SpatialTransform;
            object restoreMemento            = transform.CreateMemento();

            try
            {
                int width  = (int)(displayRectangle.Width * scale);
                int height = (int)(displayRectangle.Height * scale);

                transform.Scale *= scale;

                return(ImageDrawToBitmap(image, width, height, dpi));
            }
            finally
            {
                transform.SetMemento(restoreMemento);
            }
        }
Ejemplo n.º 3
0
        private static Bitmap DrawCompleteImageToBitmap(IPresentationImage image, float scale, float dpi)
        {
            IImageSpatialTransform transform = (IImageSpatialTransform)((ISpatialTransformProvider)image).SpatialTransform;
            object restoreMemento            = transform.CreateMemento();

            try
            {
                Rectangle imageRectangle = new Rectangle(new Point(0, 0), image.SceneSize);

                transform.Initialize();
                transform.ScaleToFit = false;
                transform.Scale      = scale;
                RectangleF displayRectangle = transform.ConvertToDestination(imageRectangle);
                int        width            = (int)Math.Round(displayRectangle.Width);
                int        height           = (int)Math.Round(displayRectangle.Height);

                transform.ScaleToFit = true;
                return(ImageDrawToBitmap(image, width, height, dpi));
            }
            finally
            {
                transform.SetMemento(restoreMemento);
            }
        }