GetStackImage() public static method

public static GetStackImage ( Image image, int count, Item item ) : Bitmap
image Image
count int
item Item
return Bitmap
Example #1
0
        public static Bitmap DrawCountOnItem(Item item, int itemCount)
        {
            Bitmap image;

            if (item.stackable)
            {
                image = new Bitmap(LootDropForm.GetStackImage(item.image, itemCount, item));
            }
            else
            {
                image = new Bitmap(item.image);
            }

            using (Graphics gr = Graphics.FromImage(image)) {
                int numbers = (int)Math.Floor(Math.Log(itemCount, 10)) + 1;
                int xoffset = 1, logamount = itemCount;
                for (int i = 0; i < numbers; i++)
                {
                    int imagenr = logamount % 10;
                    xoffset = xoffset + MainForm.image_numbers[imagenr].Width + (itemCount >= 1000 ? 0 : 1);
                    gr.DrawImage(MainForm.image_numbers[imagenr],
                                 new Point(image.Width - xoffset, image.Height - MainForm.image_numbers[imagenr].Height - 3));
                    logamount /= 10;
                }
            }
            return(image);
        }
Example #2
0
        public static Bitmap DrawCountOnItem(Item item, int itemCount)
        {
            Bitmap image;

            if (item.stackable)
            {
                try {
                    image = new Bitmap(LootDropForm.GetStackImage(item.image, itemCount, item));
                } catch {
                    image = new Bitmap(item.image);
                }
            }
            else
            {
                image = new Bitmap(item.image);
            }

            using (Graphics gr = Graphics.FromImage(image)) {
                int numbers = (int)Math.Floor(Math.Log(itemCount, 10)) + 1;
                int xoffset = 1, logamount = itemCount;
                for (int i = 0; i < numbers; i++)
                {
                    int   imagenr     = logamount % 10;
                    Image imageNumber = StyleManager.GetImage(imagenr + ".png");
                    xoffset = xoffset + imageNumber.Width + (itemCount >= 1000 ? 0 : 1);
                    lock (imageNumber) {
                        gr.DrawImage(imageNumber, new Point(image.Width - xoffset, image.Height - imageNumber.Height - 3));
                    }
                    logamount /= 10;
                }
            }
            return(image);
        }
Example #3
0
        public Image ItemBox(Item item, int amount = 0)
        {
            Bitmap bitmap = new Bitmap(ImageWidth, ImageHeight);

            using (Graphics gr = Graphics.FromImage(bitmap)) {
                using (Brush brush = new SolidBrush(StyleManager.MainFormButtonColor)) {
                    gr.FillRectangle(brush, new Rectangle(0, 0, bitmap.Width, bitmap.Height));
                }
                gr.DrawRectangle(Pens.Black, new Rectangle(0, 0, bitmap.Width - 1, bitmap.Height - 1));
                RenderImageResized(gr, StyleManager.GetImage("item_background.png"), new Rectangle(1, 1, ImageHeight - 2, ImageHeight - 2));
                RenderImageResized(gr, (amount > 1 || item.stackable) ? LootDropForm.GetStackImage(item.GetImage(), amount > 0 ? amount : 1, item) : item.GetImage(), new Rectangle(1, 1, ImageHeight - 2, ImageHeight - 2));
                RenderText(gr, item.displayname.ToTitle(), ImageHeight + 2, Color.Empty, StyleManager.NotificationTextColor);
                if (amount > 0)
                {
                    RenderText(gr, amount.ToString(), -ImageWidth, Color.FromArgb(StyleManager.MainFormButtonColor.R / 2, StyleManager.MainFormButtonColor.G / 2, StyleManager.MainFormButtonColor.B / 2), StyleManager.NotificationTextColor);
                }
            }
            return(bitmap);
        }
Example #4
0
        public static Bitmap DrawCountOnItem(Item item, int itemCount, int size = -1)
        {
            Bitmap image;

            if (item.stackable)
            {
                try {
                    image = new Bitmap(LootDropForm.GetStackImage(item.image, itemCount, item));
                } catch {
                    image = new Bitmap(item.image);
                }
            }
            else
            {
                image = new Bitmap(item.image);
            }

            using (Graphics gr = Graphics.FromImage(image)) {
                DrawCountOnGraphics(gr, itemCount, image.Width, image.Height);
            }
            return(image);
        }