# How to draw a sprite at a floating point xy coordinate with interlaced drawing?

I have a 2D game made in MonoGame (XNA 4.0 framework). Here's what I want to do:

• draw a 2d image at a floating point xy coordinate such as 125.5, 300.12 (and do NOT round them to an int).

• the image is automatically "interlaced", which means the picture is shaded correctly around the borders so that it looks like it's actually a fraction of the way across pixels, and not aligned exactly on pixels.

How do I do this? Is there a standard library for this?

P.S. the game I'm working on eventually needs to work on Mac and Linux as well, so please don't give me any dead-end solutions.

• Can you show a (photoshopped) screenshot of the effect you're looking for? Suppose a image consists of a 2x2 white pixel square. What would it look like if it is set at coordinates (1.5 , 1.5) or (1.25, 1,0)? – Felsir Dec 15 '15 at 10:27
• Doesn't a SpriteBatch already do something like this by default? – craftworkgames Dec 15 '15 at 12:28
• I think the term you're looking for is "antialiased". The feathering at the edges attempts to correct the spatial aliasing of the sampling grid of the screen. "Interlacing" usually refers to alternating rows of the image being transmitted separately, like old TV signals or progressive loading images on the pre-broadband web. – DMGregory Dec 15 '15 at 13:06
• @DMGregory "antialiased" might be the right term except it's not just the edges. The whole image must be shifted by that fraction, so interior pixels will get blended somehow too. – DrZ214 Dec 15 '15 at 21:07
• @craftworkgames Yep looks like it does, just didn't realize the Vector2 could take 2 floats because i had wrapped it in my own function. – DrZ214 Dec 15 '15 at 21:10

Any of the Vector2 position draw overloads.

SpriteBatch.Draw (Texture2D, Vector2, Color)
SpriteBatch.Draw (Texture2D, Vector2, Nullable<Rectangle>, Color)
SpriteBatch.Draw (Texture2D, Vector2, Nullable<Rectangle>, Color, Single, Vector2, Single, SpriteEffects, Single)
SpriteBatch.Draw (Texture2D, Vector2, Nullable<Rectangle>, Color, Single, Vector2, Vector2, SpriteEffects, Single)


Combined with any of the filtering options with the exception of Point based ones. (Linear is the default)

TL DR: Use the default sampling state and specify a non integer location in the draw call

• Thank you, I must have missed the Vector2 with two floats because a long time ago I wrapped many default draw functions in my own functions that I found more intuitive. – DrZ214 Dec 15 '15 at 21:09