Jump to content

View more

Image of the Day

Inventory ! Va falloir trouver une autre couleur pour le cadre D: #AzTroScreenshot #screenshotsaturday https://t.co/PvxhGL7cOH
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

[java] Drawing a frame from a image strip

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 tjbrosna   Members   

122
Like
Likes
Like

Posted 26 November 2000 - 11:40 PM

At the moment i load the image strip(anywhere from 7 - 56 frames) using an image manager class. Then when some other class wants to get the image, it gets a reference to the image(every frame) and then use Image.drawImage(Image, sx1,sy1,sx2,sy2,dx1,dy1,dx2,dy2) to draw the current frame.I have tested and tested my code and found this is where the slow fps is coming from so my questions are: 1) Whats a better alternative to drawImage? 2) Is my image manager class a good idea(ie getting a reference every frame, probably not a good idea)? 3) Any other suggestions?? Thanks, T.J

#2 dr-m   Members   

122
Like
Likes
Like

Posted 27 November 2000 - 04:25 AM

You could eliminate the need for all that clipping by cutting each frame out in an own Image and then just draw them with a;

g.drawImage(buf, x,y, null);

I don''t know if this is faster, but i sure think so...


/ dr-m

#3 snowmoon   Members   

122
Like
Likes
Like

Posted 27 November 2000 - 04:37 AM

Assuming you are not doing this alreay you could copy your imapge strip to an optimized image format by using the...

component.createImage(width,height)

and the copy your image to that and use it insted of your loaded image. The problem with this is it does not work for semi-transparent images. So if you don''t need transparency Just make a bunch of companent.createImage(..)''s and drawImage(Image,sx,sy....) into them. Them your drawing should speed up.

If not you can check my previous thread about drawing speed for alternatives to drawImage, but they are not for the faint of heart. I''m working on an abstraction layer that should make it easier.

#4 lupine   Members   

122
Like
Likes
Like

Posted 27 November 2000 - 11:53 AM

hmmmmmm
I thought there were benefits
to image clipping...
but I really don''t know anything
and if its slowing down your FPS
then I guess you need to ditch it




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.