public SymbolBitmapCache(SymbolDrawingCache symbolDrawingCache, double size) { m_symbolDrawingCache = symbolDrawingCache; m_size = size; var arr = (SymbolID[])Enum.GetValues(typeof(SymbolID)); var max = arr.Max(); m_blackBitmapList = new CacheData[(int)max + 1]; m_bitmapMap = new Dictionary<SymbolID, Dictionary<Color, CacheData>>(); }
public SymbolBitmapCache(SymbolDrawingCache symbolDrawingCache, double size) { m_symbolDrawingCache = symbolDrawingCache; m_size = size; var arr = (SymbolID[])Enum.GetValues(typeof(SymbolID)); var max = arr.Max(); m_blackBitmapList = new CacheData[(int)max + 1]; m_bitmapMap = new Dictionary <SymbolID, Dictionary <Color, CacheData> >(); }
public Form1() { m_scene = new WinFormsScene(this.Handle); m_symbolDrawingCache = new SymbolDrawingCache(new Uri("/Symbols/SymbolInfosGfx.xaml", UriKind.Relative)); m_scene.SymbolDrawingCache = m_symbolDrawingCache; m_renderData = new RenderData<RenderTileDetailed>(); m_scene.SetRenderData(m_renderData); InitializeComponent(); }
public MapControl3() { m_drawingCache = new DrawingCache(); m_symbolDrawingCache = new SymbolDrawingCache(m_drawingCache); m_symbolBitmapCache = new SymbolBitmapCache(m_symbolDrawingCache, m_tileSize); m_map = new Map(512, 512); for (int y = 0; y < m_map.Height; ++y) { for (int x = 0; x < m_map.Width; ++x) { m_map.MapArray[y, x] = (x + (y % 2)) % 2 == 0 ? (byte)50 : (byte)255; } } }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); tileControl.AboutToRender += tileControl_AboutToRender; tileControl.TileLayoutChanged += tileControl_TileArrangementChanged; var symbolDrawingCache = new SymbolDrawingCache(new Uri("/Symbols/SymbolInfosGfx.xaml", UriKind.Relative)); tileControl.SymbolDrawingCache = symbolDrawingCache; m_renderData = new RenderData<RenderTileDetailed>(); tileControl.SetRenderData(m_renderData); tileControl.TileSize = 32; m_targetTileSize = tileControl.TileSize; this.MouseWheel += new MouseWheelEventHandler(MainWindow_MouseWheel); this.KeyDown += new KeyEventHandler(MainWindow_KeyDown); CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering); m_timer = new DispatcherTimer(TimeSpan.FromSeconds(1), DispatcherPriority.Normal, OnTimerCallback, this.Dispatcher); }
public MapControl4() { m_drawingCache = new DrawingCache(); m_symbolDrawingCache = new SymbolDrawingCache(m_drawingCache); m_symbolBitmapCache = new SymbolBitmapCache(m_symbolDrawingCache, m_tileSize); m_map = new Map(512, 512); for (int y = 0; y < m_map.Height; ++y) { for (int x = 0; x < m_map.Width; ++x) { m_map.MapArray[y, x] = (x + (y % 2)) % 2 == 0 ? (byte)50 : (byte)255; } } m_bmpArray = new BitmapSource[10]; for (int i = 0; i < 10; ++i) m_bmpArray[i] = m_symbolBitmapCache.GetBitmap((SymbolID)i, Colors.Black, false); m_mcd2d = new TileControlD2D(); m_mcd2d.SetSymbolBitmaps(m_bmpArray, m_tileSize); AddChild(m_mcd2d); }