I am developing a program that must calculate a color of each point on a 1024×1024 picture using a special algorithm. The color of a point represents some value. So each point is independent of other points and must be drawn separately. I do not have to refresh the picture too frequently. Actually, I need to display it only once.
What is the fastest approach to drawing separate pixels in Qt?
Can I get some sort of “screen memory” and write all the picture as an array of 4-byte sets, representing each pixel as 4 bytes in that memory?
The
QImageclass is optimized for pixel manipulation. You can instantiate one with the requred size and then either set the pixels individuallysetPixel, or access the raw data and manipulate them in place viabits(). Just be sure to use the correct format (e.g. RGBA values or color indices for 8-bit images)