mirror of
https://github.com/2006-Scape/2006RebottedClient.git
synced 2026-07-03 00:31:48 +00:00
Initial commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package org.rebotted.draw;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
|
||||
public final class ProducingGraphicsBuffer {
|
||||
|
||||
public final int[] canvasRaster;
|
||||
public final int canvasWidth;
|
||||
public final int canvasHeight;
|
||||
private final BufferedImage bufferedImage;
|
||||
private float[] depthbuffer;
|
||||
|
||||
public ProducingGraphicsBuffer(int canvasWidth, int canvasHeight) {
|
||||
this.canvasWidth = canvasWidth;
|
||||
this.canvasHeight = canvasHeight;
|
||||
depthbuffer = new float [canvasWidth * canvasHeight];
|
||||
bufferedImage = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_RGB);
|
||||
canvasRaster = ((DataBufferInt) bufferedImage.getRaster().getDataBuffer()).getData();
|
||||
initDrawingArea();
|
||||
}
|
||||
|
||||
public void drawGraphics(int x, Graphics graphics, int y) {
|
||||
graphics.drawImage(bufferedImage, y, x, null);
|
||||
}
|
||||
|
||||
public void initDrawingArea() {
|
||||
Rasterizer2D.initDrawingArea(canvasHeight, canvasWidth, canvasRaster, depthbuffer);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user