public IndexedImage GetSymbolImage(char symbol, int imageSize, int fontRgb = 0, int backgroundRgb = 0x00ffffff) { symbolImageSize = imageSize; var symbolImage = new IndexedImage { Size = new Size(imageSize, imageSize) }; SymbolsPainter.PaintSymbol(symbol, symbolImage.Pixels, symbolImage.Size, default(Point), fontRgb: fontRgb, backgroundRgb: backgroundRgb); return(symbolImage); }
void UpdateImageQuick(int firstSymbol, int lastSymbolExclusive) { var clipRect = new Rectangle(0, 0, VisualImage.Size.Width, VisualImage.Size.Height); int[] imagePixels; using (VisualImage.LockPixels(out imagePixels)) { Parallel.For(firstSymbol, lastSymbolExclusive, index => { var cellX = index % ColumnsCount; var cellY = index / ColumnsCount; var point = new Point(cellX * CellSize, cellY * CellSize - VerticalShift); if (index >= Controller.AvailableSymbols.Count) { SymbolsPainter.PaintSymbol(' ', imagePixels, VisualImage.Size, point, clipRect, PlainFontColor, PlainBackground); } else { var symbolSelectionPair = Controller.AvailableSymbols[index]; var highlight = cellX == HighlightedCell.X && cellY == HighlightedCell.Y; int background, fontColor; if (symbolSelectionPair.Value) { background = highlight ? HighlightedSelectedBackground : SelectedBackground; fontColor = highlight ? HighlightedSelectedFontColor : SelectedFontColor; } else { background = highlight ? HighlightedPlainBackground : PlainBackground; fontColor = highlight ? HighlightedPlainFontColor : PlainFontColor; } SymbolsPainter.PaintSymbol(symbolSelectionPair.Key, imagePixels, VisualImage.Size, point, clipRect, fontColor, background); } }); } }