Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] GC operations outside paint callback

Yes, it is possible to draw outside of paint.




Stef van Dijk <svandijk@xxxxxxxxxx> 
Sent by: platform-swt-dev-admin@xxxxxxxxxxx
07/24/2004 09:49 AM
Please respond to
platform-swt-dev


To
platform-swt-dev@xxxxxxxxxxx
cc

Subject
Re: [platform-swt-dev] GC operations outside paint callback







Personal Profile and Personal Configuration (ie AWT) based on SWT also 
relies on this behavior. That's because in AWT you're allowed to get a 
Graphics at any time, draw with it at any time and hold the Graphics 
object for the entire life span of your application if you wish. Not that 
I think that's a particularly good choice on the part of AWT, but it is 
the way it's spec'ed. 

     Stef 



Knut Radloff/Raleigh/IBM@IBMUS 
Sent by: platform-swt-dev-admin@xxxxxxxxxxx 
07/23/2004 04:27 PM 

Please respond to
platform-swt-dev


To
platform-swt-dev@xxxxxxxxxxx 
cc

Subject
Re: [platform-swt-dev] GC operations outside paint callback









So if draw2d relies on it, it is probably expected to work by the users of 
SWT. I'd still like to hear from the SWT team "yes, this is in fact a 
supported way of using a GC" or "no". I'm thinking the answer is yes for 
SWT but don't want to make assumptions since in other toolkits the answer 
is no. 


Randy Hudson/Raleigh/IBM@IBMUS 
Sent by: platform-swt-dev-admin@xxxxxxxxxxx 
07/23/2004 04:20 PM 

Please respond to
platform-swt-dev



To
platform-swt-dev@xxxxxxxxxxx 
cc

Subject
Re: [platform-swt-dev] GC operations outside paint callback











This works fine.  This is how draw2d paints.  The only known issues are on 
GTK if you ARE inside a paint callback, and you try to create your own GC 
with a bigger clip region than the one sent in the paint event, painting 
will still be clipped to the region sent in the event.  The workaround is 
to use the repaint mechanism always or at least when this occurs. 

-Randy 


Knut Radloff/Raleigh/IBM@IBMUS 
Sent by: platform-swt-dev-admin@xxxxxxxxxxx 
07/23/2004 04:00 PM 
Please respond to platform-swt-dev 
        
      To:        platform-swt-dev@xxxxxxxxxxx 
      cc:         
      Subject:        [platform-swt-dev] GC operations outside paint 
callback






Is it valid for an application to render directly on a GC, outside a paint 
callback? E.g., given the code below am I guaranteed to get the expected 
line on all SWT implementations? I don't think this is spec'd anywhere. Is 
this "implementation dependent" behavior? 

shell = new Shell() 
shell.open() 
gc = new GC(shell); 
gc.drawLine(0, 0, 10, 0); 

The JUnit tests don't call GC operations inside a paint callback but they 
also don't test if a call actually rendered the expected output. 

Thanks, Knut 



Back to the top