www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: Melssj5 on July 04, 2006, 06:38:09 pm

Title: Blitting a gif
Post by: Melssj5 on July 04, 2006, 06:38:09 pm
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.
Title: Blitting a gif
Post by: EgonOlsen on July 04, 2006, 09:38:20 pm
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.
Title: Blitting a gif
Post by: Melssj5 on July 04, 2006, 09:41:37 pm
ok, thanks a lot.
Title: Blitting a gif
Post by: Melssj5 on July 13, 2006, 05:59:49 am
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?
Title: Blitting a gif
Post by: Melssj5 on July 13, 2006, 07:55:19 am
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.
Title: Blitting a gif
Post by: EgonOlsen on July 13, 2006, 08:44:59 am
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:
Title: Blitting a gif
Post by: Melssj5 on July 15, 2006, 05:38:42 pm
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.