Exemplo n.º 1
0
        /// <summary>
        /// Creates a clone of the TextureOptions object with the exact same properties.
        /// </summary>
        public TextureOptions Clone()
        {
            TextureOptions clone = new TextureOptions(Format, _scale, NumMipMaps, PremultipliedAlpha);

            clone.OptimizeForRenderToTexture = OptimizeForRenderToTexture;
            return(clone);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Uploads a texture to the GPU.
        /// Currently only 24 bit RBGA images are supported.
        /// </summary>
        /// <param name="imgData">The image data, either an byte[] or IntPtr</param>
        /// <param name="properties"></param>
        /// <param name="width">in points; number of pixels depends on scale parameter.</param>
        /// <param name="height">in points; number of pixels depends on scale parameter.</param>
        public static Texture FromData(object imgData, TextureOptions properties,
                                       int width, int height)
        {
            if (imgData == null)
            {
                throw new ArgumentException("imgData cannot be null!");
            }
            Texture tex = Empty(width, height, properties.PremultipliedAlpha,
                                properties.NumMipMaps, properties.OptimizeForRenderToTexture,
                                properties.Scale, properties.Format);

            tex.Root.UploadData(imgData);
            return(tex);
        }