Tibialyzer.LootDropForm.GetStackImage C# (CSharp) Method

GetStackImage() public static method

public static GetStackImage ( Image image, int count, Item item ) : Bitmap
image Image
count int
item Item
return Bitmap
        public static Bitmap GetStackImage(Image image, int count, Item item)
        {
            if (image == null) return new Bitmap(item.image);
            lock(image) {
                int max = image.GetFrameCount(FrameDimension.Time);
                int index = 0;

                if (count <= 5) index = count - 1;
                else if (count <= 10) index = 5;
                else if (count <= 25) index = 6;
                else if (count <= 50) index = 7;
                else index = 8;

                if (index >= max) index = max - 1;
                image.SelectActiveFrame(FrameDimension.Time, index);
                return new Bitmap((Image)image.Clone());
            }
        }

Usage 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);
        }
All Usage Examples Of Tibialyzer.LootDropForm::GetStackImage