Solved

Drawing an Oscilloscope (flickerfree & fast)

Posted on 1998-08-27
4
263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

726 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