Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Dec 15, 2018 12:07 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Picture Crisp
PostPosted: Sat Mar 09, 2013 9:35 am 
Offline

Joined: Mon May 10, 2010 6:51 am
Posts: 36
Location: Berlin, Germany
Hey guys,

I have got a little problem with picture drawings in a canvas.
The pictures will be drawed double buffered into the canvas, to by switching double-buffered on rather than using two pictures.
An by the time the program is running the picture on the canvas get crisp.

From this:
Image

To this:
Image


Does someone knows why this happen and how to avoid it?

Best regards. :)

_________________
Visit: Paeric's | OpenSource Code Resources
iMac 8,1 ; PowerBook G4(5,2) ; iBook G3 (Clamshell)


Top
 Profile  
Reply with quote  
 Post subject: Re: Picture Crisp
PostPosted: Sat Mar 09, 2013 2:29 pm 
Offline
User avatar

Joined: Thu Sep 10, 2009 2:50 am
Posts: 418
Location: Santa Cruz, CA, USA
As far as I know DoubleBuffer is only for Windows, on mac the OS does it for you. So turn that off if you're only doing mac.

Your pictures are getting crisp because it's being drawn over many times, each time the anti-aliased edges get darker and darker, filling those pixels in to solid black.

I'd need to see some code to know what's going on. My guess is that you're drawing to the Canvas' Graphics from outside the Paint event as that's the only way I know to not erase the previous drawing. While this still works you should refactor your code to draw only in Paint, this would fix your problem as the Canvas is cleared each time Paint. For a quick and hacky fix without refactoring just clear the canvas before drawing...
MyCanvas.Graphics.ClearRect(0, 0, MyCanvas.Width, MyCanvas.Height)
MyCanvas.Graphics.DrawPicture(myPic, 0, 0)


Really though move you code into Paint. It might seem weird at first but it's actually cleaner once you get the habit.


Top
 Profile  
Reply with quote  
 Post subject: Re: Picture Crisp
PostPosted: Mon Mar 11, 2013 8:23 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:00 am
Posts: 583
Location: Beautiful Taiwan
doofus wrote:
As far as I know DoubleBuffer is only for Windows, on mac the OS does it for you. So turn that off if you're only doing mac.

Your pictures are getting crisp because it's being drawn over many times, each time the anti-aliased edges get darker and darker, filling those pixels in to solid black.

I'd need to see some code to know what's going on. My guess is that you're drawing to the Canvas' Graphics from outside the Paint event as that's the only way I know to not erase the previous drawing. While this still works you should refactor your code to draw only in Paint, this would fix your problem as the Canvas is cleared each time Paint. For a quick and hacky fix without refactoring just clear the canvas before drawing...
MyCanvas.Graphics.ClearRect(0, 0, MyCanvas.Width, MyCanvas.Height)
MyCanvas.Graphics.DrawPicture(myPic, 0, 0)


Really though move you code into Paint. It might seem weird at first but it's actually cleaner once you get the habit.

That certainly seems like the solution, but I've seen this when the drawing is only in the paint event. Overlapping controls seem to be able to cause a redraw and sometimes without flushing the buffer first.

_________________
Sam Rowlands
rMBP 15" @ 10.8 & '08 MBA 13" @ 10.6 + 10.7, RB2012
http://www.ohanaware.com/
AppWrapper - Prepare Apps for Mac App Store & OS X 10.8 - http://www.ohanaware.com/appwrapper/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group