Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

saving graphics

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just a beginer but I had an Idea....
thanks to this lovely forum I've learnd how to do animation
by useing a buch of gif file and loading them into a Graphics object but and then playing them.
but that means a lot of gif files so my idea was, can one not create a graphics array and load all the gifs in it then save it to the haddrive by using the "objectoutputstream" class and wrapping it in an other output class and create a single file that can be loaded by the same process and the have a graphics array that index number changes to do the animation
-just an idea
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I have done kind of what you describe before. The first part ( collecting several GIFs into one large gif ) I always did by hand. I then loaded the "image-strip" into my applet and used a PixelGrabber and MemoryImageSources to chop the image-strip into individual images. This is a really good technique to use in Applets because the applet only needs to download one big graphics file from the server. This is much faster than downloading tons of small graphics because the Applet must make a new connection to the server for each request. This method also works well for arcade games, because you can have multiple image strips for each character( for example, one for walking left, one for walking right, one for jumping, etc. ) and stick them all together and have all the graphics for each character in the same place. They are also easy to access in the program, just make a 2-dimensional array to hold all the images.

The new twist on this idea actually sounds like it could be an improvement on the method I have been using. By processing the GIFs into Java Images beforehand, you would cut down on the early processing to load and cut the image-stip into frames. I will have to check this out and see if it works!

-Nate
 
hennie louw
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your view on my idea nathan, i'll send you a copy of my code when i'm finnished. That way you can better on it and teach me more effective coding

Originally posted by Nathan Pruett:
Actually, I have done kind of what you describe before. The first part ( collecting several GIFs into one large gif ) I always did by hand. I then loaded the "image-strip" into my applet and used a PixelGrabber and MemoryImageSources to chop the image-strip into individual images. This is a really good technique to use in Applets because the applet only needs to download one big graphics file from the server. This is much faster than downloading tons of small graphics because the Applet must make a new connection to the server for each request. This method also works well for arcade games, because you can have multiple image strips for each character( for example, one for walking left, one for walking right, one for jumping, etc. ) and stick them all together and have all the graphics for each character in the same place. They are also easy to access in the program, just make a 2-dimensional array to hold all the images.

The new twist on this idea actually sounds like it could be an improvement on the method I have been using. By processing the GIFs into Java Images beforehand, you would cut down on the early processing to load and cut the image-stip into frames. I will have to check this out and see if it works!

-Nate


 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can u give me a copy of sample code about what you said?
email:aspphp@fm365.com
thanks very much
 
What kind of corn soldier are you? And don't say "kernel" - that's only for this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic