Exemplo n.º 1
0
        private void drawAnim()
        {
            var target   = new Bitmap(sizeX, sizeY, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            var graphics = Graphics.FromImage(target);

            graphics.CompositingMode = CompositingMode.SourceOver;

            drawImageCenter(graphics, tile, getX(0, 0), getY(0, 0));
            drawImageCenter(graphics, tile, getX(1, 0), getY(1, 0));
            drawImageCenter(graphics, tile, getX(2, 0), getY(2, 0));
            drawImageCenter(graphics, tile, getX(0, 1), getY(0, 1));
            drawImageCenter(graphics, tile, getX(1, 1), getY(1, 1));
            drawImageCenter(graphics, tile, getX(2, 1), getY(2, 1));
            drawImageCenter(graphics, tile, getX(0, 2), getY(0, 2));
            drawImageCenter(graphics, tile, getX(1, 2), getY(1, 2));
            drawImageCenter(graphics, tile, getX(2, 2), getY(2, 2));

            foreach (string frame in selectedAnim.AnimationFrames[currentFrame])
            {
                try
                {
                    ItemImage itemImage = images.Values.FirstOrDefault(x => x.RealName == frame);
                    if (itemImage != null)
                    {
                        drawImageCenter(graphics, new Bitmap(itemImage.Image), getX(1, 1) - itemImage.offX, getY(1, 1) - itemImage.offY);
                    }
                }
                catch
                {
                }
            }

            preview.BackgroundImage = target;
        }
Exemplo n.º 2
0
        private void imageNames_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string    itemName = imageNames.SelectedItem.ToString();
                ItemImage item     = images.Values.FirstOrDefault(x => x.RealName == itemName);

                if (item == null)
                {
                    return;
                }

                selectedItem  = item.Id;
                rotation.Text = item.Rotation.ToString();
                state.Text    = item.State.ToString();
                layer.Text    = item.Layer.ToString();
                depth.Text    = item.Depth.ToString();
                offX.Value    = item.offX;
                offY.Value    = item.offY;
                itemPreview.BackgroundImage = item.Image;

                drawPreview(item.State);
            }
            catch
            {
            }
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string    itemName = imageNames.SelectedItem.ToString();
                ItemImage item     = images.Values.FirstOrDefault(x => x.RealName == itemName);

                if (item == null)
                {
                    return;
                }

                Clipboard.SetText(item.RealName);
            }
            catch
            {
            }
        }
Exemplo n.º 4
0
        private void drawPreview(int state)
        {
            ItemImage img = null;

            try
            {
                img = images[selectedItem];
            }
            catch
            {
                img = null;
            }

            if (img == null)
            {
                return;
            }

            var target   = new Bitmap(sizeX, sizeY, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            var graphics = Graphics.FromImage(target);

            graphics.CompositingMode = CompositingMode.SourceOver;

            drawImageCenter(graphics, tile, getX(0, 0), getY(0, 0));
            drawImageCenter(graphics, tile, getX(1, 0), getY(1, 0));
            drawImageCenter(graphics, tile, getX(2, 0), getY(2, 0));
            drawImageCenter(graphics, tile, getX(0, 1), getY(0, 1));
            drawImageCenter(graphics, tile, getX(1, 1), getY(1, 1));
            drawImageCenter(graphics, tile, getX(2, 1), getY(2, 1));
            drawImageCenter(graphics, tile, getX(0, 2), getY(0, 2));
            drawImageCenter(graphics, tile, getX(1, 2), getY(1, 2));
            drawImageCenter(graphics, tile, getX(2, 2), getY(2, 2));

            if (state >= 0)
            {
                foreach (ItemImage itemPart in images.Values.Where(x => x.State == state && x.Rotation == img.Rotation).OrderBy(x => x.Depth))
                {
                    drawImageCenter(graphics, new Bitmap(itemPart.Image), getX(1, 1) - itemPart.offX, getY(1, 1) - itemPart.offY);
                }
            }

            preview.BackgroundImage = target;
        }
Exemplo n.º 5
0
        private void imagesList_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                int       id   = int.Parse(imagesList.SelectedItem.ToString());
                ItemImage item = images[id];
                selectedItem  = id;
                rotation.Text = item.Rotation.ToString();
                state.Text    = item.State.ToString();
                layer.Text    = item.Layer.ToString();
                depth.Text    = item.Depth.ToString();
                offX.Value    = item.offX;
                offY.Value    = item.offY;
                itemPreview.BackgroundImage = item.Image;

                drawPreview(item.State);
            }
            catch
            {
            }
        }