By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 858 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

VB2005 line drawing speedup

P: n/a

My VB2005 app gets real time Heart sounds and an ECG from a USB device. I'm
looking for a way to speed up the drawing of the traces on the screen.

In the following code the routine GetSounds recieves the USB data for six
consequtive horizontal pixels (or 6 sound/ECG samples). The routine FixChns
handles the scaling of the data and puts it into the PlotAry for
presentation.

The variable RptCnt then handles the placement for the 6 sets of samples.
The call to Obj.DoLine draws lines from previous pixel location to current
pixel location.

For Index = gScreen.HorPixels - Gap - 1 To gScreen.HorPixels - 2
Step 1
If RptCnt = 0 And Index < gScreen.HorPixels - 6 Then
Call GetSounds()
If ErrFlg Then
Exit Sub
End If
Call FixChns(ArgX3 + 6)
If ErrFlg Then
Exit Sub
End If
End If
For Inner = 0 To NumChns - 1 Step 1
ArgY2 = PlotAry(Inner, Index + 1)
ArgY1 = PlotAry(Inner, Index)
Obj.DoLine(ArgX3, ArgY1, ArgX4, ArgY2, glngColors(Inner +
4))
Next Inner
ArgX3 = ArgX3 + 1
ArgX4 = ArgX4 + 1
RptCnt = RptCnt + 1
If RptCnt = 6 Then RptCnt = 0
Next Index

Obj.Doline is a call to a ctlPictDraw class which is on my web site

http://home.surewest.net/galen/download/download.html

There are other drawing routines in the dll but they do not require any
speedup.

The actual display is like an oscilloscope display with a moving gap. The
above code is actually the third procedure. The second procedure is
complicated by calling Obj.DoLine to remove the traces from previous screen
sweep before drawing the new lines (on an xor basis). The first procedure
merely calls Obj.DoLine to remove x number of lines to create the start of
the moving gap.

At the end of a sweep the PlotAry is copied to a PrevAry

Whew. I would appreciate a graphics drawing guru to take a look at this
whole mess.

Galen
Jan 20 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Galen,

The only thing I know to speed up lines is to use groupboxes where both
lines are on the same position.

Cor

"Galen Somerville" <ga***@community.nospamschreef in bericht
news:e7**************@TK2MSFTNGP05.phx.gbl...
>
My VB2005 app gets real time Heart sounds and an ECG from a USB device.
I'm looking for a way to speed up the drawing of the traces on the screen.

In the following code the routine GetSounds recieves the USB data for six
consequtive horizontal pixels (or 6 sound/ECG samples). The routine
FixChns handles the scaling of the data and puts it into the PlotAry for
presentation.

The variable RptCnt then handles the placement for the 6 sets of samples.
The call to Obj.DoLine draws lines from previous pixel location to current
pixel location.

For Index = gScreen.HorPixels - Gap - 1 To gScreen.HorPixels - 2
Step 1
If RptCnt = 0 And Index < gScreen.HorPixels - 6 Then
Call GetSounds()
If ErrFlg Then
Exit Sub
End If
Call FixChns(ArgX3 + 6)
If ErrFlg Then
Exit Sub
End If
End If
For Inner = 0 To NumChns - 1 Step 1
ArgY2 = PlotAry(Inner, Index + 1)
ArgY1 = PlotAry(Inner, Index)
Obj.DoLine(ArgX3, ArgY1, ArgX4, ArgY2, glngColors(Inner +
4))
Next Inner
ArgX3 = ArgX3 + 1
ArgX4 = ArgX4 + 1
RptCnt = RptCnt + 1
If RptCnt = 6 Then RptCnt = 0
Next Index

Obj.Doline is a call to a ctlPictDraw class which is on my web site

http://home.surewest.net/galen/download/download.html

There are other drawing routines in the dll but they do not require any
speedup.

The actual display is like an oscilloscope display with a moving gap. The
above code is actually the third procedure. The second procedure is
complicated by calling Obj.DoLine to remove the traces from previous
screen sweep before drawing the new lines (on an xor basis). The first
procedure merely calls Obj.DoLine to remove x number of lines to create
the start of the moving gap.

At the end of a sweep the PlotAry is copied to a PrevAry

Whew. I would appreciate a graphics drawing guru to take a look at this
whole mess.

Galen


Jan 21 '07 #2

P: n/a
Cor

It would be rare when lines are in the same position from sweep to sweep.

Galen

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:eM**************@TK2MSFTNGP05.phx.gbl...
Galen,

The only thing I know to speed up lines is to use groupboxes where both
lines are on the same position.

Cor

"Galen Somerville" <ga***@community.nospamschreef in bericht
news:e7**************@TK2MSFTNGP05.phx.gbl...
>>
My VB2005 app gets real time Heart sounds and an ECG from a USB device.
I'm looking for a way to speed up the drawing of the traces on the
screen.

In the following code the routine GetSounds recieves the USB data for six
consequtive horizontal pixels (or 6 sound/ECG samples). The routine
FixChns handles the scaling of the data and puts it into the PlotAry for
presentation.

The variable RptCnt then handles the placement for the 6 sets of samples.
The call to Obj.DoLine draws lines from previous pixel location to
current pixel location.

For Index = gScreen.HorPixels - Gap - 1 To gScreen.HorPixels - 2
Step 1
If RptCnt = 0 And Index < gScreen.HorPixels - 6 Then
Call GetSounds()
If ErrFlg Then
Exit Sub
End If
Call FixChns(ArgX3 + 6)
If ErrFlg Then
Exit Sub
End If
End If
For Inner = 0 To NumChns - 1 Step 1
ArgY2 = PlotAry(Inner, Index + 1)
ArgY1 = PlotAry(Inner, Index)
Obj.DoLine(ArgX3, ArgY1, ArgX4, ArgY2, glngColors(Inner +
4))
Next Inner
ArgX3 = ArgX3 + 1
ArgX4 = ArgX4 + 1
RptCnt = RptCnt + 1
If RptCnt = 6 Then RptCnt = 0
Next Index

Obj.Doline is a call to a ctlPictDraw class which is on my web site

http://home.surewest.net/galen/download/download.html

There are other drawing routines in the dll but they do not require any
speedup.

The actual display is like an oscilloscope display with a moving gap. The
above code is actually the third procedure. The second procedure is
complicated by calling Obj.DoLine to remove the traces from previous
screen sweep before drawing the new lines (on an xor basis). The first
procedure merely calls Obj.DoLine to remove x number of lines to create
the start of the moving gap.

At the end of a sweep the PlotAry is copied to a PrevAry

Whew. I would appreciate a graphics drawing guru to take a look at this
whole mess.

Galen



Jan 21 '07 #3

P: n/a
Hi Galen.

I'm afraid it is difficult to improve the performance without actual data
and environment.
But in general, we will suggest using DirectDraw or DirectShow to get more
performance.

Hope this will help.
Best regards,
Wen Yuan

Jan 23 '07 #4

P: n/a
Thanks, will look into both of those.

Galen

"WenYuan Wang" <v-******@online.microsoft.comwrote in message
news:ht**************@TK2MSFTNGHUB02.phx.gbl...
Hi Galen.

I'm afraid it is difficult to improve the performance without actual data
and environment.
But in general, we will suggest using DirectDraw or DirectShow to get more
performance.

Hope this will help.
Best regards,
Wen Yuan

Jan 23 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.