コード例 #1
0
 private void DebugLogs()
 {
     Debug.Log("X:" + PositionX.ToString() + " " + "Y:" + PositionY.ToString());
     Debug.Log("Stan: " + state);
     Debug.Log("Czas: " + Math.Round(Time.time, 2) + "s");
     Debug.Log("Odleglosc do celu: " + DistanceToObstacleX + "," + DistanceToObstacleY);
 }
コード例 #2
0
        protected void Initialize(CodeActivityContext context)
        {
            doc = Document.Get(context);
            rec = Signer.Get(context);
            if (rec.RecipientType != "Signer")
            {
                throw new ArgumentException("Only Signers can have tabs added to them, not other Recipient types");
            }

            sigX = PositionX.Get(context);
            sigY = PositionY.Get(context);

            anchorText = AnchorText.Get(context);
            offsetX    = OffsetX.Get(context);
            offsetY    = OffsetY.Get(context);

            tabLabel   = TabLabel.Get(context);
            toolTip    = ToolTip.Get(context);
            pageNumber = PageNumber.Get(context);

            if (anchorText != null && anchorText != "" && Path.GetExtension(doc.filename) != ".pdf")
            {
                throw new FormatException("Can only use relative positioning on .pdf files");
            }
        }
コード例 #3
0
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Door", true, out subEle);
            Door.WriteXML(subEle, master);

            ele.TryPathTo("Position/X", true, out subEle);
            subEle.Value = PositionX.ToString("G15");

            ele.TryPathTo("Position/Y", true, out subEle);
            subEle.Value = PositionY.ToString("G15");

            ele.TryPathTo("Position/Z", true, out subEle);
            subEle.Value = PositionZ.ToString("G15");

            ele.TryPathTo("Rotation/X", true, out subEle);
            subEle.Value = RotationX.ToString("G15");

            ele.TryPathTo("Rotation/Y", true, out subEle);
            subEle.Value = RotationY.ToString("G15");

            ele.TryPathTo("Rotation/Z", true, out subEle);
            subEle.Value = RotationZ.ToString("G15");

            ele.TryPathTo("Alarm", true, out subEle);
            subEle.Value = Alarm.ToString();
        }
コード例 #4
0
        public void WriteXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Position/X", true, out subEle);
            subEle.Value = PositionX.ToString("G15");

            ele.TryPathTo("Position/Y", true, out subEle);
            subEle.Value = PositionY.ToString("G15");

            ele.TryPathTo("Position/Z", true, out subEle);
            subEle.Value = PositionZ.ToString("G15");

            ele.TryPathTo("Rotation/X", true, out subEle);
            subEle.Value = RotationX.ToString("G15");

            ele.TryPathTo("Rotation/Y", true, out subEle);
            subEle.Value = RotationY.ToString("G15");

            ele.TryPathTo("Rotation/Z", true, out subEle);
            subEle.Value = RotationZ.ToString("G15");

            ele.TryPathTo("Scale", true, out subEle);
            subEle.Value = Scale.ToString("G15");
        }
コード例 #5
0
ファイル: GameSave.cs プロジェクト: public/NoitaSaveManager
        public void SaveEncryptedData()
        {
            string playerFile = Path.Combine(Location, "player.salakieli");

            if (File.Exists(playerFile))
            {
                string      contents = GameSaveCrypto.Decrypt(playerFile);
                XmlDocument xmlDoc   = new XmlDocument();
                xmlDoc.LoadXml(contents);

                XmlNode transformNode = xmlDoc.SelectSingleNode("//Entity/_Transform");
                transformNode.Attributes["position.x"].Value = PositionX.ToString();
                transformNode.Attributes["position.y"].Value = PositionY.ToString();

                XmlNode damageNode = xmlDoc.SelectSingleNode("//Entity/DamageModelComponent");
                damageNode.Attributes["hp"].Value     = (HP / 25f).ToString();
                damageNode.Attributes["max_hp"].Value = (MaxHP / 25f).ToString();

                XmlNode walletNode = xmlDoc.SelectSingleNode("//Entity/WalletComponent");
                walletNode.Attributes["money"].Value = Money.ToString();

                XmlNode gameLogNode = xmlDoc.SelectSingleNode("//Entity/GameLogComponent");
                gameLogNode.Attributes["report_damage"].Value = ReportDamage ? "1" : "0";

                using (var stringWriter = new StringWriter())
                    using (var xmlTextWriter = XmlWriter.Create(stringWriter))
                    {
                        xmlDoc.WriteTo(xmlTextWriter);
                        xmlTextWriter.Flush();
                        GameSaveCrypto.Encrypt(playerFile, stringWriter.GetStringBuilder().ToString());
                    }
            }
        }
