/** Creates a new page filled with the color provided by the {@link PixmapPacker#getTransparentColor()} */ public Page (PixmapPacker packer) { image = new Pixmap(packer.pageWidth, packer.pageHeight, packer.pageFormat); final Color transparentColor = packer.getTransparentColor(); this.image.setColor(transparentColor); this.image.fill(); }
static TextureRegion newPatchPix (int patchSize, int pixmapSize) { final int pixmapDim = MathUtils.nextPowerOfTwo(pixmapSize); Pixmap p = new Pixmap(pixmapDim, pixmapDim, Pixmap.Format.RGBA8888); p.setColor(1, 1, 1, 0); p.fill(); for (int x = 0; x < pixmapSize; x += patchSize) { for (int y = 0; y < pixmapSize; y += patchSize) { p.setColor(x / (float)pixmapSize, y / (float)pixmapSize, 1.0f, 1.0f); p.fillRectangle(x, y, patchSize, patchSize); } } return new TextureRegion(new Texture(p), pixmapSize, pixmapSize); }
/** Creates a new Pixmap instance with the given width, height and format. * @param width the width in pixels * @param height the height in pixels * @param format the {@link Format} */ public Pixmap (int width, int height, Format format) { pixmap = new Gdx2DPixmap(width, height, Format.toGdx2DPixmapFormat(format)); setColor(0, 0, 0, 0); fill(); }
static NinePatch newMidlessPatch () { final int patchSize = 8; final int fullPatchHeight = patchSize * 2; final int fullPatchWidth = patchSize * 3; final int pixmapDim = MathUtils.nextPowerOfTwo(Math.max(fullPatchWidth, fullPatchHeight)); Pixmap testPatch = new Pixmap(pixmapDim, pixmapDim, Pixmap.Format.RGBA8888); testPatch.setColor(1, 1, 1, 0); testPatch.fill(); for (int x = 0; x < fullPatchWidth; x += patchSize) { for (int y = 0; y < fullPatchHeight; y += patchSize) { testPatch.setColor(x / (float)fullPatchWidth, y / (float)fullPatchHeight, 1.0f, 1.0f); testPatch.fillRectangle(x, y, patchSize, patchSize); } } return new NinePatch(new TextureRegion(new Texture(testPatch), fullPatchWidth, fullPatchHeight), patchSize, patchSize, patchSize, patchSize); }
/** Creates a new page filled with the color provided by the {@link PixmapPacker#getTransparentColor()} */ public Page (PixmapPacker packer) { image = new Pixmap(packer.pageWidth, packer.pageHeight, packer.pageFormat); final Color transparentColor = packer.getTransparentColor(); this.image.setColor(transparentColor); this.image.fill(); }
/** Creates a new Pixmap instance with the given width, height and format. * @param width the width in pixels * @param height the height in pixels * @param format the {@link Format} */ public Pixmap (int width, int height, Format format) { pixmap = new Gdx2DPixmap(width, height, Format.toGdx2DPixmapFormat(format)); setColor(0, 0, 0, 0); fill(); }
@Override public void create () { spriteBatch = new SpriteBatch(); texture = new Texture(Gdx.files.internal("data/badlogicsmall.jpg")); Pixmap pixmap = new Pixmap(32, 32, Format.RGB565); pixmap.setColor(1, 1, 0, 0.7f); pixmap.fill(); texture2 = new Texture(pixmap); pixmap.dispose(); for (int i = 0; i < coords.length; i += 2) { coords[i] = (int)(Math.random() * Gdx.graphics.getWidth()); coords[i + 1] = (int)(Math.random() * Gdx.graphics.getHeight()); coords2[i] = (int)(Math.random() * Gdx.graphics.getWidth()); coords2[i + 1] = (int)(Math.random() * Gdx.graphics.getHeight()); } }
PolygonSprite poly; PolygonSpriteBatch polyBatch = new PolygonSpriteBatch(); // To assign at the beginning Texture textureSolid; // Creating the color filling (but textures would work the same way) Pixmap pix = new Pixmap(1, 1, Pixmap.Format.RGBA8888); pix.setColor(0xDEADBEFF); // DE is red, AD is green and BE is blue. pix.fill(); textureSolid = new Texture(pix); PolygonRegion polyReg = new PolygonRegion(new TextureRegion(textureSolid), new float[] { // Four vertices 0, 0, // Vertex 0 3--2 100, 0, // Vertex 1 | /| 100, 100, // Vertex 2 |/ | 0, 100 // Vertex 3 0--1 }, new short[] { 0, 1, 2, // Two triangles using vertex indices. 0, 2, 3 // Take care of the counter-clockwise direction. }); poly = new PolygonSprite(polyReg); poly.setOrigin(a, b); polyBatch = new PolygonSpriteBatch();
@Override public void create () { Pixmap pixmap = new Pixmap(256, 256, Format.RGBA8888); pixmap.setColor(1, 0, 0, 1); pixmap.fill(); texture = new Texture(pixmap, false); texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); batch = new SpriteBatch(); pixmap.dispose(); }
debugPixmap.fill();
private void createTexture () { Pixmap pixmap = new Pixmap(256, 256, Format.RGBA8888); pixmap.setColor(1, 1, 1, 1); pixmap.fill(); pixmap.setColor(0, 0, 0, 1); pixmap.drawLine(0, 0, 256, 256); pixmap.drawLine(256, 0, 0, 256); texture = new Texture(pixmap); pixmap.dispose(); pixmap = new Pixmap(256, 256, Format.RGBA8888); pixmap.setColor(1, 1, 1, 1); pixmap.fill(); pixmap.setColor(0, 0, 0, 1); pixmap.drawLine(128, 0, 128, 256); texture2 = new Texture(pixmap); pixmap.dispose(); }
pixmap.fill(); texture2 = new Texture(pixmap); pixmap.dispose();
@Override public void create () { Pixmap pixmap = new Pixmap(16, 16, Pixmap.Format.RGBA8888); pixmap.setColor(Color.BLUE); pixmap.fill(); pixmap.setColor(Color.RED); pixmap.drawLine(0, 0, 15, 15); pixmap.drawLine(0, 15, 15, 0); tex = new Texture(pixmap); batch = new SpriteBatch(); cam = new OrthographicCamera(); cam.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); }
pixmap.fill(); texture2 = new Texture(pixmap); pixmap.dispose();
public void create () { font = new BitmapFont(); font.setColor(0, 0, 0, 1); Pixmap pixmap = new Pixmap(16, 16, Format.RGBA8888); pixmap.setColor(1, 1, 1, 1); pixmap.fill(); texture = new Texture(pixmap); batch = new SpriteBatch(); camera = new OrthographicCamera(); camera.position.set(100, 100, 0); camera.update(); viewports = ViewportTest1.getViewports(camera); viewport = viewports.first(); names = ViewportTest1.getViewportNames(); name = names.first(); Gdx.input.setInputProcessor(new InputAdapter() { public boolean keyDown (int keycode) { if (keycode == Input.Keys.SPACE) { int index = (viewports.indexOf(viewport, true) + 1) % viewports.size; name = names.get(index); viewport = viewports.get(index); resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); } return false; } }); }
mainPixmap.fill(); ByteBuffer buf = mainBitmap.getBuffer(); int whiteIntBits = Color.WHITE.toIntBits();
mainPixmap.fill(); ByteBuffer buf = mainBitmap.getBuffer(); int whiteIntBits = Color.WHITE.toIntBits();
@Override public void create () { font = new BitmapFont(); camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); controller = new OrthoCamController(camera); Gdx.input.setInputProcessor(controller); Pixmap pixmap = new Pixmap(32, 32, Format.RGB565); pixmap.setColor(1, 0, 0, 1); pixmap.fill(); pixmap.setColor(0, 1, 0, 1); pixmap.drawLine(0, 0, 32, 32); pixmap.drawLine(0, 32, 32, 0); ETC1Data encodedImage = ETC1.encodeImagePKM(pixmap); pixmap.dispose(); pixmap = ETC1.decodeImage(encodedImage, Format.RGB565); encodedImage.dispose(); img1 = new Texture(pixmap); img2 = new Texture("data/test.etc1"); batch = new SpriteBatch(); pixmap.dispose(); }
pixmap.fill(); skin.add("white", new Texture(pixmap));
pixmap.fill(); uiSkin.add("white", new Texture(pixmap));