旋转某个点的图像并使用GDI +对其进行平移 [英] Rotating image at a point and translating it using GDI+

查看:141
本文介绍了旋转某个点的图像并使用GDI +对其进行平移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是第一次使用GDI +.

谁能告诉我如何旋转某个点的图像,然后将其平移到x(左右)和y(上下),但是旋转是.

旋转和平移点在按键上保持不变.

请帮我解决问题.
在此先感谢.

Hi,

I am working on GDI+ for the first time.

Can anyone please tell me how to rotate the image at a point and then translate it towards x(left-right) and y(top-bottom) however the rotation is.

Rotation and translation points keep on changes on key press.

Please help me out in how to do it.
Thanks in advance.

推荐答案

尝试

这实际上是一个复杂的问题,包含很多部分.

GDI +无法实现此功能,因为它无法识别纹理,矢量或网格.

您的基本步骤是...

1.旋转并平移图像的四个角.
2.遍历图像读取像素.
一个.在外部循环中,迭代行.
b.在内部循环中,对列进行迭代.
C.对图形图像的像素位置执行相同的操作.
3.将像素写入GDI + DC.

现在,这很慢.但是您在这里有两个主要的优化领域.

1.跟踪输出图像的像素有很多优化和线描算法.但是大多数都具有共同的品质.他们以间接方式计算坐标.这些技术填补了书中的章节.

2.制作第二个内存映像,该映像足够大以容纳整个旋转的映像并写入,而不是DC.然后将其bitblt到DC.
That''s actually a complicated question with a lot of parts.

GDI+ is a difficult platform for implementing this on, since it doesn''t recognize textures, vectors or meshes.

Your basic steps are...

1. Rotate and translate the four corners of the image.
2. Loop through the image reading the pixels.
a. In the outer loop, iterator the rows.
b. In the inner loop iterate the columns.
c. Do the same for the pixel positions for the drawing image.
3. Write the pixels to the GDI+ DC.

Now this is slow. But you have two major areas for optimizations here.

1. There are optimizations and many line drawing algorithms for tracing the pixels of the output image. But most share a common quality. They calculate the coordinates in an indirect fashion. These techniques fill up chapters in books.

2. Make a second memory image that is big enough to hold the entire rotated image and write this, instead of the DC. Then bitblt it to the DC when done.


1)您可以使用仿射变换进行这种处理.

http://en.wikipedia.org/wiki/Affine_transformation [ ^ ]

2)我认为最好也使用一些免费的第三方:
http://www.artuxsoft.com/download.aspx [ ^ ]
1) You may use Affine Transformation for this kind of processing.

http://en.wikipedia.org/wiki/Affine_transformation[^]

2) I think it is better to use some free third party as well:
http://www.artuxsoft.com/download.aspx[^]


这篇关于旋转某个点的图像并使用GDI +对其进行平移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