コード例 #6
0
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Width", true, out subEle);
            subEle.Value = Width.ToString("G15");

            ele.TryPathTo("Height", true, out subEle);
            subEle.Value = Height.ToString("G15");

            ele.TryPathTo("Position/X", true, out subEle);
            subEle.Value = PositionX.ToString("G15");

            ele.TryPathTo("Position/Y", true, out subEle);
            subEle.Value = PositionY.ToString("G15");

            ele.TryPathTo("Position/Z", true, out subEle);
            subEle.Value = PositionZ.ToString("G15");

            ele.TryPathTo("Rotation/Quaternion1", true, out subEle);
            subEle.Value = RotationQuaternion1.ToString("G15");

            ele.TryPathTo("Rotation/Quaternion2", true, out subEle);
            subEle.Value = RotationQuaternion2.ToString("G15");

            ele.TryPathTo("Rotation/Quaternion3", true, out subEle);
            subEle.Value = RotationQuaternion3.ToString("G15");

            ele.TryPathTo("Rotation/Quaternion4", true, out subEle);
            subEle.Value = RotationQuaternion4.ToString("G15");
        }
コード例 #7
0
ファイル: Camera.cs プロジェクト: jerbtrundles/procedural_map
        public static string CoordinatesString()
        {
            StringBuilder sb = new StringBuilder("{");

            sb.Append(PositionX.ToString("F"));
            sb.Append(", ");
            sb.Append(PositionY.ToString("F"));
            sb.Append("}");
            return(sb.ToString());
        }
コード例 #8
0
            internal List <Tuple <String, String> > GetAttributes()
            {
                var res = new List <Tuple <String, String> >();

                res.Add(new Tuple <String, String>("position_x", PositionX.ToString(CultureInfo.InvariantCulture)));
                res.Add(new Tuple <String, String>("position_y", PositionY.ToString(CultureInfo.InvariantCulture)));
                res.Add(new Tuple <String, String>("position_z", PositionZ.ToString(CultureInfo.InvariantCulture)));
                res.Add(new Tuple <String, String>("orientation_x", OrientationX.ToString(CultureInfo.InvariantCulture)));
                res.Add(new Tuple <String, String>("orientation_y", OrientationY.ToString(CultureInfo.InvariantCulture)));
                res.Add(new Tuple <String, String>("orientation_z", OrientationZ.ToString(CultureInfo.InvariantCulture)));
                return(res);
            }
コード例 #9
0
        internal XmlNode GetXmlImage(XmlDocument document)
        {
            XmlNode parent = document.CreateNode(XmlNodeType.Element, "image", "");

            XmlNode id = document.CreateNode(XmlNodeType.Element, "id", "");

            id.InnerText = Id;

            XmlNode name = document.CreateNode(XmlNodeType.Element, "name", "");

            name.InnerText = ImageName;

            XmlNode path = document.CreateNode(XmlNodeType.Element, "path", "");

            path.InnerText = ImagePath.ToString();

            XmlNode width = document.CreateNode(XmlNodeType.Element, "width", "");

            width.InnerText = Width.ToString();

            XmlNode height = document.CreateNode(XmlNodeType.Element, "height", "");

            height.InnerText = Height.ToString();

            XmlNode positionX = document.CreateNode(XmlNodeType.Element, "positionX", "");

            positionX.InnerText = PositionX.ToString();

            XmlNode positionY = document.CreateNode(XmlNodeType.Element, "positionY", "");

            positionY.InnerText = PositionY.ToString();

            XmlNode row = document.CreateNode(XmlNodeType.Element, "row", "");

            row.InnerText = Row.ToString();

            XmlNode column = document.CreateNode(XmlNodeType.Element, "column", "");

            column.InnerText = Column.ToString();

            parent.AppendChild(id);
            parent.AppendChild(name);
            parent.AppendChild(path);
            parent.AppendChild(width);
            parent.AppendChild(height);
            parent.AppendChild(positionX);
            parent.AppendChild(positionY);
            parent.AppendChild(row);
            parent.AppendChild(column);

            return(parent);
        }
