Hi chriscross,
It's nice to see you are using FastPix. Here's a suggestion for what I think will be a more efficient approach. Instead of plotting the points directly to the picturebox Image, plot them to a single horizontal line:
I've used my favourite FastPix version, the Integer array, because it's far away the most efficient. Still, I'm not certain that the above will actually be much faster than old-fashioned Bitmap.SetPixel, because the number of pixels involved is probably small and Lockbits/FastPix has an overhead.Code:Dim radialLine As New Bitmap(scale, 1) Using fp As New FastPix(radialLine) Dim Pixels() As Integer = fp.PixelArray For radius As Integer = 0 To Scale - 1 Pixels(radius) = &HFF000000 + echo(radius) * 257 * 256 'I may have to explain this! Next End Using
Now you have a horizontal line plotted in the correct colours. Next draw it at the required angle on your target bitmap. I'll assume you want to draw the full sweep circle, not just the single line. Otherwise use g.Clear to clear the graphics.
This is just a sketch and I haven't tried it out (yet) but I hope the idea is clear enough. You might gain some speed by doing your own maths and using a lookup table, but my impression is that GDI+ is pretty efficient with things like rotating the graphics. And I hope you'll agree this is much simpler.Code:'At form level: Dim bm As New Bitmap(PictureBox1.Width, PictureBox1.Height) 'In your sub: Using g As Graphics = Graphics.FromImage(bm) Using mtx As New Drawing2d.Matrix mtx.RotateAt(angle, New Point(500, 500)) 'no need to convert to radians g.Transform = mtx 'rotate the Graphics End Using g.DrawImageUnscaled(radialLine, 500, 500) End Using PictureBox1.Image = bm
BB




Reply With Quote