Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (528)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (594)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Fetching an Image  (Read 1448 times)
0 Members and 1 Guest are viewing this topic.
Offline Vision_Thing

Senior Newbie




Java games rock!


« Posted 2003-05-26 02:50:24 »

Hi, long time no see.
I've been really busy with my software 3D engine and it is turning out to be a nice system Wink

I have one question about Images though... Is there any other way to fetch the pixels from an Image than with a PixelGrabber? First, it's slow and secondly if a game has a high framerate and getPixels() is called like 60 times/second the program will eventually crash as it cannot fetch the pixels fast enough. The implementation doesn't allow the pixels to be cached as a new image can be supplied at any time asynchronously, so this is the only way. Right now I've solved it by forcing the user to fetch the pixels by himself and give the pixel array as an argument to my method, but it feels somewhat of a hack. Any ideas?

This is all for now,
laters dudes =)
Offline HeartOfGold

Innocent Bystander




Java games rock!


« Reply #1 - Posted 2003-05-26 04:30:57 »

How about reading the pixels data from a file to an array (maybe using your own format) and using java.awt.image.MemoryImageSource to create a java.awt.Image? You can have immedeate access to the pixel array aswell as to the image.
Offline Vision_Thing

Senior Newbie




Java games rock!


« Reply #2 - Posted 2003-05-26 05:47:41 »

Quote
How about reading the pixels data from a file to an array (maybe using your own format) and using java.awt.image.MemoryImageSource to create a java.awt.Image? You can have immedeate access to the pixel array aswell as to the image.


Hi.
That's what I am doing now, but I want to have a method, drawImage(Image, width, height etc...) in my own rasteriser. I try to keep a high abstraction level so the user won't have to fetch the image pixels himself and calling the current drawImage(int[] pixels, width, height etc...). Hope you understand what I mean.
Laters.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #3 - Posted 2003-05-26 11:08:34 »

Quote


Hi.
That's what I am doing now, but I want to have a method, drawImage(Image, width, height etc...) in my own rasteriser. I try to keep a high abstraction level so the user won't have to fetch the image pixels himself and calling the current drawImage(int[] pixels, width, height etc...). Hope you understand what I mean.
Laters.


Then the answer is no.

I suggest you create a wrapper for the int [] way of doing it, and then simply provide a drawImage(YourImageClass,x,y,etc)

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #4 - Posted 2003-05-26 12:02:22 »

If you use a BufferedImage then you should be able to get at the pixel data through the Raster object.

Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #5 - Posted 2003-05-26 13:18:50 »

Quote
If you use a BufferedImage then you should be able to get at the pixel data through the Raster object.


I think hes sticking to 1.1.
Atleast, thats the assumption I made when I said 'no'.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline Vision_Thing

Senior Newbie




Java games rock!


« Reply #6 - Posted 2003-05-26 23:45:37 »

Quote


I think hes sticking to 1.1.
Atleast, thats the assumption I made when I said 'no'.



Correct, Java1.1 here =)
Thanks for the help though, now I can leave this behind me and focus on other things.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

PocketCrafter7 (14 views)
2014-11-28 16:25:35

PocketCrafter7 (10 views)
2014-11-28 16:25:09

PocketCrafter7 (11 views)
2014-11-28 16:24:29

toopeicgaming1999 (77 views)
2014-11-26 15:22:04

toopeicgaming1999 (67 views)
2014-11-26 15:20:36

toopeicgaming1999 (17 views)
2014-11-26 15:20:08

SHC (30 views)
2014-11-25 12:00:59

SHC (28 views)
2014-11-25 11:53:45

Norakomi (32 views)
2014-11-25 11:26:43

Gibbo3771 (28 views)
2014-11-24 19:59:16
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!