コード例 #10
0
		public override string ToString() {
			return Frames.ToString().PadLeft(4, ' ') + (Jump ? ",Jump" : "") + (Save ? ",Save" : "") + (Fire ? ",Fire" : "") + (Bash ? ",Bash" : "") +
				(ChargeJump ? ",CJump" : "") + (Glide ? ",Glide" : "") + (Start ? ",Start" : "") + (Select ? ",Select" : "") + (UI ? ",UI" : "") +
				(Action ? ",Action" : "") + (Esc ? ",Esc" : "") + (Dash ? ",Dash" : "") + (Grenade ? ",Grenade" : "") +
				Axis() + (DLoad ? ",DLoad" : "") + (DSave ? ",DSave" : "") + (SaveSlot >= 0 ? ",Slot," + (SaveSlot + 1) : "") +
				(!Position ? "" : ",Pos," + PositionX.ToString("0.####") + "," + PositionY.ToString("0.####")) +
				(!Speed ? "" : ",Speed," + SpeedX.ToString("0.####") + "," + SpeedY.ToString("0.####")) +
				(XP >= 0 ? ",XP," + XP : "") + (Color ? ",Color" : "") + (Random >= 0 ? ",Random," + Random : "") +
				(!EntityPos ? "" : ",EntityPos," + EntityPosX.ToString("0.####") + "," + EntityPosY.ToString("0.####")) +
				(!BlockPos ? "" : ",BlockPos," + BlockPosX.ToString("0.####") + "," + BlockPosY.ToString("0.####")) +
				(EntityHP < 0 ? "" : ",EntityHP," + EntityHP.ToString("0.##")) + (HP >= 0 ? ",HP," + HP.ToString("0.#") : "") + (EN >= 0 ? ",EN," + EN.ToString("0.##") : "") +
				(Restore ? ",Restore" : "") + (Copy >= 0 ? ",Copy," + (Copy + 1) : "") + (SkillTree >= 0 ? ",SkillTree," + SkillTree : "") +
				(MouseX < 0 && MouseY < 0 ? "" : ",Mouse," + MouseX.ToString("0.####") + "," + MouseY.ToString("0.####"));
		}
コード例 #11
0
 internal void Read(EndianBinaryReader reader)
 {
     EyeX.Read(reader);
     EyeY.Read(reader);
     EyeZ.Read(reader);
     PositionX.Read(reader);
     PositionY.Read(reader);
     PositionZ.Read(reader);
     DirectionX.Read(reader);
     DirectionY.Read(reader);
     DirectionZ.Read(reader);
     RotationX.Read(reader);
     RotationY.Read(reader);
     RotationZ.Read(reader);
     Zoom.Read(reader);
 }
コード例 #12
0
 internal void Write(EndianBinaryWriter writer)
 {
     EyeX.Write(writer);
     EyeY.Write(writer);
     EyeZ.Write(writer);
     PositionX.Write(writer);
     PositionY.Write(writer);
     PositionZ.Write(writer);
     DirectionX.Write(writer);
     DirectionY.Write(writer);
     DirectionZ.Write(writer);
     RotationX.Write(writer);
     RotationY.Write(writer);
     RotationZ.Write(writer);
     Zoom.Write(writer);
 }
コード例 #13
0
 private void Grid_Loaded(object sender, RoutedEventArgs e)
 {
     txtAgvCarName.Text = AgvName;
     if (AgvSate == (byte)AgvStateInfor.Charge)
     {
         stateAgvStatus.Fill = Brushes.Green;
     }
     else if (AgvSate == (byte)AgvStateInfor.Abnormal)
     {
         stateAgvStatus.Fill = Brushes.Red;
     }
     txtAgvStatus.Text = "2";
     txtAgvTask.Text   = TriggerId.ToString() + "站台";
     txtPositionX.Text = PositionX.ToString("f3");
     txtPositionY.Text = PositionY.ToString("f3");
     txtWeight.Text    = Weight.ToString("f1") + "Kg";
 }
