private RenderTargetBitmap createBitmap(BaseSymbol symbol) { if (symbolCache.ContainsKey(symbol)) return symbolCache[symbol]; FrameworkElement element; switch (symbol.Type) { default: // ToDo: support different types element = new Pyramid {Color = symbol.Color}; break; } element.Width = element.Height = symbol.Size; element.Measure(new Size(element.Width, element.Height)); element.Arrange(new Rect(0, 0, element.Width, element.Height)); var bitmap = new RenderTargetBitmap((int)element.Width, (int)element.Height, 96, 96, PixelFormats.Pbgra32); bitmap.Render(element); bitmap.Freeze(); symbolCache.Add(symbol, bitmap); return bitmap; }