We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › hand over java screenshot to processing sketch
Page Index Toggle Pages: 1
hand over java screenshot to processing sketch (Read 831 times)
hand over java screenshot to processing sketch
Jan 27th, 2010, 8:18am
 
hi,

i have a java library implemented, that works like a webbrowser (it's called jdic). when i run my sketch it creates its own frame for the browser, so that there are 2 windows (the usual processing sketch and the webbrowser).
now i want to use graphic data from the webbrowser in processing, but i don't know how.
i tried get and BufferedImage and something with robots, but i totally don't know what i'm doing, since i have no idea of java.

here is my best try (i guess)
Code:
  
void draw() {  
    image(browser.saveLaFrame(),0,0);
  }  

...
...
...
// inside java webbrowser class
PImage saveLaFrame()
   {
      BufferedImage bufferedImage = new BufferedImage(frame.getWidth(), frame.getHeight(), BufferedImage.TYPE_INT_RGB);
      PImage myImage = new PImage(bufferedImage);
     
return myImage;

   }


this just returns a black image to the processing sketch.
can anyone see what is wrong?

Re: hand over java screenshot to processing sketch
Reply #1 - Jan 28th, 2010, 7:47am
 
i read in a java forum that some other guys had the same problem with that specific jdic implementation, and badly, none of them could figure out a solution. those posts are pretty old though (5-7 years), so there might be hope, that the problem has become fixed since.

but because i have no experience with java i cannot tell, if the problem is caused by my some simple fault in the code, or if it's some other supercomplicated unsolvable implementation-specific problem

also if anyone knows of another way of creating webpage screenshots with processing, that would really help

Page Index Toggle Pages: 1