当前位置: 首页>>代码示例>>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;未经允许,请勿转载。