Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » How to know if I am drawing on screen?
How to know if I am drawing on screen? [message #25717] Tue, 09 March 2010 09:49 Go to next message
chickenk is currently offline  chickenk
Messages: 169
Registered: May 2007
Location: Grenoble, France
Experienced Member
Hi,

I'd like to know the best way to get information, whether my draw object will draw on screen or on an image, for example.

I saw somewhere such code:
func(Draw& w)
{
   if(w.IsGui())
      ... // We are on screen
   else
      ... // other cases
}

But after looking deeper, IsGui() is true on Windows with GDI, but is false under X11 (See implementation of SystemDraw::GetInfo()).

So I suspect this is not the right way... What is better ?

Thanks
Lionel
Re: How to know if I am drawing on screen? [message #25722 is a reply to message #25717] Tue, 09 March 2010 11:49 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
I don't think there is a specific way to do this. The idea is that you shouldn't care.

Maybe you could do:
if (dynamic_cast<SystemDraw>(&w)) {
   // Drawing to screen
}
else {
   // Drawing to some kind of buffer
}
Re: How to know if I am drawing on screen? [message #25724 is a reply to message #25722] Tue, 09 March 2010 11:59 Go to previous message
chickenk is currently offline  chickenk
Messages: 169
Registered: May 2007
Location: Grenoble, France
Experienced Member
mrjt wrote on Tue, 09 March 2010 11:49

I don't think there is a specific way to do this. The idea is that you shouldn't care.

Maybe you could do:
if (dynamic_cast<SystemDraw>(&w)) {
   // Drawing to screen
}
else {
   // Drawing to some kind of buffer
}



Thanks, good idea. I used dynamic_cast<SystemDraw*>(&w).

I agree that I should not care but in fact, this is not my code. I am trying to get antialiasing to work correctly for the Scatter control from Bazaar.

regards,
Lionel
Previous Topic: Crash when loading images into 64bit exes
Next Topic: Draw::WrawText to paint ASCII sequence
Goto Forum:
  


Current Time: Thu Mar 28 21:21:37 CET 2024

Total time taken to generate the page: 0.00905 seconds