?
Solved

Drawing an Oscilloscope (flickerfree & fast)

Posted on 1998-08-27
4
Medium Priority
?
271 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 300 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

766 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