protected virtual void RenderBorder(RendererParameters parameters) { parameters.ThrowIfNull("parameters"); Texture2D pixelTexture = parameters.TextureContent.Pixel; SpriteBatchContext spriteBatchContext = SpriteBatchContext.Current ?? SpriteBatchContext.Default; Vector2 origin = spriteBatchContext.Origin; parameters.SpriteBatch.Begin( SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, RasterizerState.CullNone, spriteBatchContext.Effect, spriteBatchContext.TransformMatrix); parameters.SpriteBatch.Draw(pixelTexture, Window.TopLeftCornerRectangle, pixelTexture.Bounds, BorderColor, 0f, origin, SpriteEffects.None, 0f); parameters.SpriteBatch.Draw(pixelTexture, Window.TopRectangle, pixelTexture.Bounds, BorderColor, 0f, origin, SpriteEffects.None, 0f); parameters.SpriteBatch.Draw(pixelTexture, Window.TopRightCornerRectangle, pixelTexture.Bounds, BorderColor, 0f, origin, SpriteEffects.None, 0f); parameters.SpriteBatch.Draw(pixelTexture, Window.RightRectangle, pixelTexture.Bounds, BorderColor, 0f, origin, SpriteEffects.None, 0f); parameters.SpriteBatch.Draw(pixelTexture, Window.BottomRightCornerRectangle, pixelTexture.Bounds, BorderColor, 0f, origin, SpriteEffects.None, 0f); parameters.SpriteBatch.Draw(pixelTexture, Window.BottomRectangle, pixelTexture.Bounds, BorderColor, 0f, origin, SpriteEffects.None, 0f); parameters.SpriteBatch.Draw(pixelTexture, Window.BottomLeftCornerRectangle, pixelTexture.Bounds, BorderColor, 0f, origin, SpriteEffects.None, 0f); parameters.SpriteBatch.Draw(pixelTexture, Window.LeftRectangle, pixelTexture.Bounds, BorderColor, 0f, origin, SpriteEffects.None, 0f); parameters.SpriteBatch.End(); }
private void RenderBorder(RendererParameters parameters, WindowTexture windowTexture) { Color borderColor = BorderColor * Alpha; RasterizerState rasterizerState = ScissorRectangleContext.Current != null ? new ScissoringRasterizerState() : RasterizerState.CullNone; SpriteBatchContext spriteBatchContext = SpriteBatchContext.Current ?? SpriteBatchContext.Default; Vector2 origin = spriteBatchContext.Origin; parameters.SpriteBatch.Begin( SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, rasterizerState, spriteBatchContext.Effect, spriteBatchContext.TransformMatrix); parameters.SpriteBatch.Draw(windowTexture.Texture, Window.TopLeftCornerRectangle, windowTexture.BorderTopLeftRectangle, borderColor, 0f, origin, SpriteEffects.None, 0f); parameters.SpriteBatch.Draw(windowTexture.Texture, Window.TopRightCornerRectangle, windowTexture.BorderTopRightRectangle, borderColor, 0f, origin, SpriteEffects.None, 0f); parameters.SpriteBatch.Draw(windowTexture.Texture, Window.BottomLeftCornerRectangle, windowTexture.BorderBottomLeftRectangle, borderColor, 0f, origin, SpriteEffects.None, 0f); parameters.SpriteBatch.Draw(windowTexture.Texture, Window.BottomRightCornerRectangle, windowTexture.BorderBottomRightRectangle, borderColor, 0f, origin, SpriteEffects.None, 0f); parameters.SpriteBatch.Draw(windowTexture.Texture, Window.LeftRectangle, windowTexture.BorderTextureLeftRectangle, borderColor, 0f, origin, SpriteEffects.None, 0f); parameters.SpriteBatch.Draw(windowTexture.Texture, Window.RightRectangle, windowTexture.BorderRightRectangle, borderColor, 0f, origin, SpriteEffects.None, 0f); parameters.SpriteBatch.Draw(windowTexture.Texture, Window.TopRectangle, windowTexture.BorderTopRectangle, borderColor, 0f, origin, SpriteEffects.None, 0f); parameters.SpriteBatch.Draw(windowTexture.Texture, Window.BottomRectangle, windowTexture.BorderBottomRectangle, borderColor, 0f, origin, SpriteEffects.None, 0f); parameters.SpriteBatch.End(); }
protected virtual void RenderBackground(RendererParameters parameters) { parameters.ThrowIfNull("parameters"); Texture2D pixelTexture = parameters.TextureContent.Pixel; SpriteBatchContext spriteBatchContext = SpriteBatchContext.Current ?? SpriteBatchContext.Default; parameters.SpriteBatch.Begin( SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, RasterizerState.CullNone, spriteBatchContext.Effect, spriteBatchContext.TransformMatrix); parameters.SpriteBatch.Draw(pixelTexture, Window.WindowRectangle, pixelTexture.Bounds, BackgroundColor, 0f, spriteBatchContext.Origin, SpriteEffects.None, 0f); parameters.SpriteBatch.End(); }