當前位置: 首頁>>代碼示例>>Java>>正文


Java TextureUtil.processPixelValues方法代碼示例

本文整理匯總了Java中net.minecraft.client.renderer.texture.TextureUtil.processPixelValues方法的典型用法代碼示例。如果您正苦於以下問題:Java TextureUtil.processPixelValues方法的具體用法?Java TextureUtil.processPixelValues怎麽用?Java TextureUtil.processPixelValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.client.renderer.texture.TextureUtil的用法示例。


在下文中一共展示了TextureUtil.processPixelValues方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getImageFromFrameBuffer

import net.minecraft.client.renderer.texture.TextureUtil; //導入方法依賴的package包/類
public BufferedImage getImageFromFrameBuffer(Framebuffer buffer, int width, int height) {
	int k = buffer.framebufferTextureWidth * buffer.framebufferTextureHeight;
	if (pixelBuffer == null || pixelBuffer.capacity() < k) {
		pixelBuffer = BufferUtils.createIntBuffer(k);
		pixelValues = new int[k];
	}
	GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
	GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
	pixelBuffer.clear();
	GlStateManager.bindTexture(buffer.framebufferTexture);
	GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer);
	pixelBuffer.get(pixelValues);
	TextureUtil.processPixelValues(pixelValues, buffer.framebufferTextureWidth, buffer.framebufferTextureHeight);
	BufferedImage bufferedimage = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
	int l = buffer.framebufferTextureHeight - buffer.framebufferHeight;
	bufferedimage.setRGB(0, 0, width, height, pixelValues, l*buffer.framebufferTextureWidth, buffer.framebufferTextureWidth);
	return bufferedimage;
}
 
開發者ID:herbix,項目名稱:renderTo,代碼行數:19,代碼來源:FrameBufferUtils.java

示例2: createScreenshot

import net.minecraft.client.renderer.texture.TextureUtil; //導入方法依賴的package包/類
public static BufferedImage createScreenshot(int width, int height, Framebuffer framebufferIn)
{
    if (OpenGlHelper.isFramebufferEnabled())
    {
        width = framebufferIn.framebufferTextureWidth;
        height = framebufferIn.framebufferTextureHeight;
    }

    int i = width * height;

    if (pixelBuffer == null || pixelBuffer.capacity() < i)
    {
        pixelBuffer = BufferUtils.createIntBuffer(i);
        pixelValues = new int[i];
    }

    GlStateManager.glPixelStorei(3333, 1);
    GlStateManager.glPixelStorei(3317, 1);
    pixelBuffer.clear();

    if (OpenGlHelper.isFramebufferEnabled())
    {
        GlStateManager.bindTexture(framebufferIn.framebufferTexture);
        GlStateManager.glGetTexImage(3553, 0, 32993, 33639, pixelBuffer);
    }
    else
    {
        GlStateManager.glReadPixels(0, 0, width, height, 32993, 33639, pixelBuffer);
    }

    pixelBuffer.get(pixelValues);
    TextureUtil.processPixelValues(pixelValues, width, height);
    BufferedImage bufferedimage = new BufferedImage(width, height, 1);
    bufferedimage.setRGB(0, 0, width, height, pixelValues, 0, width);
    return bufferedimage;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:37,代碼來源:ScreenShotHelper.java

示例3: screenshot

import net.minecraft.client.renderer.texture.TextureUtil; //導入方法依賴的package包/類
private BufferedImage screenshot() {
    Framebuffer fb = Minecraft.getMinecraft().getFramebuffer();
    Dimension mcSize = GuiDraw.displayRes();
    Dimension texSize = mcSize;

    if (OpenGlHelper.isFramebufferEnabled())
        texSize = new Dimension(fb.framebufferTextureWidth, fb.framebufferTextureHeight);

    int k = texSize.width * texSize.height;
    if (pixelBuffer == null || pixelBuffer.capacity() < k) {
        pixelBuffer = BufferUtils.createIntBuffer(k);
        pixelValues = new int[k];
    }

    GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
    GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
    pixelBuffer.clear();

    if (OpenGlHelper.isFramebufferEnabled()) {
        GlStateManager.bindTexture(fb.framebufferTexture);
        GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer);
    } else {
        GL11.glReadPixels(0, 0, texSize.width, texSize.height, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer);
    }

    pixelBuffer.get(pixelValues);
    TextureUtil.processPixelValues(pixelValues, texSize.width, texSize.height);

    BufferedImage img = new BufferedImage(mcSize.width, mcSize.height, BufferedImage.TYPE_INT_ARGB);
    if (OpenGlHelper.isFramebufferEnabled()) {
        int yOff = texSize.height - mcSize.height;
        for (int y = 0; y < mcSize.height; ++y)
            for (int x = 0; x < mcSize.width; ++x)
                img.setRGB(x, y, pixelValues[(y + yOff) * texSize.width + x]);
    } else {
        img.setRGB(0, 0, texSize.width, height, pixelValues, 0, texSize.width);
    }

    return img;
}
 