コード例 #14
0
        public void Load(XElement stbElem, StbVersion version)
        {
            switch (version)
            {
            case StbVersion.Ver1:
                IEnumerable <XElement> xOpens = stbElem.Elements("StbOpen");
                foreach (XElement xOpen in xOpens)
                {
                    if (xOpen.Attribute("id") != null)
                    {
                        Id.Add((int)xOpen.Attribute("id"));
                    }
                    else
                    {
                        Id.Add(0);
                    }

                    if (xOpen.Attribute("name") != null)
                    {
                        Name.Add((string)xOpen.Attribute("name"));
                    }
                    else
                    {
                        Name.Add(string.Empty);
                    }

                    IdSection.Add((int)xOpen.Attribute("id_section"));
                    PositionX.Add((double)xOpen.Attribute("position_X"));
                    PositionY.Add((double)xOpen.Attribute("position_Y"));
                    LengthX.Add((double)xOpen.Attribute("length_X"));
                    LengthY.Add((double)xOpen.Attribute("length_Y"));
                    Rotate.Add((double)xOpen.Attribute("rotate"));
                }
                break;

            case StbVersion.Ver2:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(version), version, "The STB version is not set");
            }
        }
コード例 #15
0
        internal void Write(EndianBinaryWriter writer)
        {
            writer.Write((short)Shader);
            writer.Write(UnkownFlag);

            ScaleXOrigin.Write(writer);
            ScaleYOrigin.Write(writer);

            PositionX.Write(writer);
            PositionY.Write(writer);

            Rotation.Write(writer);

            ScaleX.Write(writer);
            ScaleY.Write(writer);

            Opacity.Write(writer);

            writer.Write(UnknownInt);
        }
コード例 #16
0
        public int CompareTo(StaticPlacement other)
        {
            int result = 0;

            if (result == 0 && PositionZ != null && other.PositionZ != null)
            {
                result = PositionZ.CompareTo(other.PositionZ);
            }

            if (result == 0 && PositionX != null && other.PositionX != null)
            {
                result = PositionX.CompareTo(other.PositionX);
            }

            if (result == 0 && PositionY != null && other.PositionY != null)
            {
                result = PositionY.CompareTo(other.PositionY);
            }

            if (result == 0 && RotationX != null && other.RotationX != null)
            {
                result = RotationX.CompareTo(other.RotationX);
            }

            if (result == 0 && RotationY != null && other.RotationY != null)
            {
                result = RotationY.CompareTo(other.RotationY);
            }

            if (result == 0 && RotationZ != null && other.RotationZ != null)
            {
                result = RotationZ.CompareTo(other.RotationZ);
            }

            if (result == 0 && Scale != null && other.Scale != null)
            {
                result = Scale.CompareTo(other.Scale);
            }

            return(result);
        }
コード例 #17
0
        internal void Write(EndianBinaryWriter writer)
        {
            TransferMode.Write(writer);

            if (writer.AddressSpace == AddressSpace.Int64)
            {
                writer.WriteNulls(4);
            }

            AnchorX.Write(writer);
            AnchorY.Write(writer);
            PositionX.Write(writer);
            PositionY.Write(writer);
            Rotation.Write(writer);
            ScaleX.Write(writer);
            ScaleY.Write(writer);
            Opacity.Write(writer);

            writer.ScheduleWriteOffsetIf(Video3D != null, 8, AlignmentMode.Left, () =>
            {
                Video3D.Write(writer);
            });
        }
コード例 #18
0
        protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
        {
            recipientName    = RecipientName.Get(context);
            recipientEmail   = RecipientEmail.Get(context);
            subject          = Subject.Get(context);
            documentFilePath = DocumentFilePath.Get(context);
            sigX             = PositionX.Get(context);
            sigY             = PositionY.Get(context);

            anchorText = AnchorText.Get(context);
            offsetX    = OffsetX.Get(context);
            offsetY    = OffsetY.Get(context);

            if (anchorText != null && anchorText != "" && Path.GetExtension(documentFilePath) != ".pdf")
            {
                throw new FormatException("Can only use relative positioning on .pdf files");
            }

            LoadAuthentication(context);

            SendEnvelopeDelegate = new Action(SendEnvelope);
            return(SendEnvelopeDelegate.BeginInvoke(callback, state));
        }
