Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: How to improve my application "oscillogram viewer"


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 11 - Last Post: May 26, 2014 2:22 PM Last Post By: Alberto di Bene
Nikolay Емукв

Posts: 5
Registered: 4/15/14
How to improve my application "oscillogram viewer"  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 7, 2014 12:55 AM
Dear Developers.

I ask you to give me a piece of advice about Drawing Oscillograms Program.

I have developed an application that could show oscillograms. That oscillograms (osc) consist of a whole bunch of Digital and Analog signals.
The friquency of saving signals data is 1200 Hz. So, as you can see the 20 sec osc consist of 24000 Samples.
The way I vizualize it is Drawing osc on the PaintBox->Canvas. And if user zooms it in greatly ( X axis scale >> 1 ) program works well, becouse it is necessary to draw only a few hundreds of Samples.
But if user zoom it out ( X axis scale << 1 ) the program starts to work slowly ( for instant, during Scrolling it ), because more information should be appeared on the screen (thousands of Samples should be drawn).

So, I want to improve it.

For example, I decided to draw all the samples at once, and then using Canvas->StreachDraw() function to execute Zoom In and Zoom Out. But this idea is not good, because StreachDraw function moves pixels with some random offset.
Another problem is that some osc could be very big (50 sec. for example), and Bitmap, for instant, has no 60000 pixels of width.

What I ask you is to give me idea, please, What is the better way to realize my project. It seems to me, that there could be some elegant solution, that you probably know.

I will appreciate all the comments and suggestions.

Sincerely
Nik

Asger Joergensen

Posts: 370
Registered: 11/18/08
Re: How to improve my application "oscillogram viewer"  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 7, 2014 11:35 PM   in response to: Nikolay Емукв in response to: Nikolay Емукв
Hi Nikolay

Nikolay Емукв wrote:

Dear Developers.

What I ask you is to give me idea, please, What is the better way to realize
my project. It seems to me, that there could be some elegant solution, that
you probably know.

I will appreciate all the comments and suggestions.

I am thinking an analogy to virtual listview. In virtual listview the
actual view of the list only know the items it is supposed to show.

So if you have a list of time intervals, where you store the signals
in math form. When the user scrolls or zoom you deliver the requested
interval.

In the GUI you have a function that can convert the math to Bitmap.
This bitmap is only the size of what is max visible e.g. screen size
or desktop size if 2 screens.

When the bitmap is drawn you call PaintBox->Invalidate() and in PaintBox::Paint
you BitBlt the bitmap to the PaintBox->Canvas.

Note: Never draw directly on a GUI canvas if you need speed !!
always draw on a background of screen bitmap.
Never use Canvas->Pixels for drawing use Bitmap->Sanline instead,

Best regards
Asger-P
MacroMenu a must have for programmer, view the video:
http://asger-p.dk/software/macromenu.php#QuickTour

Nikolay Емукв

Posts: 5
Registered: 4/15/14
Re: How to improve my application "oscillogram viewer"  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 8, 2014 6:38 AM   in response to: Asger Joergensen in response to: Asger Joergensen
Asger Joergensen wrote:
Hi Nikolay

Nikolay Емукв wrote:

Dear Developers.

What I ask you is to give me idea, please, What is the better way to realize
my project. It seems to me, that there could be some elegant solution, that
you probably know.

I will appreciate all the comments and suggestions.

I am thinking an analogy to virtual listview. In virtual listview the
actual view of the list only know the items it is supposed to show.

So if you have a list of time intervals, where you store the signals
in math form. When the user scrolls or zoom you deliver the requested
interval.

In the GUI you have a function that can convert the math to Bitmap.
This bitmap is only the size of what is max visible e.g. screen size
or desktop size if 2 screens.

When the bitmap is drawn you call PaintBox->Invalidate() and in PaintBox::Paint
you BitBlt the bitmap to the PaintBox->Canvas.

Note: Never draw directly on a GUI canvas if you need speed !!
always draw on a background of screen bitmap.
Never use Canvas->Pixels for drawing use Bitmap->Sanline instead,

Best regards
Asger-P
MacroMenu a must have for programmer, view the video:
http://asger-p.dk/software/macromenu.php#QuickTour


Dear Asger Joergensen!

