What is the fastest way to draw pixels in Java

前端 未结 5 2047
无人共我
无人共我 2020-12-28 23:52

I have some code that generates particles at random locations, and moving in random directions and speed.

Each iteration through a loop, I move all the particles, an

5条回答
  •  悲哀的现实
    2020-12-29 00:08

    I see a huge improvement in setting the bytes the data of a BufferedImage. To do that you'll need get the data from the BufferedImage, turn it into a byte array, set each byte (depending on the type of the image, the byte arrangement will be different. For example: ARGB will have one byte for alpha, one for red, one for green, one for blue. One pixel will be a block of 4 consecutive bytes.) Read more about getting the data here

提交回复
热议问题