Exemple #1
0
 public SdlTexture(IRenderWindow window, IBuffer source, bool isPrimary = false, uint? pixelFormat = null)
 {
     Initialize(window, isPrimary);
     Initialize(source.Width, source.Height);
     Renderer = SdlFactory.GetRenderer(window.Handle);
     textureAccess = TextureAccess.Static;
     this.pixelFormat = pixelFormat;
     if (Renderer == IntPtr.Zero)
         Renderer = SdlFactory.CreateRenderer(window.Handle, -1, window.RendererFlags);
     Handle = SdlFactory.CreateTexture(Renderer, source);
     SdlFactory.SetTextureBlendMod(Handle, BlendMode.None);
 }
Exemple #2
0
 public SdlTexture(IRenderWindow window, int? w = null, int? h = null, bool isPrimary = false, uint? pixelFormat = null)
 {
     Initialize(window, isPrimary);
     Initialize(w ?? window.Width, window.Height);
     Renderer = SdlFactory.GetRenderer(window.Handle);
     this.pixelFormat = pixelFormat;
     textureAccess = TextureAccess.Streaming;
     if (Renderer == IntPtr.Zero)
         Renderer = SdlFactory.CreateRenderer(window.Handle, -1, window.RendererFlags);
     Handle = SdlFactory.CreateTexture(Renderer,
         pixelFormat ?? Factory.PixelFormat, textureAccess, Width, Height);
     SdlFactory.SetTextureBlendMod(Handle, BlendMode.None);
 }