|
|
发表于 2006-7-3 18:31:00
|
显示全部楼层
Re:ddraw特殊效果实现(如任意角度旋转)!!!
第一个是msdn的资料,给你一个链接。
HOWTO: Display a Bitmap into a Rotated or Non-rectangular Area
(Using Windows 2000 "WarpBlt" API call)
http://support.microsoft.com/support/kb/articles/Q186/5/89.ASP
第二个是http://www.exaflop.org上找来的。直接抄给你了。
The easiest way, according to the comp.graphics faq, is to take the rotation transformation and invert it. Then you just iterate over the destination image, apply this inverse transformation and find which source pixel to copy there. A much nicer way comes from the observation that the rotation
matrix:
R(T) = { { cos(T), -sin(T) }, { sin(T), cos(T) } }is formed my multiplying three matrices, namely:
R(T) = M1(T) * M2(T) * M3(T)where
M1(T) = { { 1, -tan(T/2) },
{ 0, 1 } }
M2(T) = { { 1, 0 },
{ sin(T), 1 } }
M3(T) = { { 1, -tan(T/2) },
{ 0, 1 } }Each transformation can be performed in a separate pass, and because these transformations are either row-preserving or column-preserving, anti-aliasing is quite easy.
Reference:
Paeth, A. W., "A Fast Algorithm for General Raster Rotation", Proceedings Graphics Interface '89, Canadian Information Processing Society, 1986, 77-81
[Note - e-mail copies of this paper are no longer available]
[Gems I] |
|