Hi,
I'm currently trying to create solid image with just hight width parameters added.
I made pretty fast code which loops every pixel in image and sets its color, but it looks too much work.
For example in 2000x2000 image buffer.setRGBA(x, y, r, g, b, a); should be called 4 000 000 times..
Is there any smarter way to do this?
Code:
public Image getImage(int width, int height, int r, int g, int b, int a) {
ImageBuffer buffer = new ImageBuffer(width, height);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
buffer.setRGBA(x, y, r, g, b, a);
}
}
return buffer.getImage();
}