Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1126
| From | "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: Drawing problem |
| Message-ID | <8dYGh.272017$IL1.11129@newsfe13.lga> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <esh418$3vr$1@registered.motzarella.org> |
| Date | 2011-04-27 15:31 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui Michael Rauscher wrote: > Knute Johnson wrote: >> I don't have any links for you but BufferedImage is not a Swing >> component and therefore won't have any problems being modified outside >> of the EDT. > > To me this seems not to be a reason since I wouldn't consider the whole > thing specific to the EDT. > > If one modifies an object (an instance of BufferedImage) outside of one > thread (the EDT) while this thread accesses it (during EDT's paint > operation) there are two threads that access the same object. > > The question then is if the object is in a determinable state at the > time a thread accesses it. Determinable yes. The state you assume it is in because you have drawn on it, I don't know. Doesn't matter in this case anyway. > Since the modifying thread is the only thread that changes the object's > state, the modifying thread always gets an object whose state can be > determined. > > In general this isn't true to any other thread since it might get an > object whose state is currently being modified. > > So: Are there any guarantees that the EDT paint operation draws a > BufferedImage that is in a state as it was before any Graphics (created > via the BufferedImage) method was started that has not yet finished? If you don't call repaint() until you are done drawing on it I doubt it. If you queued a repaint() from another thread while you were in the process of doing a draw I don't think you could guarantee where in the draw you would be. If multiple threads kept multiple copies of the same BufferedImage object then I think you could have a situation where you draw on your copy and the other thread doesn't see it yet. I'm not really clear on when that can happen but synchronizing the code will certainly prevent that. In reality I don't think it will ever be a problem. -- Knute Johnson email s/nospam/knute/ --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Drawing problem "Robert Sturzenegger" <robert.sturzenegger@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
Re: Drawing problem "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
Re: Drawing problem "Robert Sturzenegger" <robert.sturzenegger@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
Re: Drawing problem "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
Re: Drawing problem "Robert Sturzenegger" <robert.sturzenegger@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
Re: Drawing problem "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
Re: Drawing problem "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
Re: Drawing problem "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
Re: Drawing problem "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
Re: Drawing problem "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
Re: Drawing problem "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
Re: Drawing problem "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
Re: Drawing problem "Robert Sturzenegger" <robert.sturzenegger@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
csiph-web