[4954] in java-interest

home help back first fref pref prev next nref lref last post

Re: PixelGrabber problem (Solved)

daemon@ATHENA.MIT.EDU (Vitaly Promislov)
Wed Jan 24 07:54:42 1996

Date: Wed, 24 Jan 96 14:37:43 ???
From: vitaly@diogen.asc.rssi.ru (Vitaly Promislov)
To: igs@sunrock.East.Sun.COM
Cc: java-interest@java.sun.com

> From igs@sunrock.East.Sun.COM Tue Jan 23 22:29:46 1996
> Sender: igs@sunrock.East.Sun.COM
> Date: Tue, 23 Jan 1996 14:10:54 -0500
> From: Irv Salisbury <igs@sunrock.East.Sun.COM>
> Organization: Sun Microsystems
> X-Mailer: Mozilla 2.0b6a (X11; I; SunOS 5.5 sun4c)
> Mime-Version: 1.0
> To: Vitaly Promislov <vitaly@diogen.asc.rssi.ru>
> Subject: Re: PixelGrabber problem (Need Help)
> Content-Type> : > text/plain> ; > charset=us-ascii> 
> Content-Transfer-Encoding: 7bit
> Content-Length: 2114
> 
> Vitaly Promislov wrote:
> > 
> > Hi All
> > I met problem with PixelGrabber.
> > I create empty offscreen image with createImage(w,h) method and after
> > some drawing on this context try to grab pixel from offscreen image
> > but have to wait forever.
> > Thre is small example:
> > 
> >       {
> >   Image img;
> >   Graphics g;
> > 
> >        img=obs.createImage(width,height);
> >        g=img.getGraphics();
> > 
> >        pix_src= new int[width*height];
> > 
> >        g.fillRect(0,0,width,height);
> > 
> > PixelGrabber pg = new PixelGrabber(img, 0, 0, width, height, pix_src, 0, width);
> > boolean stat=false;
> > 
> >         try {
> >             stat=pg.grabPixels();     // ???? hang up here
> >         } catch (InterruptedException e) {
> >             System.err.println("interrupted waiting for pixels!");
> >             return;
> >         }
> > 
> >    }
> > 
> >            if(stat == false)
> >         if ((pg.status() & ImageObserver.ABORT) != 0) {
> >             System.err.println("image fetch aborted or errored");
> >             return;
> >         }
> > 
> >    Thank you
> > 
> > Vitaly Promislov
> > Astro Space Center, Russia    e-mail: vitaly@diogen.asc.rssi.ru
> >                               fax: 095 333-23-78
> >                               Phone:   333-23-12
> > URL: http://diogen.asc.rssi.ru/Vitaly.html
> > ----------------------------------------------------------------------
> > These are my opinions only, and do not reflect anything
> > about my employer, Astro Space Center of  Russina Academy of Science.
> > ------------------------------------------------------------------------
> > -
> > This message was sent to the java-interest mailing list
> > Info: send 'help' to java-interest-request@java.sun.com
> 
> When I tried this my computer also hung at the same spot.  Have you
> tried this with a jpeg image?  
> 
> Anyway, I had implemented this in a different way using ImageConsumer
> and ImageProducer to get at the pixels.  I then used the pixels to
> rotate theimage and used MemoryImageSource to reproduce the rotated
> image.  If you would like to take a look at it I am sure I could send it
> to you.
> 
> If you have any breakthroughs with PixelGrabber let me know.
> 

Hi Irv
I  succeed to pass through PixelGrabber. It seems It works with offscreen
image OK. I modified source this way:

  {
   Image img;
   Graphics g;
 
        img=createImage(width,height);
        g=img.getGraphics();
 
        pix_src= new int[width*height];
 
        g.fillRect(0,0,width,height);
  PixelGrabber pg = new PixelGrabber(img, 0, 0, width, height, pix_src, 0, width); boolean stat=false;

               img.getSource().addConsumer(pg);  // It must be DONE !!!
 
         try {
             stat=pg.grabPixels();     //  NO hang up here
         } catch (InterruptedException e) {
             System.err.println("interrupted waiting for pixels!");
             return;
         }
 
    }
 
            if(stat == false)
         if ((pg.status() & ImageObserver.ABORT) != 0) {
             System.err.println("image fetch aborted or errored");
             return;
         }


Anyway If you send me your code I will be glad to look it through. 
   Thank you
       Vitaly.
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post