I found Onyx’s code about chopping up a large imgae and into BufferedImages…real nice.
but
Which would be faster?
Method 1: (isnt this accelerated?)
public BufferedImage getMsgBox() {
//BufferedImage bi = getBaseBI();
BufferedImage bi = new BufferedImage(boxWidth,75,Transparency.BITMASK);
Graphics2D g = bi.createGraphics();
int y = 20;
g.setColor(Color.white);
for(int i = 0;i<10;i++) {
g.drawString("Hi all!" + i, 10,y);
y+=13;
}
g.dispose();
//bi = applyMask(bi, Color.black);
return bi;
}
Then somewhere in main loop
g.drawImage(getMsgBox(), 400,10, null);
Method 2:
public void getMsgBox(Graphics2D g) {
int y = 20;
for(int i = 0;i<10;i++) {
g.setColor(msg.color());
g.drawString("Hi all"+i, 10, y);
y+=13;
}
}
Then somewhere in main loop
getMsgBox(g);
My guess would be neither since I am calling a g.drawString,Rect,Oval or what have you, in both methods. ?