Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GorgonGlyphTextureBrush"/> class.
 /// </summary>
 /// <param name="graphics">Graphics interface that is managing the texture used by the brush.</param>
 internal GorgonGlyphTextureBrush(GorgonGraphics graphics)
 {
     _graphics        = graphics.ImmediateContext;
     _textureSettings = new GorgonTexture2DSettings
     {
         Format     = BufferFormat.R8G8B8A8_UIntNormal,
         ArrayCount = 1,
         MipCount   = 1
     };
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GorgonTexture2D"/> class.
 /// </summary>
 /// <param name="graphics">The graphics interface that owns this texture.</param>
 /// <param name="name">The name of the texture.</param>
 /// <param name="settings">Settings to pass to the texture.</param>
 /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="name"/> parameter is NULL (Nothing in VB.Net).</exception>
 /// <exception cref="System.ArgumentException">Thrown when the <paramref name="name"/> parameter is an empty string.</exception>
 internal GorgonTexture2D(GorgonGraphics graphics, string name, ITextureSettings settings)
     : base(graphics, name, settings)
 {
     Settings = new GorgonTexture2DSettings
     {
         Width  = settings.Width,
         Height = settings.Height,
         AllowUnorderedAccessViews = settings.AllowUnorderedAccessViews,
         ArrayCount       = settings.ArrayCount,
         Format           = settings.Format,
         IsTextureCube    = settings.IsTextureCube,
         MipCount         = settings.MipCount,
         Multisampling    = settings.Multisampling,
         ShaderViewFormat = settings.ShaderViewFormat,
         Usage            = settings.Usage
     };
 }
Exemple #3
0
        /// <summary>
        /// Function to copy this texture into a new staging texture.
        /// </summary>
        /// <returns>
        /// The new staging texture.
        /// </returns>
        protected override GorgonTexture OnGetStagingTexture()
        {
            var settings2D = new GorgonTexture2DSettings
            {
                ArrayCount    = Settings.ArrayCount,
                Format        = Settings.Format,
                Width         = Settings.Width,
                Height        = Settings.Height,
                IsTextureCube = Settings.IsTextureCube,
                Multisampling = Settings.Multisampling,
                MipCount      = Settings.MipCount,
                Usage         = BufferUsage.Staging
            };

            GorgonTexture staging = Graphics.ImmediateContext.Textures.CreateTexture(Name + ".Staging", settings2D);

            staging.Copy(this);

            return(staging);
        }
Exemple #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GorgonGlyphPathGradientBrush"/> class.
        /// </summary>
        /// <param name="textureImage">The texture to use.</param>
        /// <remarks>The texture format for the brush must be R8G8B8A8_UIntNormal, R8G8B8A8_UIntNormal_sRGB, B8G8R8A8_UIntNormal, or B8G8R8A8_UintNormal_sRGB.</remarks>
        /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="textureImage"/> parameter is NULL (Nothing in VB.Net).</exception>
        /// <exception cref="System.ArgumentException">Thrown when the <paramref name="textureImage"/> parameter uses an unsupported format.</exception>
        public GorgonGlyphTextureBrush(GorgonTexture2D textureImage)
        {
            if (textureImage == null)
            {
                throw new ArgumentNullException("textureImage");
            }

            if ((textureImage.Settings.Format != BufferFormat.R8G8B8A8_UIntNormal_sRGB) &&
                (textureImage.Settings.Format != BufferFormat.R8G8B8A8_UIntNormal) &&
                (textureImage.Settings.Format != BufferFormat.B8G8R8A8_UIntNormal) &&
                (textureImage.Settings.Format != BufferFormat.B8G8R8A8_UIntNormal_sRGB))
            {
                throw new ArgumentException(string.Format(Resources.GORGFX_FORMAT_NOT_SUPPORTED, textureImage.Settings.Format));
            }

            Texture          = textureImage;
            TextureRegion    = new RectangleF(0, 0, 1, 1);
            _textureSettings = textureImage.Settings;
            _graphics        = Texture.Graphics.ImmediateContext;
        }