Exemplo n.º 1
0
        private bool OnLoad(Guid key, out ISurface surface)
        {
            var texture = _animationData.Textures.SingleOrDefault(x => x.Id == key);

            if (texture != null)
            {
                var fileName = Path.Combine(_directory, texture.Name);
                if (File.Exists(fileName))
                {
                    var colorFilter = texture.Transparencies.Select(x =>
                                                                    System.Drawing.Color.FromArgb(
                                                                        (byte)(x >> 0),
                                                                        (byte)(x >> 24),
                                                                        (byte)(x >> 16),
                                                                        (byte)(x >> 8)))
                                      .ToArray();
                    surface = _drawing.CreateSurface(fileName, colorFilter);
                    return(true);
                }
            }
            surface = null;
            return(false);
        }
Exemplo n.º 2
0
 public static ISurface CreateSurface(this IDrawing drawing, IImageRead image) => drawing
 .CreateSurface(image.Size.Width,
                image.Size.Height,
                Xe.Drawing.PixelFormat.Format32bppArgb,
                SurfaceType.Input,
                new DataResource
 {
     Data   = image.AsBgra8888(),
     Stride = image.Size.Width * 4
 });
Exemplo n.º 3
0
 private void InitializeSurface(ref ISurface surface, IImageRead image)
 {
     surface?.Dispose();
     surface = _drawing?.CreateSurface(image);
 }
Exemplo n.º 4
0
 public static ISurface CreateSurface(this IDrawing drawing, IImageRead image) => drawing
 .CreateSurface(image.Size.Width,
                image.Size.Height,
                Xe.Drawing.PixelFormat.Format32bppArgb,
                SurfaceType.Input,
                GetDataResource(image));