Blitting a gif

Started by Melssj5, July 04, 2006, 06:38:09 PM

Previous topic - Next topic

Melssj5

Is it posible to blit gif animations instead of jpg images? I want to do it for a crosshair, that may be difficult to see when its over something of the same color, I want to do a crosshair as a gif animation in which the color change smottly so its easier to see.

BTW: I have problems blitting numbers, I made a 330 x 32 pixels contaning all the numbers from 0 to 9, but only the first one blits ok, I mean, the 0 appears ok, but the rest of numbers no, each number is at 33 pixels of width, but when trying to take the next 33 pixels it takes other things. I solved this testing with values and worked so so, asuming that the numbers are 23 pixels of width, but there arent.
Nada por ahora

EgonOlsen

No, you can't blit a GIF animation directly. You may load it, blit it using Java2D into seperate images and use that as textures.

If your texture is really 330*32, it will be scaled at load time to 256*32, because width and height have to be powers of 2. Try to embed the texture into a 512*32 one instead.

Melssj5

Nada por ahora

Melssj5

I made another image for the numbers, now its 256x32, but has the same problem, the image is not blitted correctly even now, the x initial position is not the correct one.

I am taking each 25 pixels because there are 10 digits equaly separated on a 256 picture. What can I do?
Nada por ahora

Melssj5

Well, I solved the problem putting the numbers on a colum and not n¡on a row, this means, ordering them in the vertically.

Anyway this error should be check.
Nada por ahora

EgonOlsen

Quote from: "Melssj5"Anyway this error should be check.
I can't reproduce this without a test case. If you would be so kind... :wink:

Melssj5

Well, I cant give you a test case because when I did the image again and when I changed the code for blitting the numbers it worked fine, maybe an old image was still in memory causing this, but IDK, anyway is working perfectly now.
Nada por ahora