Solved

Drawing an Oscilloscope (flickerfree & fast)

Posted on 1998-08-27
4
249 Views
Last Modified: 2013-11-19
I want to display an oscilloscope in a window.  This oscilloscope would have a fixed grid, some fixed text, and the moving signal display.

Ideally the grid and text should be displayed BEHIND the signal, but this is not critical.

The grid and text should be flicker-free.

Finally the scope should not take too much processor time.  It is displaying the result of a fairly intensive calculation process, and I don't want to spend half my time just painting.

What is the best way to implement something like this in MFC?

Carlos
0
Comment
Question by:carlosn
  • 3
4 Comments
 
LVL 7

Accepted Solution

by:
psdavis earned 100 total points
ID: 1321406
Look at www.codeguru.com and there you will find two ways to perform flicker free drawing.  One uses a CMemDC method that is quite easy.  The other gives you a class that you will derive from.

Second, you may want to consider drawing all of your data into a precreated bitmap in your resource file.  (256 color is fine).  Then use LoadImage to access the bitmap and draw directly onto your bitmap.

Phillip
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1321407
Also take a quick look at DrawDibDraw and it's associated functions in the Video for Windows SDK.  I've used them briefly, but if you have a lot of images to display in a row it could be useful.

Also (and possibly best) you may want to choose your signal wisely, if you use the XOR pen to draw your data, then you can just erase the signal with another XOR drawing.  Then you won't have to redraw the entire bitmap at all.  Just XOR on and XOR off the signal.

Phillip
0
 
LVL 1

Author Comment

by:carlosn
ID: 1321408
Thank you, I'll have to check the XOR idea.

I have started using some of the memory DC, and found that the BitBlt was incredibly slow.  Is this normal?  Copying over a bitmap thats about 300x200 pixels, it was taking about 6% of the softwares time (according to the profiler).  Each BitBlt ran for about 2 ms, and the window is getting updated every 50 ms or so.
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1321409
Yes, BitBlt is slow.  DrawDibDraw was created to be faster.

Good luck.

Phillip
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
List out all word 7 316
java ^ examples 8 69
matchUp  challenge 9 115
mapBully challenge 6 152
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question