[4635] in java-interest

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

Re: missing functionality : drawImage != BitBlt/StretchBlt

daemon@ATHENA.MIT.EDU (Jonathan Locke)
Tue Jan 9 21:01:27 1996

Date: Tue, 9 Jan 1996 15:44:04 -0800 (PST)
From: Jonathan Locke <jonl@sealevelsoftware.com>
To: Jim Graham <flar@bendenweyr.Eng.Sun.COM>
Cc: java-interest@java.Eng.Sun.COM
In-Reply-To: <9601082135.AA16621@bendenweyr.Eng.Sun.COM>


On Mon, 8 Jan 1996, Jim Graham wrote:

> What's wrong with Component.repaint(x,y,w,h) to force an update to a
> rectangular region of your Component/Applet?

maybe this is a documentation misunderstanding:

  public void repaint(int x,
                      int y,
                      int width,
                      int height)

  Repaints part of the component. This will result in a call to update 
  as soon as possible. 

     Parameters: 
          x - the x coordinate 
          y - the y coordinate 
          width - the width 
          height - the height 

     See Also: 
          repaint 

not much to go on, if you ask me.  if i call repaint 10,000 times in one 
second do i get 10,000 calls to update?  that's why i gave up on 
this function early on... it doesn't look like it does an InvalidateRect.
so what exactly does it do?  i tried using it and it seems to work fine
for my classes.  the other thing that really bothered me was... what's 
this whole thing about ensuring an update within X milliseconds?  
there should be some indication of why this is useful and how the 
underlying mechanism works... we don't have this feature in Windows... 
and to be honest, i can't see immediately why anyone would need it.  
it would be a good idea to document this better because i'm sure there's 
a reason behind it, but to the uninitiated like myself, it just looks sloppy
(depending on the timing of something in an event driven system).

> Use clipping to restrict the drawImage to only the rectangle you want.

there is still a need for BitBlt/StretchBlt in any serious GUI environment. 
it could be an AWT 2.0 feature though as it's more likely to be a problem for
real-world applications than applets. someone else pointed out that i 
could use a CropImageFilter or something. maybe that is the equivalent of 
BitBlt in some elegant sort of way... but it's an inefficient solution 
(in any language) and i think it's non-intuitive.

> 
> In fact, if you use the repaint method to repaint only a given rectangle
> of your applet, then when your update method is called back, it will
> already have the clip of the Graphics object set to the region of
> interest so all you have to do is the full drawImage and only the
> needed rectangle will be rendered...

yes.  this seems to work marvelously!  but i'm still bothered by not 
really understanding how it is that repaint winds up calling update.
thankyou for your help.

	J

> 
> 				...jim
> 

-
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