Currently, when I rotate the image using SpriteBatch.Draw() the image is rotated after it is scaled. Resulting in:

Rotation after scaling

Which is using the code

public override void Draw(GameTime gameTime) {
        new Rectangle(0, 0, (int) 25, (int) 25),
        new Vector2(texture.Width/2, texture.Height/2),
        new Vector2(2, 2),

However what I would like to see is more on the grounds of

Rotation before scaling

I've tried to directly edit the texture itself instead of rotating using spritebatch, only I have found that it was incredibly inefficient.

Edit 1:

I am currently looking around at RenderTarget2D and such. Possible solution to my problem.

  • \$\begingroup\$ Use code tags to mark source code. Yours is hardly readable. \$\endgroup\$ Jul 1, 2015 at 7:47
  • \$\begingroup\$ I thought I was using code tags? I can read it fine. \$\endgroup\$
    – Aceeri
    Jul 1, 2015 at 21:34
  • \$\begingroup\$ Rotate before you scale? You will need to use transform matrices for that. \$\endgroup\$ Aug 7, 2015 at 7:37

2 Answers 2


An easy way to do this would be to use transformation matrices. So you need to define a transformation matrix like so.

Matrix transform = Matrix.Identity;

Then to create the transformations do something like this but with your values in there.

transform = Matrix.CreateTranslation(X, Y, 0f) * Matrix.CreateRotationZ(rotationInRadians), Matrix.CreateScale(X, Y, 0f)

Now matrices are non-commutative meaning A * B != B * A and with transformation matrices changing the order you multiply them in will change which one happens first. For you I suggest Rotation * Scale * Translation or Rotation * Translation * Scale whichever you are looking for.

Then apply the transform in the spriteBatch. It will apply it for every sprite in that batch.

spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, transform);

Lastly, note that in that overload for spriteBatch.Begin most of those are defaults except transform and samplerstate. A point clamp will prevent your objects from being sampled smoothly that way you can retain the rough edges you are looking for.

More information on transformation matrices can be shown by this picture. Although you don't need to fully understand them to utilize them. enter image description here


Using a rendertarget may be a solution if you only have that one sprite. If your game requires a lot of those rotated, scaled sprites, you might want to look into a pixelshader. You might calculate the occurence of a color within your intended pixel size (your spritepixels may be 3x3 screen pixels) and color the resulting screen pixels accordingly.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .