黑莓手机 - 图像3D转换 [英] BlackBerry - image 3D transform

查看:190
本文介绍了黑莓手机 - 图像3D转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何旋转图像与<一个任意角度href="http://www.blackberry.com/developers/docs/4.2api/net/rim/device/api/ui/Graphics.html#drawTexturedPath%28int%5B%5D,%20int%5B%5D,%20byte%5B%5D,%20int%5B%5D,%20int,%20int,%20int,%20int,%20int,%20int,%20net.rim.device.api.system.Bitmap%29"相对=nofollow> drawTexturePath :

I know how to rotate image on any angle with drawTexturePath:

int displayWidth = Display.getWidth();
int displayHeight = Display.getHeight();
int[] x = new int[] { 0, displayWidth, displayWidth, 0 };
int[] x = new int[] { 0, 0, displayHeight, displayHeight };
int angle = Fixed32.toFP( 45 );
int dux = Fixed32.cosd(angle );
int dvx = -Fixed32.sind( angle );
int duy = Fixed32.sind( angle );         
int dvy = Fixed32.cosd( angle );       
graphics.drawTexturedPath( x, y, null, null, 0, 0, dvx, dux, dvy, duy, image);

但我需要的是一个简单的图片与3D转换3D投影(东西如

能否请你指点我如何与drawTexturedPath做到这一点(我几乎可以肯定这是可能的)?
有什么办法?

Can you please advice me how to do this with drawTexturedPath (I'm almost sure it's possible)?
Are there any alternatives?

推荐答案

使用此功能(2步行载体)的方法是一样的OLDSKOOL编码用于著名的rotozoomer效果的技巧。 rotozoomer例如影片

The method used by this function(2 walk vectors) is the same as the oldskool coding tricks used for the famous 'rotozoomer' effect. rotozoomer example video

此方法是一种非常快速的方式进行旋转,缩放和倾斜图像。旋转是通过旋转步行载体简单地完成。变焦是通过缩放向量步行只需完成。偏斜通过旋转就该walkvectors彼此(例如,它们不作成90度角了)进行。

This method is a very fast way to rotate, zoom, and skew an image. The rotation is done simply by rotating the walk vectors. The zooming is done simply by scaling the walk vectors. The skewing is done by rotating the walkvectors in respect to one another (e.g. they don't make a 90 degree angle anymore).

任天堂作出了硬件在其SNES为使用任何精灵和或背景的相同的效果。这对于一些非常酷的效果做的方式。

Nintendo had made hardware in their SNES to use the same effect on any of the sprites and or backgrounds. This made way for some very cool effects.

该技术的一大缺点是,我们不能透视变形纹理。要做到这一点,每一个新的水平线上,走向量应该变化不大。 (很难不图纸说明)。

One big shortcoming of this technique is that one can not perspectively warp a texture. To do this, every new horizontal line, the walk vectors should be changed slightly. (hard to explain without a drawing).

在他们通过改变每个扫描线克服了这个SNES的walkvectors(在那些日子里,人们可以设置一个中断时,监测仪绘制的任何扫描线)。这种模式后来被称为模式7 (因为它的表现就像一个新的虚拟样图形模式)。使用这种模式最有名的游戏是马里奥赛车和F-零

On the snes they overcame this by altering every scanline the walkvectors (In those days one could set an interrupt when the monitor was drawing any scanline). This mode was later referred to as MODE 7 (since it behaved like a new virtual kind of graphics mode). The most famous games using this mode were Mario kart and F-zero

因此​​,为了得到这个工作的黑莓,你必须画出你的形象displayHeight时代(图像,例如每1扫描线)。这是为了实现所期望的效果的唯一方式。 (这无疑将花费你一个性能损失,因为你现在呼吁,而不只是一个时间drawTexturedPath功能了很多新的价值观次)。

So to get this working on the blackberry, you'll have to draw your image "displayHeight" times (e.g. Every time one scanline of the image). This is the only way to achieve the desired effect. (This will undoubtedly cost you a performance hit since you are now calling the drawTexturedPath function a lot of times with new values, instead of just one time).

我想有一点谷歌搜索,你可以找到一些公式(甚至实现)如何calc下的不同walkvectors的。随着一张纸(给你的不是太差,在数学),你可能会自己推断出这一点。我已经做到了我自己太当我做游戏的音乐游戏机,所以我知道这是可以做到。

I guess with a bit of googling you can find some formulas (or even an implementation) how to calc the varying walkvectors. With a bit of paper (given your not too bad at math) you might deduce it yourself too. I've done it myself too when I was making games for the Gameboy Advance so I know it can be done.

请务必preCALC一切!速度就是一切(特别是在慢的机器就像手机)

Be sure to precalc everything! Speed is everything (especially on slow machines like phones)

编辑:做了一些谷歌搜索给你。这里有一个详细的解释了如何创建mode7效果。这将帮助你达到同样的黑莓功能。 模式7实施

did some googling for you. Here's a detailed explanation how to create the mode7 effect. This will help you achieve the same with the Blackberry function. Mode 7 implementation

这篇关于黑莓手机 - 图像3D转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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