Ejemplo n.º 1
0
        /// <summary>
        /// Generate a surface from a bitmap, only update the specified tiles
        /// </summary>
        /// <param name="sId">The surface Id</param>
        /// <param name="bm">The original bitmap</param>
        /// <param name="changedTileIndexs">The indexes of the changed tiles</param>
        /// <returns>A surface instance</returns>
        public static SurfaceFrame GetFromImage(ushort sId, Bitmap bitmap, TileIndex[] changedTileIndexs)
        {
            SurfaceFrame surf = new SurfaceFrame(sId, (ushort)bitmap.Width, (ushort)bitmap.Height);

            foreach (TileIndex tIndex in changedTileIndexs)
            {
                RgbTile rgbTl = RgbTile.GetFromImage(bitmap, tIndex.X * RdpegfxTileUtils.TileSize, tIndex.Y * RdpegfxTileUtils.TileSize);
                surf.rgbTileDic.Add(tIndex, rgbTl);
            }
            return(surf);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Generate a surface from a bitmap
        /// </summary>
        /// <param name="sId">The surface Id</param>
        /// <param name="bm">The original bitmap</param>
        /// <returns>A surface instance</returns>
        public static SurfaceFrame GetFromImage(ushort sId, Bitmap bitmap)
        {
            SurfaceFrame surf = new SurfaceFrame(sId, (ushort)bitmap.Width, (ushort)bitmap.Height);

            for (int xIndex = 0; xIndex *RdpegfxTileUtils.TileSize < bitmap.Width; xIndex++)
            {
                for (int yIndex = 0; yIndex *RdpegfxTileUtils.TileSize < bitmap.Height; yIndex++)
                {
                    TileIndex tIndex = new TileIndex((ushort)xIndex, (ushort)yIndex, bitmap.Width, bitmap.Height);

                    RgbTile rgbTl = RgbTile.GetFromImage(bitmap, xIndex * RdpegfxTileUtils.TileSize, yIndex * RdpegfxTileUtils.TileSize);
                    surf.rgbTileDic.Add(tIndex, rgbTl);
                }
            }
            return(surf);
        }