private static Bitmap GetBitmap(Cache.CacheType cacheType, string name, IconGenerator.IconType type, int size, Color borderColor, float borderWidth, out Cache cache) { SetIconGeneratorSettings(type, size, borderColor, borderWidth); cache = CreateCache(cacheType, name); if (BitmapCache.ContainsKey(cache)) { return(BitmapCache[cache]); //Bitmap has been created already, return it. } //Bitmap has been created yet, so lets create it and cache it. return(BitmapCache[cache] = IconGenerator.GetIcon(name)); // All done, returning sprite. }
static IconManager() { IconGenerator = new IconGenerator(IconGenerator.IconType.Circle, 32, 32, IconGenerator.DefaultGoldColor, 2); BitmapCache = new Dictionary <Cache, Bitmap>(); SpriteCache = new Dictionary <Cache, Sprite>(); }