コード例 #1
0
        public override void Apply(MagickImage image)
        {
            if (Radius == 0 && Threshold == 0)
            {
                return;
            }

            var mask = (MagickImage)image.Clone();

            mask.ColorSpace = ColorSpace.Gray;
            mask.ReduceNoise(10);
            mask.Threshold(new Percentage(Threshold));
            // mask.Sharpen();
            // mask.Blur(5, 5);
            mask.Negate();

            mask.Write(Path.Combine(Paths.ResourcesPath(Engine.Engine.project), "Mask.png"));

            image.SetWriteMask(mask);
            image.Blur(0, Radius);
            image.RemoveWriteMask();

            // Debug.Log(Path.Combine(Paths.ResourcesPath(Engine.Engine.project)));

            image.Write(Path.Combine(Paths.ResourcesPath(Engine.Engine.project), "custom.png"));

            // var clone = image.Clone();
            // clone.SelectiveBlur(0, Radius, new Percentage(Threshold));

            // clone.Write(Path.Combine(Paths.ResourcesPath(Engine.Engine.project), "selective.png"));
        }
コード例 #2
0
ファイル: ImageLayer.cs プロジェクト: TheColorRed/Alakazam
        public LayerImage(string filePath, Project project) : base(project)
        {
            var resources = Paths.ResourcesPath(project);

            fileName = Guid.NewGuid().ToString();
            var path = Path.Combine(resources, "bases", fileName);

            if (!File.Exists(path))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(path));
                File.Copy(filePath, path);
            }
        }
コード例 #3
0
ファイル: GradientLayer.cs プロジェクト: TheColorRed/Alakazam
        public LayerGradient(Project project) : base(project)
        {
            var resources = Paths.ResourcesPath(project);

            fileName = Guid.NewGuid().ToString();
            var path   = Path.Combine(resources, "bases", fileName);
            var width  = project.size.width;
            var height = project.size.height;
            var image  = AutoMagick.Gradient(StartColor, EndColor, width, height, Angle);

            Directory.CreateDirectory(Path.GetDirectoryName(path));
            image.Write(path, MagickFormat.Bmp);
        }
コード例 #4
0
ファイル: NoiseLayer.cs プロジェクト: TheColorRed/Alakazam
        public void GenerateImage()
        {
            var resources = Paths.ResourcesPath(Project);
            var path      = Path.Combine(resources, "bases", fileName);
            var image     = AutoMagick.PerlinNoise(Project.size.width, Project.size.height);

            if (IsColor == false)
            {
                image = (MagickImage)image.Separate(Channels.Green).First();
            }

            Directory.CreateDirectory(Path.GetDirectoryName(path));
            image.Write(path, MagickFormat.Bmp);
            imageOriginal = null;
        }