|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Graphics2D object retrieved from Canvas is volitile...I first thought this was a bug in the 1.6.0.14 plugin. But perhaps it is just that the Graphics2D object retrieved from a Canvas object is volatile. Although I have never seen a Graphics2D object to be volatile except when it was retrieved from a BufferStrategy.
This is what I see. When I dragged an applet to the desktop, I would lose my Canvas Graphics2D object. In other words when I init my Canvas: canvasGraphic = (Graphics2D)this.getGraphics(); // this is a Canvas gives me back a volitile canvasGraphic. When I drag the applet to the desktop, canvasGraphics is no longer valid. It's not null -- just not valid. I cannot use it to draw with. The applet still responds to paint(Graphics g) calls because g is a new Graphics object. So when I redraw my pixel buffer, I have to get the canvasGraphics object each time to be sure that it is still valid like this: I call this method now for every frame I draw when the user pans/tilts/zooms. public void newPixels() { canvasGraphic= (Graphics2D)this.getGraphics(); canvasGraphic.drawImage(paintImage, 0, 0, thisW, thisH, this); } It used to look like: public void newPixels() { canvasGraphic.drawImage(paintImage, 0, 0, thisW, thisH, this); } And the above works fine until the applet is dragged to the desktop, then canvasGraphic becomes invalid (or something) and drawImage() doesn't draw the image on the Canvas. Is this a bug??? Is this the way it's supposed to be??? I don't know. Open: http://pancyl.com/ I've added the code to get a new Graphics2D object each time I draw my pixel buffer. It works now just like before 1.6.0.14. I don't recall ever having to do this. But I was using BufferStrategy and I was getting the Graphics2D object each time I drew. I changed to using an unmanaged BufferedImage that I draw directly onto my Canvas. I didn't know that the Canvas graphics object was volatile. I don't recall ever having to get the graphics object from the Canvas each time I draw into it. Did something change? [Message sent by forum member 'demonduck' (demonduck)] http://forums.java.net/jive/thread.jspa?messageID=353271 =========================================================================== To unsubscribe, send email to listserv@... and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to listserv@... and include in the body of the message "help". |
|
|
Re: Graphics2D object retrieved from Canvas is volitile...java2d@... wrote:
> I first thought this was a bug in the 1.6.0.14 plugin. But perhaps it is just that the Graphics2D object retrieved from a Canvas object is volatile. Although I have never seen a Graphics2D object to be volatile except when it was retrieved from a BufferStrategy. > > This is what I see. > > When I dragged an applet to the desktop, I would lose my Canvas Graphics2D object. In other words when I init my Canvas: > > canvasGraphic = (Graphics2D)this.getGraphics(); // this is a Canvas > > gives me back a volitile canvasGraphic. When I drag the applet to the desktop, canvasGraphics is no longer valid. It's not null -- just not valid. I cannot use it to draw with. The applet still responds to paint(Graphics g) calls because g is a new Graphics object. > > So when I redraw my pixel buffer, I have to get the canvasGraphics object each time to be sure that it is still valid like this: > > I call this method now for every frame I draw when the user pans/tilts/zooms. > public void newPixels() > { > canvasGraphic= (Graphics2D)this.getGraphics(); > canvasGraphic.drawImage(paintImage, 0, 0, thisW, thisH, this); > } > > It used to look like: > public void newPixels() > { > canvasGraphic.drawImage(paintImage, 0, 0, thisW, thisH, this); > } > > And the above works fine until the applet is dragged to the desktop, then canvasGraphic becomes invalid (or something) and drawImage() doesn't draw the image on the Canvas. > > Is this a bug??? Is this the way it's supposed to be??? I don't know. Creating a new graphics context for every rendering cycle is the preferred way actually, but it is supposed to work either way, so it's a bug. > Open: > http://pancyl.com/ > > I've added the code to get a new Graphics2D object each time I draw my pixel buffer. It works now just like before 1.6.0.14. I don't recall ever having to do this. But I was using BufferStrategy and I was getting the Graphics2D object each time I drew. I changed to using an unmanaged BufferedImage that I draw directly onto my Canvas. I didn't know that the Canvas graphics object was volatile. I don't recall ever having to get the graphics object from the Canvas each time I draw into it. Did something change? I don't think anything changed in 6u14 that'd do that, but this bug may have been introduced in 6u10. Thanks, Dmitri =========================================================================== To unsubscribe, send email to listserv@... and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to listserv@... and include in the body of the message "help". |
|
|
Re: Graphics2D object retrieved from Canvas is volitile...> java2d@... wrote:
> > I first thought this was a bug in the 1.6.0.14 >> plugin. But perhaps it is just that the Graphics2D >>object retrieved from a Canvas object is volatile. >> Is this a bug??? Is this the way it's supposed to >> be??? I don't know. > Creating a new graphics context for every > rendering cycle is the preferred > ay actually, but it is supposed to work either way, > so it's a bug. > > Dmitri I'll leave it up to you (or somebody) to file a bug report. I have the work around which doesn't appear to impact performance so I'm pretty much done with this. [Message sent by forum member 'demonduck' (demonduck)] http://forums.java.net/jive/thread.jspa?messageID=353440 =========================================================================== To unsubscribe, send email to listserv@... and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to listserv@... and include in the body of the message "help". |
|
|
Re: Graphics2D object retrieved from Canvas is volitile... I filed a bug
6855841: D3D: graphics object doesn't get revalidated for applets which were dragged out of the browser Will show up on bug parade later today. Thanks, Dmitri java2d@... wrote: >> java2d@... wrote: >>> I first thought this was a bug in the 1.6.0.14 >>> plugin. But perhaps it is just that the Graphics2D >>> object retrieved from a Canvas object is volatile. >>> Is this a bug??? Is this the way it's supposed to >>> be??? I don't know. > >> Creating a new graphics context for every >> rendering cycle is the preferred >> ay actually, but it is supposed to work either way, >> so it's a bug. >> > >> Dmitri > > > I'll leave it up to you (or somebody) to file a bug report. I have the work around which doesn't appear to impact performance so I'm pretty much done with this. > [Message sent by forum member 'demonduck' (demonduck)] > > http://forums.java.net/jive/thread.jspa?messageID=353440 > > =========================================================================== > To unsubscribe, send email to listserv@... and include in the body > of the message "signoff JAVA2D-INTEREST". For general help, send email to > listserv@... and include in the body of the message "help". =========================================================================== To unsubscribe, send email to listserv@... and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to listserv@... and include in the body of the message "help". |
|
|
Re: Graphics2D object retrieved from Canvas is volitile...Thank you...
[Message sent by forum member 'demonduck' (demonduck)] http://forums.java.net/jive/thread.jspa?messageID=353452 =========================================================================== To unsubscribe, send email to listserv@... and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to listserv@... and include in the body of the message "help". |
| Free embeddable forum powered by Nabble | Forum Help |