public Bitmap GetImage(Heroes3Master master, int level) { var lodFile = master.Resolve(IMG_FNAME); if (_defFile == null) { _defFile = lodFile.GetRecord(IMG_FNAME).GetDefFile(); } return(_defFile.GetByAbsoluteNumber(Index * 3 + level + 2)); }
public Bitmap GetImage(Heroes3Master master) { if (defFile == null) { defFile = master.ResolveWith(IMG_FNAME).GetDefFile(); } return(defFile.GetByAbsoluteNumber(Index)); }
public static Bitmap GetImage(Heroes3Master master, int index) { var lodFile = master.Resolve(IMG_FNAME); if (defFile == null) { defFile = lodFile.GetRecord(IMG_FNAME).GetDefFile(); } return(defFile.GetByAbsoluteNumber(index)); }
public static Bitmap GetImage(Heroes3Master master, int index) { var lodFile = master.Resolve(IMG_FNAME); if (creatureDef == null) { creatureDef = lodFile.GetRecord(IMG_FNAME).GetDefFile(); } var bmp = creatureDef.GetByAbsoluteNumber(index + 2); return(bmp); }
public unsafe static Bitmap GetSmallImage(Heroes3Master master, int creatureIndex) { var h3sprite = master.Resolve(IMG_SMALL_FNAME); if (smallCreatureDef == null) { smallCreatureDef = h3sprite.GetRecord(IMG_SMALL_FNAME).GetDefFile(); } Bitmap bmp; if (BitmapCache.CreaturesSmall[creatureIndex] == null) { bmp = smallCreatureDef.GetByAbsoluteNumber(creatureIndex + 2); var creature = AllCreatures2[creatureIndex]; var clr = Town.AllColors[creature.TownIndex]; var imageData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format24bppRgb); for (int i = 0; i < imageData.Height; i++) { byte *offset = (byte *)imageData.Scan0 + i * imageData.Stride; for (int j = 0; j < imageData.Width; j++) { byte b = *offset; byte g = *(offset + 1); byte r = *(offset + 2); if (r == 0 && g == 0xff && b == 0xff) { *(offset++) = clr.B; *(offset++) = clr.G; *(offset++) = clr.R; } else { offset += 3; } } } bmp.UnlockBits(imageData); BitmapCache.CreaturesSmall[creatureIndex] = bmp; } return(BitmapCache.CreaturesSmall[creatureIndex]); }