Discuss any general programming issues here
- Posts: 204
- Joined: Tue Feb 16, 2010 12:50 am
- Location: Westfalen/Germany
How do I create a bitmap from an arry and plot that as a brush or sprite?
Given I want to do some kind of oscilloscope I now draw lined from one sample point of my array to the next.
Code: Select all
For k=0 To 498
Line (k+12, 180+temp_o,k+12,180+last_temp_o, $00cc80)
Line (k+511, 180+oszidata[k],k+511,180+oszidata[k+1], $00cc80)
But drawing lots of lines (499/125ms) is rather cpu time intensive, hence I want to precalculate a bitmap out of my sample and plot it as one single brush. Unfortunately I don't have a clue how to do this. Any hints?
- Posts: 3276
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
You could simply draw the lines to an offscreen bitmap using SelectBrush(). After you have drawn the lines, you can then just display the whole brush. Alternatively, you can use a double buffer setup using BeginDoubleBuffer() and Flip().