Example #1
0
        private void ExecuteCropToAspectRatio(string aspectRatioRawString)
        {
            IMessageService     cropLabMessageService = MessageServiceFactory.GetCropLabMessageService();
            CropLabErrorHandler errorHandler          = CropLabErrorHandler.InitializeErrorHandler(cropLabMessageService);
            Selection           selection             = this.GetCurrentSelection();

            float aspectRatioWidth  = 0.0f;
            float aspectRatioHeight = 0.0f;

            if (!TryParseAspectRatio(aspectRatioRawString, out aspectRatioWidth, out aspectRatioHeight))
            {
                HandleErrorCode(CropLabErrorHandler.ErrorCodeAspectRatioIsInvalid, FeatureName, errorHandler);
                return;
            }
            float aspectRatio = aspectRatioWidth / aspectRatioHeight;

            try
            {
                CropToAspectRatio.Crop(selection, aspectRatio);
            }
            catch (CropLabException e)
            {
                HandleCropLabException(e, FeatureName, errorHandler);
            }
        }
        public void CropToAspectRatioRotatedPicture()
        {
            Microsoft.Office.Interop.PowerPoint.ShapeRange actualShapes = GetShapes(SlideNumberRotatedPictureActual, selectOneShapeNames);
            actualShapes = CropToAspectRatio.Crop(actualShapes, 0.1f);

            Microsoft.Office.Interop.PowerPoint.ShapeRange expectedShapes = GetShapes(SlideNumberRotatedPictureExpected, selectOneShapeNames);
            CheckShapes(expectedShapes, actualShapes);
        }
        public void CropToAspectRatioMultiplePictures()
        {
            Microsoft.Office.Interop.PowerPoint.ShapeRange actualShapes = GetShapes(SlideNumberMultiplePicturesActual, selectMultipleShapesNames);
            actualShapes = CropToAspectRatio.Crop(actualShapes, 0.1f);

            Microsoft.Office.Interop.PowerPoint.ShapeRange expectedShapes = GetShapes(SlideNumberMultiplePicturesExpected, selectMultipleShapesNames);
            CheckShapes(expectedShapes, actualShapes);
        }
        public void CropToAspectRatioRotatedPicture()
        {
            var actualShapes = GetShapes(SlideNumberRotatedPictureActual, selectOneShapeNames);

            actualShapes = CropToAspectRatio.Crop(actualShapes, 0.1f);

            var expectedShapes = GetShapes(SlideNumberRotatedPictureExpected, selectOneShapeNames);

            CheckShapes(expectedShapes, actualShapes);
        }
        public void CropToAspectRatioMultiplePictures()
        {
            var actualShapes = GetShapes(SlideNumberMultiplePicturesActual, selectMultipleShapesNames);

            actualShapes = CropToAspectRatio.Crop(actualShapes, 0.1f);

            var expectedShapes = GetShapes(SlideNumberMultiplePicturesExpected, selectMultipleShapesNames);

            CheckShapes(expectedShapes, actualShapes);
        }