Exemplo n.º 1
0
        Texture GetImageForImageElement(ImageElement element)
        {
            Texture result = null;

            if (!String.IsNullOrEmpty(element.Filename))
            {
                if (!_imageCache.TryGetValue(element, out result))
                {
                    result = ToDispose(SharpDX.Direct3D9.Texture.FromFile(_device, element.Filename));

                    _imageCache[element] = result;
                }
            }
            else
            {
                if (!_imageCache.TryGetValue(element, out result))
                {
                    result = ToDispose(SharpDX.Direct3D9.Texture.FromStream(_device, element.GetStream()));
                    _imageCache[element] = result;
                }
            }
            return(result);
        }