AddTransform() публичный Метод

public AddTransform ( NAPS2.Scan.Images.Transforms.Transform transform ) : void
transform NAPS2.Scan.Images.Transforms.Transform
Результат void
Пример #1
0
        private static void AddTransformAndUpdateThumbnail(ScannedImage image, Transform transform)
        {
            image.AddTransform(transform);
            var thumbnail = image.GetThumbnail(null);

            if (thumbnail != null)
            {
                image.SetThumbnail(transform.Perform(thumbnail));
            }
        }
Пример #2
0
        private void AddTransformAndUpdateThumbnail(ScannedImage image, ref Bitmap bitmap, Transform transform)
        {
            image.AddTransform(transform);
            var thumbnail = image.GetThumbnail(null);

            if (thumbnail != null)
            {
                bitmap = transform.Perform(bitmap);
                image.SetThumbnail(thumbnailRenderer.RenderThumbnail(bitmap));
            }
        }
Пример #3
0
        public bool Start(DirectImageTransfer data, bool copy, Action<ScannedImage> imageCallback)
        {
            ProgressTitle = copy ? MiscResources.CopyProgress : MiscResources.ImportProgress;
            Status = new OperationStatus
            {
                StatusText = copy ? MiscResources.Copying : MiscResources.Importing,
                MaxProgress = data.ImageRecovery.Length
            };
            cancel = false;

            thread = threadFactory.StartThread(() =>
            {
                Exception error = null;
                foreach (var ir in data.ImageRecovery)
                {
                    try
                    {
                        ScannedImage img;
                        using (var bitmap = new Bitmap(Path.Combine(data.RecoveryFolder, ir.FileName)))
                        {
                            img = new ScannedImage(bitmap, ir.BitDepth, ir.HighQuality, -1);
                        }
                        foreach (var transform in ir.TransformList)
                        {
                            img.AddTransform(transform);
                        }
                        img.SetThumbnail(thumbnailRenderer.RenderThumbnail(img));
                        imageCallback(img);

                        Status.CurrentProgress++;
                        InvokeStatusChanged();
                        if (cancel)
                        {
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        error = ex;
                    }
                }
                if (error != null)
                {
                    Log.ErrorException(string.Format(MiscResources.ImportErrorCouldNot, data.RecoveryFolder), error);
                }
                Status.Success = true;
                InvokeFinished();
            });
            return true;
        }
Пример #4
0
 private static void AddTransformAndUpdateThumbnail(ScannedImage image, Transform transform)
 {
     image.AddTransform(transform);
     var thumbnail = image.GetThumbnail(null);
     if (thumbnail != null)
     {
         image.SetThumbnail(transform.Perform(thumbnail));
     }
 }
Пример #5
0
 public static void PostProcessStep2(ScannedImage image, ScanProfile profile)
 {
     if (!profile.UseNativeUI && profile.BrightnessContrastAfterScan)
     {
         if (profile.Brightness != 0)
         {
             image.AddTransform(new BrightnessTransform { Brightness = profile.Brightness });
         }
         if (profile.Contrast != 0)
         {
             image.AddTransform(new TrueContrastTransform { Contrast = profile.Contrast });
         }
     }
 }
Пример #6
0
            private bool DoRecover(Action<ScannedImage> imageCallback)
            {
                Status.MaxProgress = recoveryIndexManager.Index.Images.Count;
                InvokeStatusChanged();

                foreach (RecoveryIndexImage indexImage in recoveryIndexManager.Index.Images)
                {
                    if (cancel)
                    {
                        return false;
                    }

                    string imagePath = Path.Combine(folderToRecoverFrom.FullName, indexImage.FileName);
                    ScannedImage scannedImage;
                    using (var bitmap = new Bitmap(imagePath))
                    {
                        scannedImage = new ScannedImage(bitmap, indexImage.BitDepth, indexImage.HighQuality, -1);
                    }
                    foreach (var transform in indexImage.TransformList)
                    {
                        scannedImage.AddTransform(transform);
                    }
                    scannedImage.SetThumbnail(thumbnailRenderer.RenderThumbnail(scannedImage));
                    imageCallback(scannedImage);

                    Status.CurrentProgress++;
                    InvokeStatusChanged();
                }
                return true;
            }