use of java.awt.image.BufferedImage in project android_frameworks_base by ParanoidAndroid.
the class RenderDrawable method getImage.
protected BufferedImage getImage(int w, int h) {
BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
Graphics2D gc = image.createGraphics();
gc.setComposite(AlphaComposite.Src);
gc.setColor(new Color(0x00000000, true));
gc.fillRect(0, 0, w, h);
// done
gc.dispose();
return image;
}
use of java.awt.image.BufferedImage in project BluePower by Qmunity.
the class GateComponentLever method onLayoutRefresh.
@Override
public void onLayoutRefresh() {
if (layoutColor == -1)
return;
BufferedImage img = getGate().getLayout().getLayout(layoutColor);
x = img.getWidth();
z = img.getHeight();
for (int x = 0; x < img.getWidth(); x++) {
for (int y = 0; y < img.getWidth(); y++) {
if ((img.getRGB(x, y) & 0xFFFFFF) != 0) {
this.x = Math.min(this.x, x);
z = Math.min(z, y);
}
}
}
x = x / (img.getWidth());
z = z / (img.getHeight());
}
use of java.awt.image.BufferedImage in project BluePower by Qmunity.
the class GateComponentSolarPanel method onLayoutRefresh.
@Override
public void onLayoutRefresh() {
if (layoutColor == -1)
return;
BufferedImage img = getGate().getLayout().getLayout(layoutColor);
x = img.getWidth();
z = img.getHeight();
for (int x = 0; x < img.getWidth(); x++) {
for (int y = 0; y < img.getWidth(); y++) {
if ((img.getRGB(x, y) & 0xFFFFFF) != 0) {
this.x = Math.min(this.x, x);
z = Math.min(z, y);
}
}
}
x = x / (img.getWidth());
z = z / (img.getHeight());
}
use of java.awt.image.BufferedImage in project BluePower by Qmunity.
the class GateComponentButton method onLayoutRefresh.
@Override
public void onLayoutRefresh() {
if (layoutColor == -1)
return;
BufferedImage img = getGate().getLayout().getLayout(layoutColor);
x = img.getWidth();
z = img.getHeight();
for (int x = 0; x < img.getWidth(); x++) {
for (int y = 0; y < img.getWidth(); y++) {
if ((img.getRGB(x, y) & 0xFFFFFF) != 0) {
this.x = Math.min(this.x, x);
z = Math.min(z, y);
}
}
}
x = x / (img.getWidth());
z = z / (img.getHeight());
}
use of java.awt.image.BufferedImage in project LogisticsPipes by RS485.
the class RequestMonitorPopup method saveTreeToImage.
private void saveTreeToImage() {
int useWidth = mc.displayWidth;
int useHeight = mc.displayHeight;
int left = minX - (width / 2);
int top = minY;
int right = maxX - (width / 2);
int bottom = maxY;
int k = useWidth * useHeight;
IntBuffer pixels = BufferUtils.createIntBuffer(k);
int[] intArray = new int[k];
int imgPosX = 0;
int imgPosY = 0;
for (int x = left; x < right + width; x += width) {
imgPosY = 0;
for (int y = top; y < bottom + height; y += height) {
imgPosY += useHeight;
}
imgPosX += useWidth;
}
BufferedImage bufferedimage = new BufferedImage(imgPosX, imgPosY, 1);
imgPosX = 0;
imgPosY = 0;
//Clear everything
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL11.glLoadIdentity();
mc.entityRenderer.setupOverlayRendering();
drawForSreenShot(0, 0);
//Start Creating the Image
for (int x = left; x < right + width; x += width) {
imgPosY = 0;
for (int y = top; y < bottom + height; y += height) {
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
mc.entityRenderer.setupOverlayRendering();
drawForSreenShot(y, x);
pixels.clear();
GL11.glReadPixels(0, 0, useWidth, useHeight, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixels);
pixels.get(intArray);
RequestMonitorPopup.mirror(intArray, useWidth, useHeight);
bufferedimage.setRGB(imgPosX, imgPosY, Math.min(useWidth, bufferedimage.getWidth() - imgPosX), Math.min(useHeight, bufferedimage.getHeight() - imgPosY), intArray, 0, useWidth);
imgPosY += useHeight;
}
imgPosX += useWidth;
}
saveImage(bufferedimage);
}
Aggregations