First of all thank you for you answer.
To tell the truth I cannot understand (because of my English probably) what do you mean by the expression "In the GUI you have a function that can convert the math to Bitmap.". What does it mean to store signals in math form? Just having all of them as int, float and bool variables? Or something else? And another question is what is that function that converts math to the bitmap? How can I use it?

I really appreciate the time you spent on me. If I ask too much, please, just tell me sources where I can find some descriptions and explanations of my questions.

Sincerely
Nikolay
It is not
Asger Joergensen

Posts: 370
Registered: 11/18/08
Re: How to improve my application "oscillogram viewer"  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 8, 2014 8:56 AM   in response to: Nikolay Емукв in response to: Nikolay Емукв
Hi Nikolay

Nikolay Емукв wrote:

To tell the truth I cannot understand (because of my English probably) what do
you mean by the expression "In the GUI you have a function that can convert
the math to Bitmap.".

GUI stands for Graphic User Interface.
at the moment you "vizualize it is Drawing" as you put it. That must be a
function of some kind that translate the math ( oscillograms ) to something
you can draw

What does it mean to store signals in maths form? Just
having all of them as int, float and bool variables? Or something else?

If "int, float and bool variables" is what you use now, then thats what I mean.
Remember I do not know what you are drawing, I'm just talking in general, that's
why I made the analogy to the virtual ListView.

And another question is what is that function that converts math to the bitmap?

I don't think there is such a function, but there is functions for drawing math
or geometry.
http://msdn.microsoft.com/en-us/library/windows/desktop/dd145031(v=vs.85).aspx

The only thing I know about oscillo....anything is that it is curves on a
small screen representing some kind of hz from sound, light, electricity...

You write that you save 1200 times per sec. so you should probably save to
a std::list, at at least that rate and then you only draw the part of the list
that the user ask for, like a virtual ListView that can have millions of items,
but it never draws more then what the user can see, that being 20 - 40 items.
You must be able to do something similar.


Best regards
Asger-P
MacroMenu a must have for programmer, view the video:
http://asger-p.dk/software/macromenu.php#QuickTour

Nikolay Емукв

Posts: 5
Registered: 4/15/14
Re: How to improve my application "oscillogram viewer"  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 8, 2014 9:49 AM   in response to: Asger Joergensen in response to: Asger Joergensen
Asger Joergensen wrote:
Hi Nikolay

Nikolay Емукв wrote:

To tell the truth I cannot understand (because of my English probably) what do
you mean by the expression "In the GUI you have a function that can convert
the math to Bitmap.".

GUI stands for Graphic User Interface.
at the moment you "vizualize it is Drawing" as you put it. That must be a
function of some kind that translate the math ( oscillograms ) to something
you can draw

What does it mean to store signals in maths form? Just
having all of them as int, float and bool variables? Or something else?

If "int, float and bool variables" is what you use now, then thats what I mean.
Remember I do not know what you are drawing, I'm just talking in general, that's
why I made the analogy to the virtual ListView.

And another question is what is that function that converts math to the bitmap?

I don't think there is such a function, but there is functions for drawing math
or geometry.
http://msdn.microsoft.com/en-us/library/windows/desktop/dd145031(v=vs.85).aspx

The only thing I know about oscillo....anything is that it is curves on a
small screen representing some kind of hz from sound, light, electricity...

You write that you save 1200 times per sec. so you should probably save to
a std::list, at at least that rate and then you only draw the part of the list
that the user ask for, like a virtual ListView that can have millions of items,
but it never draws more then what the user can see, that being 20 - 40 items.
You must be able to do something similar.


Best regards
Asger-P
MacroMenu a must have for programmer, view the video:
http://asger-p.dk/software/macromenu.php#QuickTour


I have caught you. Thank you a lot
Boba ½°

Posts: 73
Registered: 12/19/03
Re: How to improve my application "oscillogram viewer"  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 14, 2014 4:43 PM   in response to: Asger Joergensen in response to: Asger Joergensen
"Asger Joergensen" wrote in message news:673030 at forums dot embarcadero dot com...
Never use Canvas->Pixels for drawing use Bitmap->Sanline instead,
wtf is
Bitmap->Sanline????????????????????????????????????????????????????????

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

Asger Joergensen

Posts: 370
Registered: 11/18/08
Re: How to improve my application "oscillogram viewer"  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 14, 2014 10:34 PM   in response to: Boba ½° in response to: Boba ½°
Hi Boba

Boba ½° wrote:

