jPCT - a 3d engine for Java > Support

Float Positioning Blit Images

(1/4) > >>

Jamiro:
Hello,

I've been using blit function to emulate a HUD, but it seems it only use integer-based coordinates which can lead to an aliased animation while positionining when the values are decimal, so for example if I have a point in screen that has a coordinate of 1,5x; 10,8y, it would need to be round or truc to its integer value thus leading to rough representation when these values tend to change.

So my question is, is it possible to have a blit with decimal based coordinates? The only solution I've came up so far is using an object in space coordinates and constantly project its coordinates onto a parallel plane to the screen using Interact2D which could reduce performace exponentially much more than using blit. Is there any other good and correct way to do this?

thanks

EgonOlsen:
Well...that the blit() methods take integers only is caused by the software renderer. It can't do subpixel-blitting and the methods reflect that. It's not as easy as it might look at first glance to change this now. To make me understand this better: What kind of HUD is that? Why exactly do you need floats to blit it?

Jamiro:
Ok, so there's a reason why it can't, but...

Couldn't it be done using a simple condition inside the blit method that checks if it's using Software or Hardware and depending on which context is being used it switched to either an integer blit or float blit (while changing only the outside parameters to be of Float type thus keeping retrocompatibility)?

I'm currently making progress bars and 2D-point indicators. When the progress bar increases or decreases the effect is too sharp when its changing by small units, so it its not as smooth as if I were to use a space sprite. It also happens when using dots on a grid, if I change a dot a very small increment in position it will not have a smooth change, it will be moving as if it were painted like a bitmap raster, instead of a smooth raster.

like the example below illustrates a change of position of a sprite's pixel:

1- integer positioning mode:


2- float positioning mode:


is it possible to update the blit method to satisfy both rendering modes while keeping it's legacy?
If so it would give a more accurate way of making smoother animated UI components.

Jamiro:
Do you think it is possible to add this change or is there any other way I can obtain this result?

EgonOlsen:
I'll have a look...

Navigation

[0] Message Index

[#] Next page

Go to full version