예제 #1
0
        public static Bitmap GetSkillTree(Heroes3Master master)
        {
            if (_skillTree2 != null)
            {
                return(_skillTree2);
            }

            if (_defFile == null)
            {
                _defFile = master.ResolveWith(IMG_FNAME).GetDefFile();
            }



            int rowCount = 3 * AllSkills.Count / ALL_COLNUMBER;

            var bmp       = new Bitmap((44 + 1) * ALL_COLNUMBER, (44 + 1) * rowCount, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            var imageData = bmp.LockBits24();

            Parallel.For(0, AllSkills.Count * 3, i =>
            {
                int row = i / ALL_COLNUMBER;
                int col = i % ALL_COLNUMBER;

                var img = _defFile.GetByAbsoluteNumber2(3 + row * ALL_COLNUMBER + col);
                imageData.DrawImage24(col * (44 + 1), row * (44 + 1), 132, img);
            });

            bmp.UnlockBits(imageData);
            _skillTree2 = bmp;

            return(_skillTree2);
        }
예제 #2
0
        public static Bitmap GetAllCreaturesBitmapParallel(Heroes3Master master)
        {
            if (BitmapCache.CreaturesAll != null)
            {
                return(BitmapCache.CreaturesAll);
            }

            var h3sprite = master.Resolve(IMG_FNAME);

            if (creatureDef == null)
            {
                creatureDef = h3sprite.GetRecord(IMG_FNAME).GetDefFile();
            }

            int totalrows = OnlyActiveCreatures.Count / 14 + (OnlyActiveCreatures.Count % 14 == 0 ? 0 : 1);
            var bmp       = new Bitmap((58 + 1) * 14, (64 + 1) * totalrows);
            var imageData = bmp.LockBits24();

            Parallel.For(0, OnlyActiveCreatures.Count, i =>
            {
                int row = i / 14;
                int col = i % 14;
                var img = creatureDef.GetByAbsoluteNumber2(OnlyActiveCreatures[i].CreatureIndex + 2);
                if (img != null)
                {
                    imageData.DrawImage24(col * (58 + 1), row * (64 + 1), 176, img);
                }
            });

            bmp.UnlockBits(imageData);

            BitmapCache.CreaturesAll = bmp;
            return(BitmapCache.CreaturesAll);
        }
예제 #3
0
        public static Bitmap GetAllResources(Heroes3Master master)
        {
            if (BitmapCache.ResourcesAll != null)
            {
                return(BitmapCache.ResourcesAll);
            }

            var h3sprite = master.Resolve(IMG_FNAME);

            if (defFile == null)
            {
                defFile = h3sprite.GetRecord(IMG_FNAME).GetDefFile();
            }

            var bmp       = new Bitmap((82 + 1) * 7, 93, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            var imageData = bmp.LockBits24();

            Parallel.For(0, 7, i =>
            {
                var img = defFile.GetByAbsoluteNumber2(i);
                imageData.DrawImage24(i * (82 + 1), 0, 248, img);
            });

            bmp.UnlockBits(imageData);
            BitmapCache.ResourcesAll = bmp;

            return(BitmapCache.ResourcesAll);
        }
예제 #4
0
        public static Bitmap GetAllSpells(Heroes3Master master)
        {
            if (BitmapCache.SpellsAll != null)
            {
                return(BitmapCache.SpellsAll);
            }

            if (defFile == null)
            {
                defFile = master.ResolveWith(IMG_FNAME).GetDefFile();
            }

            int total = defFile.headers[0].SpritesCount;

            var baseSprite = defFile.headers[0].spriteHeaders[0];
            int imgWidth   = baseSprite.SpriteWidth;
            int imgHeight  = baseSprite.SpriteHeight;
            int stride     = baseSprite.Stride24;

            int colCount = ALL_SPELLS_COLUMN_NUMBER;
            int rowCount = (total / colCount) + (total % colCount == 0 ? 0 : 1);

            var bmp       = new Bitmap((imgWidth + 1) * colCount, (imgHeight + 1) * rowCount);
            var imageData = bmp.LockBits24();

            Parallel.For(0, total, i =>
            {
                int row = i / colCount;
                int col = i % colCount;

                var img = defFile.GetByAbsoluteNumber2(i);
                if (img != null)
                {
                    imageData.DrawImage24(col * (imgWidth + 1), row * (imgHeight + 1), stride, img);
                }
            });

            bmp.UnlockBits(imageData);
            BitmapCache.SpellsAll = bmp;
            return(BitmapCache.SpellsAll);
        }