"Asger Joergensen" wrote in message news:673030 at forums dot embarcadero dot com...
Never use Canvas->Pixels for drawing use Bitmap->Sanline instead,
wtf is
Bitmap->Sanline????????????????????????????????????????????????????????

You've never heard of Scanline, I doubt it.;)

The CB2009 help say:

<quote>
TBitmap.ScanLine Property

Provides indexed access to each line of pixels.

Pascal
property ScanLine [Row: Integer]: Pointer;
C++
__property void * ScanLine[int Row];
Description
ScanLine is used only with DIBs (Device Independent Bitmaps) for image
editing tools that do low-level pixel work.
</quote>

Best regards
Asger-P
MacroMenu a must have for programmer, view the video:
http://asger-p.dk/software/macromenu.php#QuickTour

Boba ½°

Posts: 73
Registered: 12/19/03
Re: How to improve my application "oscillogram viewer"  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 15, 2014 1:56 PM   in response to: Asger Joergensen in response to: Asger Joergensen
"Asger Joergensen" wrote in message news:674732 at forums dot embarcadero dot com...

ScanLine is used only with DIBs (Device Independent Bitmaps)

i'm glad you've answered your own question

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
Asger Joergensen

Posts: 370
Registered: 11/18/08
Re: How to improve my application "oscillogram viewer"  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 15, 2014 3:56 PM   in response to: Boba ½° in response to: Boba ½°
Hi Boba

Boba ½° wrote:

"Asger Joergensen" wrote in message news:674732 at forums dot embarcadero dot com...

ScanLine is used only with DIBs (Device Independent Bitmaps)

i'm glad you've answered your own question

I don't recall asking a question.
Don't you have anything better to do then nitpicking ?

Yes I could have said more about working on a behind the scene bitmap,
and that it preferably should be in 32bit, because it is easier to
work with.

But you are definitely not the right person to criticize half answers,
most of the time you only give a hint or two in a very cryptic language,
that I for one find it very hard to understand.

Best regards
Asger-P
MacroMenu a must have for programmer, view the video:
http://asger-p.dk/software/macromenu.php#QuickTour
Boba ½°

Posts: 73
Registered: 12/19/03
Re: How to improve my application "oscillogram viewer"  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 17, 2014 12:39 PM   in response to: Asger Joergensen in response to: Asger Joergensen
my point is: the OP is trying to speed-up his BCB based
graphics, and you suggest to use the slowest possible
drawing - the one that works with DIB only. convenience
of DIBs is paid for by the speed.
@Nikolay: draw your oscillograms directly.

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
Asger Joergensen

Posts: 370
Registered: 11/18/08
Re: How to improve my application "oscillogram viewer"  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 17, 2014 3:21 PM   in response to: Boba ½° in response to: Boba ½°
Hi Boba

Boba ½° wrote:

my point is: the OP is trying to speed-up his BCB based
graphics, and you suggest to use the slowest possible
drawing - the one that works with DIB only. convenience
of DIBs is paid for by the speed.

Why didn't you just say so right away :O

I don't agree with you though, in my experience working with Canvas->Pixels
is way slower then working with scanlines and working on a behind the scene
bitmap is in my experience also faster then working directly on the canvas.
But I know you are a very well skilled programmer, so you might very well
know some tricks that I don't know about, the problem as I see it, is that
you usually don't show any solutions, you just point at what you think is
wrong and that isn't very helpful.

Best regards
Asger-P
MacroMenu a must have for programmer, view the video:
http://asger-p.dk/software/macromenu.php#QuickTour

Alberto di Bene

Posts: 11
Registered: 4/13/00
Re: How to improve my application "oscillogram viewer"  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 26, 2014 2:22 PM   in response to: Nikolay Емукв in response to: Nikolay Емукв
On 5/7/2014 9:55 AM, Nikolay Емукв wrote:

I ask you to give me a piece of advice about Drawing Oscillograms Program.

In one of my SDR programs I draw a spectrum of the digitized signal with an adjustable
speed that can reach 30 refresh/sec, and I found that the Windows GDI Polyline API
is just what the doctor ordered. Maybe it could be useful also for your problem.
I just prepare an array of X,Y pairs in integer format, then pass it to the API. Very fast indeed.

Of course, I first draw on an off-screen bitmap, then do a BitBlt of the bitmap on the form canvas.

Alberto


---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02