/** 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(); }
/** 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(); }
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(); }
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); }
private void createTexture () { Pixmap pixmap = new Pixmap(256, 256, Format.RGB565); boolean useRed = true; for (int y = 0; y < 256; y += 8) { for (int x = 0; x < 256; x += 8) { pixmap.setColor(useRed ? 1 : 0, 0, useRed ? 0 : 1, 1); pixmap.fillRectangle(x, y, 8, 8); useRed = !useRed; } useRed = !useRed; } texture = new Texture(pixmap, true); texture.setFilter(TextureFilter.MipMapLinearLinear, TextureFilter.Linear); }
public void create () { Pixmap pixmap1 = new Pixmap(Gdx.files.internal("data/bobargb8888-32x32.png")); cursor1 = Gdx.graphics.newCursor(pixmap1, 16, 16); Pixmap pixmap2 = new Pixmap(32, 32, Format.RGBA8888); pixmap2.setColor(Color.RED); pixmap2.fillCircle(16, 16, 8); cursor2 = Gdx.graphics.newCursor(pixmap2, 16, 16); Pixmap pixmap3 = new Pixmap(32, 32, Format.RGBA8888); pixmap3.setColor(Color.BLUE); pixmap3.fillCircle(16, 16, 8); cursor3 = Gdx.graphics.newCursor(pixmap3, 16, 16); }
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); }
@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()); } }
@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()); }
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(); }
@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(); }
debugTextureRegion.flip(false, true); debugPixmap.setColor(Color.BLACK); debugPixmap.fill();
pixmap.setColor(1, 1, 0, 0.5f); pixmap.fill(); texture2 = new Texture(pixmap);
@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(); }
@Override public void create () { Pixmap pixmap = new Pixmap(512, 512, Format.RGBA8888); pixmap.setColor(Color.WHITE); Bresenham2 bresenham = new Bresenham2(); for (GridPoint2 point : bresenham.line(0, 0, 512, 512)) pixmap.drawPixel(point.x, point.y); for (GridPoint2 point : bresenham.line(512, 0, 0, 512)) pixmap.drawPixel(point.x, point.y); for (GridPoint2 point : bresenham.line(0, 0, 512, 256)) pixmap.drawPixel(point.x, point.y); for (GridPoint2 point : bresenham.line(512, 0, 0, 256)) pixmap.drawPixel(point.x, point.y); result = new Texture(pixmap); batch = new SpriteBatch(); }
pixmap.setColor(1, 1, 0, 0.5f); pixmap.fill(); texture2 = new Texture(pixmap);
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; } }); }
pixmap.setColor(Color.WHITE); pixmap.fill(); skin.add("white", new Texture(pixmap));