how to rotate a bitmap with DDraw?

Started by
10 comments, last by Evil Steve 14 years, 5 months ago
SelectObject(mdc,player);
for (int y=0;y<28;y++)
{
for (int x=0;x<28;x++)
{
BitBlt(tmdc,100+((x/sqrt(x*x+y*y))*cos(t)-(y/sqrt(x*x+y*y))*sin(t))*sqrt(x*x+y*y),100+((y/sqrt(x*x+y*y))*cos(t)+(x/sqrt(x*x+y*y))*sin(t))*sqrt(x*x+y*y),1,1,mdc,x,y,SRCCOPY);
}
}
Miracrea Games
Advertisement
Ah, that's writing a rotozoomer, but in a pretty slow way - it blits single pixels from the source to the rotated destination point. It'd be more optimal to use something like GetDIBits, or even GetPixel/SetPixel to access the pixels, but if it works it works I guess.

This topic is closed to new replies.

Advertisement