開發者ID:SneakyTactician,項目名稱:BIGB,代碼行數:41,代碼來源:GuiItemIconDumper.java

示例4: createScreenshot

import net.minecraft.client.renderer.texture.TextureUtil; //導入方法依賴的package包/類
private BufferedImage createScreenshot(int width, int height, Framebuffer frameBuffer)
{
    this.hasData = false;

    pixelBuffer.get(pixelValues);
    TextureUtil.processPixelValues(pixelValues, width, height);
    BufferedImage bufferedImage;

    if (OpenGlHelper.isFramebufferEnabled())
    {
        bufferedImage = new BufferedImage(frameBuffer.framebufferWidth, frameBuffer.framebufferHeight, 1);
        int j = frameBuffer.framebufferTextureHeight - frameBuffer.framebufferHeight;

        for (int k = j; k < frameBuffer.framebufferTextureHeight; ++k)
        {
            for (int l = 0; l < frameBuffer.framebufferWidth; ++l)
            {
                bufferedImage.setRGB(l, k - j, pixelValues[k * frameBuffer.framebufferTextureWidth + l]);
            }
        }
    }
    else
    {
        bufferedImage = new BufferedImage(width, height, 1);
        bufferedImage.setRGB(0, 0, width, height, pixelValues, 0, width);
    }

    return bufferedImage;
}
 
開發者ID:maruohon,項目名稱:multishot,代碼行數:30,代碼來源:ScreenshotSaver.java

示例5: screenshot

import net.minecraft.client.renderer.texture.TextureUtil; //導入方法依賴的package包/類
private BufferedImage screenshot() {
    Framebuffer fb = Minecraft.getMinecraft().getFramebuffer();
    Dimension mcSize = GuiDraw.getDisplayRes();
    Dimension texSize = mcSize;

    if (OpenGlHelper.isFramebufferEnabled()) {
        texSize = new Dimension(fb.framebufferTextureWidth, fb.framebufferTextureHeight);
    }

    int k = texSize.width * texSize.height;
    if (pixelBuffer == null || pixelBuffer.capacity() < k) {
        pixelBuffer = BufferUtils.createIntBuffer(k);
        pixelValues = new int[k];
    }

    GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
    GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
    pixelBuffer.clear();

    if (OpenGlHelper.isFramebufferEnabled()) {
        GlStateManager.bindTexture(fb.framebufferTexture);
        GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer);
    } else {
        GL11.glReadPixels(0, 0, texSize.width, texSize.height, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer);
    }

    pixelBuffer.get(pixelValues);
    TextureUtil.processPixelValues(pixelValues, texSize.width, texSize.height);

    BufferedImage img = new BufferedImage(mcSize.width, mcSize.height, BufferedImage.TYPE_INT_ARGB);
    if (OpenGlHelper.isFramebufferEnabled()) {
        int yOff = texSize.height - mcSize.height;
        for (int y = 0; y < mcSize.height; ++y) {
            for (int x = 0; x < mcSize.width; ++x) {
                img.setRGB(x, y, pixelValues[(y + yOff) * texSize.width + x]);
            }
        }
    } else {
        img.setRGB(0, 0, texSize.width, height, pixelValues, 0, texSize.width);
    }

    return img;
}
 
開發者ID:TheCBProject,項目名稱:NotEnoughItems,代碼行數:44,代碼來源:GuiItemIconDumper.java


注:本文中的net.minecraft.client.renderer.texture.TextureUtil.processPixelValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。