debugTexture.draw(debugPixmap, 0, 0); return debugTextureRegion;
texture = new Texture(32, 32, Format.RGB565); texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); texture.draw(pixmap, 0, 0); pixmap.dispose();
public void create () { // Create an empty dynamic pixmap pixmap = new Pixmap(800, 480, Pixmap.Format.RGBA8888); // Pixmap.Format.RGBA8888); // Create a texture to contain the pixmap texture = new Texture(1024, 1024, Pixmap.Format.RGBA8888); // Pixmap.Format.RGBA8888); texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Linear); texture.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.ClampToEdge); pixmap.setColor(1.0f, 0.0f, 0.0f, 1.0f); // Red pixmap.drawLine(0, 0, 100, 100); pixmap.setColor(0.0f, 0.0f, 1.0f, 1.0f); // Blue pixmap.drawLine(100, 100, 200, 0); pixmap.setColor(0.0f, 1.0f, 0.0f, 1.0f); // Green pixmap.drawLine(100, 0, 100, 100); pixmap.setColor(1.0f, 1.0f, 1.0f, 1.0f); // White pixmap.drawCircle(400, 300, 100); // Blit the composited overlay to a texture texture.draw(pixmap, 0, 0); region = new TextureRegion(texture, 0, 0, 800, 480); batch = new SpriteBatch(); Pixmap pixmap = new Pixmap(512, 1024, Pixmap.Format.RGBA8888); for (int y = 0; y < pixmap.getHeight(); y++) { // 1024 for (int x = 0; x < pixmap.getWidth(); x++) { // 512 pixmap.getPixel(x, y); } } pixmap.dispose(); }
Pixmap imgA = new Pixmap(Gdx.files.internal("mypng")); Texture texture = new Texture(200, 200, Pixmap.Format.RGBA8888); texture.draw(imgA, 0, 0);
Pixmap imgA = new Pixmap(Gdx.files.internal(back)); Pixmap imgB = new Pixmap(Gdx.files.internal(overlay)); Texture dynamicTexture = new Texture(200, 200, Pixmap.Format.RGBA8888); imgA.draw(imgB, 27, 27); dynamicTexture.draw(imgA, 0, 0);
public void updateTexture() { getTexture().draw(getPixmap(), 0, 0); }
private void drawMeter () { pixels.setColor(0.25f, 0.25f, 0.25f, color.a); pixels.fill(); float range = maxValue - minValue; float ratio = Math.abs(value) / range; ratio = AMath.clamp(ratio, 0, 1); pixels.setColor(color); pixels.fillRectangle(1, 1, (int)(width * ratio) - 2, height - 2); texture.draw(pixels, 0, 0); } }
TextureRegion draw(Pixmap map){ int w = map.getWidth(); int h = map.getHeight(); if (currX + w + PADDING >= WIDTH) { currX = 0; currY += lineHeight + PADDING; lineHeight = 0; if (currY + h + PADDING >= HEIGHT) return null; } int x = currX, y = currY; currX += w + PADDING; lineHeight = lineHeight > h ? lineHeight : h; if (currY + h + PADDING >= HEIGHT) return null; tex.draw(map, x, y); TextureRegion reg = new TextureRegion(tex, x, y, w, h); return reg; }
public class PixmapHelper { static Pixmap fullGraphics ; static Pixmap miniObject; public static void Initialize() { fullGraphics =AssetLoader.GetPixmap(Settings.TEX_MAP_OBJECTS); miniObject=new Pixmap(8,8, Pixmap.Format.RGBA8888); } static void Draw(TextureRegion textureRegion,Texture dstTexture,int dstX,int dstY) { miniObject.drawPixmap(fullGraphics, 0,0, textureRegion.getRegionX(),textureRegion.getRegionY(), textureRegion.getRegionWidth(),textureRegion.getRegionHeight()); dstTexture.draw(miniObject,dstX,dstY); } }
/** Computes random field for the ssao shader */ private void createRandomField (int width, int height, Format format) { randomField = new Texture(width, height, format); randomField.setFilter(TextureFilter.Nearest, TextureFilter.Nearest); randomField.setWrap(TextureWrap.Repeat, TextureWrap.Repeat); Pixmap pixels = new Pixmap(width, height, format); ByteBuffer bytes = pixels.getPixels(); int wrote = 0; while (wrote < width * height * 4) { float x = (MathUtils.random() - 0.5f) * 2.0f; float y = (MathUtils.random() - 0.5f) * 2.0f; float z = (MathUtils.random() - 0.5f) * 2.0f; float l = (float)Math.sqrt(x * x + y * y + z * z); if (l <= 1.0f && l > 0.1f) { x = (x + 1.0f) * 0.5f; y = (y + 1.0f) * 0.5f; z = (z + 1.0f) * 0.5f; bytes.put((byte)(x * 255f)); bytes.put((byte)(y * 255f)); bytes.put((byte)(z * 255f)); bytes.put((byte)255); wrote += 4; } } bytes.flip(); randomField.draw(pixels, 0, 0); pixels.dispose(); }
background.draw(batch); exit.draw(batch); play.draw(batch);
texture.draw(pixels, 0, 0);
temp.fill(); block = new Texture(1, 1, Pixmap.Format.RGBA8888); block.draw(temp, 0, 0); temp.dispose(); style = new Label.LabelStyle(bmpFont, null);
temp.fill(); block = new Texture(1, 1, Pixmap.Format.RGBA8888); block.draw(temp, 0, 0); temp.dispose(); if(msdf)