コード例 #19
0
        internal void Read(EndianBinaryReader reader)
        {
            TransferMode.Read(reader);

            if (reader.AddressSpace == AddressSpace.Int64)
            {
                reader.SeekCurrent(4);
            }

            AnchorX.Read(reader);
            AnchorY.Read(reader);
            PositionX.Read(reader);
            PositionY.Read(reader);
            Rotation.Read(reader);
            ScaleX.Read(reader);
            ScaleY.Read(reader);
            Opacity.Read(reader);

            reader.ReadOffset(() =>
            {
                Video3D = new LayerVideo3D();
                Video3D.Read(reader);
            });
        }
コード例 #20
0
ファイル: ToyRobot.cs プロジェクト: Azsael/ToyRobot
        public Position GetNextPosition()
        {
            if (!IsPlaced)
            {
                return(null);
            }

            if (!Direction.HasValue)
            {
                return(null);
            }

            switch (Direction.Value)
            {
            case RobotDirection.North:
                return(new Position {
                    X = PositionX.GetValueOrDefault(), Y = PositionY.GetValueOrDefault() + Speed
                });

            case RobotDirection.East:
                return(new Position {
                    X = PositionX.GetValueOrDefault() + Speed, Y = PositionY.GetValueOrDefault()
                });

            case RobotDirection.South:
                return(new Position {
                    X = PositionX.GetValueOrDefault(), Y = PositionY.GetValueOrDefault() - Speed
                });

            case RobotDirection.West:
                return(new Position {
                    X = PositionX.GetValueOrDefault() - Speed, Y = PositionY.GetValueOrDefault()
                });
            }
            return(null);
        }
コード例 #21
0
 public bool ShouldSerializePositionY() =>
 SerializeDefaults ||
 !PositionY.Equals(ZPLForgeDefaults.Elements.PositionY);
コード例 #22
0
ファイル: Node.cs プロジェクト: rt-2/CodeWalker
 public override string ToString()
 {
     return(PositionX.ToString() + ", " + PositionY.ToString() + ": " + MinZ.ToString() + ", " + MaxZ.ToString() + ": " + HeightmapDimX.ToString() + " x " + HeightmapDimY.ToString());
 }
コード例 #23
0
 public static PositionY LerpUnclamped(PositionY a, PositionY b, float t)
 {
     return(new PositionY(Mathf.LerpUnclamped(a.Float, b.Float, t)));
 }
コード例 #24
0
 public static PositionY Clamp(PositionY value, PositionY min, PositionY max)
 {
     return(new PositionY(Mathf.Clamp(value.Float, min.Float, max.Float)));
 }
コード例 #25
0
 public static PositionY Max(PositionY a, PositionY b)
 {
     return(new PositionY(Mathf.Max(a.Float, b.Float)));
 }
コード例 #26
0
 public static PositionY Clamp01(PositionY value)
 {
     return(new PositionY(Mathf.Clamp01(value.Float)));
 }
