473,387 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

VB2005 line drawing speedup


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
4 1625
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: thomasp | last post by:
I found the following code on MSDN to draw a line in VB2005. Public Sub DrawLinePoint(ByVal e As PaintEventArgs) ' Create pen. Dim blackPen As New Pen(Color.Black, 3) ' Create points that...
10
by: Galen Somerville | last post by:
Going from VB6 (RAD) to VB2005 (SAD) The documentation always shows graphics drawing in a paint event like Private Sub Pictcolor_Paint(ByVal sender As Object, ByVal e _ As...
4
by: Galen Somerville | last post by:
I have a real timing problem. This involves getting data from a USB device via an ActiveX dll and drawing trace lines on the screen via a UserControl. The USB device sends six sets of pixel info...
7
by: Galen Somerville | last post by:
I have been converting a VB6 project to VB2005 for lo these many months. Most of my problems have been solved thanks to people like WanYuan Wang and Mattias Sjogren. But now the Graphics aspect is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.