Пример #1
0
        /// <summary>
        /// Converts this REXPaint image to a collection of <see cref="CellSurface"/>.
        /// </summary>
        /// <returns></returns>
        public IEnumerable <CellSurface> ToLayersComponent()
        {
            var layers = new CellSurface[LayerCount];

            for (int i = 0; i < LayerCount; i++)
            {
                layers[i] = new CellSurface(Width, Height);

                for (int y = 0; y < Height; y++)
                {
                    for (int x = 0; x < Width; x++)
                    {
                        Cell rexCell = _layers[i][x, y];
                        if (rexCell.IsTransparent())
                        {
                            continue;
                        }

                        SadConsole.ColoredGlyph newCell = layers[i][x, y];
                        newCell.Foreground = new SadRogueColor(rexCell.Foreground.R, rexCell.Foreground.G, rexCell.Foreground.B, (byte)255);
                        newCell.Background = new SadRogueColor(rexCell.Background.R, rexCell.Background.G, rexCell.Background.B, (byte)255);
                        newCell.Glyph      = rexCell.Character;
                    }
                }

                layers[i].IsDirty = true;
            }


            return(layers);
        }
Пример #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cell">The glyph to be drawn.</param>
 /// <param name="targetRect">Where on the <see cref="Host.Global.SharedSpriteBatch"/> the glyph should be drawn.</param>
 /// <param name="font">The font to use when drawing the glyph.</param>
 /// <param name="drawBackground">When <see langword="true"/>, draws the <see cref="ColoredGlyph.Background"/> color for the glyph; otherwise <see langword="false"/>.</param>
 public DrawCallCell(SadConsole.ColoredGlyph cell, Rectangle targetRect, IFont font, bool drawBackground)
 {
     Font           = font;
     TargetRect     = targetRect;
     Cell           = cell;
     DrawBackground = drawBackground;
 }