コード例 #27
0
ファイル: Menu.cs プロジェクト: wonrst/TizenFX
        // Calculate menu's position based on Anchor and parent's positions.
        // If there is not enought space, then menu's size can be also resized.
        private void CalculateMenuPosition()
        {
            if ((Anchor == null) || (Content == null))
            {
                return;
            }

            if (Items == null)
            {
                return;
            }

            if (SizeWidth.Equals(0) && SizeHeight.Equals(0))
            {
                return;
            }

            float menuScreenPosX = 0;
            float menuScreenPosY = 0;

            if (HorizontalPositionToAnchor == RelativePosition.Start)
            {
                if (GetRootView().LayoutDirection == ViewLayoutDirectionType.LTR)
                {
                    menuScreenPosX = Anchor.ScreenPosition.X - SizeWidth;
                }
                else
                {
                    menuScreenPosX = Anchor.ScreenPosition.X + Anchor.Margin.Start + Anchor.SizeWidth + Anchor.Margin.End;
                }
            }
            else if (HorizontalPositionToAnchor == RelativePosition.Center)
            {
                menuScreenPosX = Anchor.ScreenPosition.X + Anchor.Margin.Start + (Anchor.SizeWidth / 2) - (SizeWidth / 2);
            }
            else
            {
                if (GetRootView().LayoutDirection == ViewLayoutDirectionType.LTR)
                {
                    menuScreenPosX = Anchor.ScreenPosition.X + Anchor.Margin.Start + Anchor.SizeWidth + Anchor.Margin.End;
                }
                else
                {
                    menuScreenPosX = Anchor.ScreenPosition.X - SizeWidth;
                }
            }

            if (VerticalPositionToAnchor == RelativePosition.Start)
            {
                menuScreenPosY = Anchor.ScreenPosition.Y - SizeHeight;
            }
            else if (VerticalPositionToAnchor == RelativePosition.Center)
            {
                menuScreenPosY = Anchor.ScreenPosition.Y + Anchor.Margin.Top + (Anchor.SizeHeight / 2) - (SizeHeight / 2);
            }
            else
            {
                menuScreenPosY = Anchor.ScreenPosition.Y + Anchor.Margin.Top + Anchor.SizeHeight + Anchor.Margin.Bottom;
            }

            float menuSizeW = SizeWidth;
            float menuSizeH = SizeHeight;

            // Check if menu is not inside parent's boundary in x coordinate system.
            if (menuScreenPosX + SizeWidth > Window.Size.Width)
            {
                if (HorizontalPositionToAnchor == RelativePosition.Center)
                {
                    menuScreenPosX = Window.Size.Width - SizeWidth;
                }
                else
                {
                    menuSizeW = Window.Size.Width - menuScreenPosX;
                }
            }
            if (menuScreenPosX < 0)
            {
                menuScreenPosX = 0;
                menuSizeW      = Window.Size.Width;
            }

            // Check if menu is not inside parent's boundary in y coordinate system.
            if (menuScreenPosY + SizeHeight > Window.Size.Height)
            {
                if (VerticalPositionToAnchor == RelativePosition.Center)
                {
                    menuScreenPosY = Window.Size.Height - SizeHeight;
                }
                else
                {
                    menuSizeH = Window.Size.Height - menuScreenPosY;
                }
            }
            if (menuScreenPosY < 0)
            {
                menuScreenPosY = 0;
                menuSizeH      = Window.Size.Height;
            }

            // Position is relative to parent's coordinate system.
            var menuPosX = menuScreenPosX;
            var menuPosY = menuScreenPosY;

            if (!PositionX.Equals(menuPosX) || !PositionY.Equals(menuPosY) || !SizeWidth.Equals(menuSizeW) || !SizeHeight.Equals(menuSizeH))
            {
                Position = new Position(menuPosX, menuPosY);
                Size     = new Size(menuSizeW, menuSizeH);
            }
        }
コード例 #28
0
        protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            // Inputs
            var timeout    = TimeoutMS.Get(context);
            var inputImage = InputImage.Get(context);
            var positionX  = PositionX.Get(context);
            var positionY  = PositionY.Get(context);
            var width      = Width.Get(context);
            var height     = Height.Get(context);
            var blur       = Blur.Get(context);
            var blurAmount = BlurAmount.Get(context);

            // Set a timeout on the execution
            var task = ExecuteWithTimeout(context, cancellationToken);

            if (await Task.WhenAny(task, Task.Delay(timeout, cancellationToken)) != task)
            {
                throw new TimeoutException(Resources.Timeout_Error);
            }

            Image returnImage;

            // Check if activity should blur or hide part of the image

            if (blur)
            {
                // Convert image to bytestream
                ImageConverter _imageConverter = new ImageConverter();
                byte[]         imageByteStream = (byte[])_imageConverter.ConvertTo(inputImage, typeof(byte[]));

                // Create image from bytestream for MagickImage use
                var magickimage = new MagickImage(imageByteStream);

                // Blur part of image
                magickimage.RegionMask(new MagickGeometry(positionX, positionY, width, height));
                magickimage.GaussianBlur(blurAmount, 25);
                magickimage.RemoveRegionMask();

                // Convert MagickInmage to Bytestream
                var          imageBytesOut = magickimage.ToByteArray();
                MemoryStream ms            = new MemoryStream(imageBytesOut);

                // Create return image from bytestream
                returnImage = Image.FromStream(ms);
            }
            else
            {
                // Create graphics context with returnImage
                returnImage = inputImage;

                using (Graphics g = Graphics.FromImage(returnImage))
                {
                    // Define brush and rectangle
                    SolidBrush blackBrush = new SolidBrush(Color.Black);
                    Rectangle  rect       = new Rectangle(positionX, positionY, width, height);

                    // Fill rectangle
                    g.FillRectangle(blackBrush, rect);

                    // Cleanup
                    g.Dispose();
                }
            }

            // Outputs
            return((ctx) => {
                OutputImage.Set(ctx, returnImage);
            });
        }