12-15-2021 01:44 PM - edited 12-15-2021 01:45 PM
For some perspective on the original problem, have a look at my post in an interesting old thread from a over decade ago. 😄
12-16-2021 02:41 AM - edited 12-16-2021 02:48 AM
The problem with a 2D array is that it's much harder to draw circles, lines and boxes (with varying line widths) in it.
Looking at the OP, the 'static' picture has lines, boxes and circles.
Of course you can draw the static stuff up front, convert it to a pixmap, and draw over the pixmap...
12-16-2021 11:13 AM
Well, in my example, each point of the intensity graph is exactly 1x1 pixels of the monitor (might need slight adjustments, but I am close). For example of you want a specific sprite, you could compose it as e.g. 50x50 picture, convert to a 2D array, then convert all pixels to be drawn to a 1D complex array and use the same code as to what I did for the crosshair in the last example). The nice things with complex is that you can even apply a rotation if needed, for example to model a spaceship traveling along an arbitrary curve.
12-16-2021 01:27 PM
@altenbach wrote:
The nice things with complex is that you can even apply a rotation if needed...
Here's a simple example that rotates and pulsates the crosshair. 😄
(I reduced the canvas to 400x400 for simplicity. With a 0ms wait (not recommended) Loop rate is a constant 14us, independent on the number of points. This means that even with a 1ms wait, the loop is 98+% idle. :D)
It would be easy to make all elements e.g. double-width or triple-width, of course)
12-20-2021 03:06 AM
Sorry I was sick last days, I didn't answered. Thank you for your detailed answer altenbach. It seems to be a good solution. Drawing pixel after pixel is not friendly, but it is allway possible to generate sprites with normal picture functions or another drawing software.
This intensity graph is suprisely smooth with a very high refresh rate. Definitively a good way to draw animated pictures.
Thank you for your support.