@Override public void loadAsync (AssetManager manager, String fileName, FileHandle file, PixmapParameter parameter) { pixmap = null; pixmap = new Pixmap(file); }
@Override public void loadAsync (AssetManager manager, String fileName, FileHandle file, PixmapParameter parameter) { pixmap = null; pixmap = new Pixmap(file); }
/** Construct a Cubemap with {@link Pixmap}s for each side of the specified size. */ public FacedCubemapData (int width, int height, int depth, Format format) { this(new PixmapTextureData(new Pixmap(depth, height, format), null, false, true), new PixmapTextureData(new Pixmap(depth, height, format), null, false, true), new PixmapTextureData(new Pixmap(width, depth, format), null, false, true), new PixmapTextureData(new Pixmap(width, depth, format), null, false, true), new PixmapTextureData(new Pixmap(width, height, format), null, false, true), new PixmapTextureData(new Pixmap(width, height, format), null, false, true)); }
/** Construct a Cubemap with {@link Pixmap}s for each side of the specified size. */ public Cubemap (int width, int height, int depth, Format format) { this(new PixmapTextureData(new Pixmap(depth, height, format), null, false, true), new PixmapTextureData(new Pixmap(depth, height, format), null, false, true), new PixmapTextureData(new Pixmap(width, depth, format), null, false, true), new PixmapTextureData(new Pixmap(width, depth, format), null, false, true), new PixmapTextureData(new Pixmap(width, height, format), null, false, true), new PixmapTextureData(new Pixmap(width, height, format), null, false, true)); }
/** Construct a Cubemap with {@link Pixmap}s for each side of the specified size. */ public FacedCubemapData (int width, int height, int depth, Format format) { this(new PixmapTextureData(new Pixmap(depth, height, format), null, false, true), new PixmapTextureData(new Pixmap(depth, height, format), null, false, true), new PixmapTextureData(new Pixmap(width, depth, format), null, false, true), new PixmapTextureData(new Pixmap(width, depth, format), null, false, true), new PixmapTextureData(new Pixmap(width, height, format), null, false, true), new PixmapTextureData(new Pixmap(width, height, format), null, false, true)); }
/** Construct a Cubemap with {@link Pixmap}s for each side of the specified size. */ public Cubemap (int width, int height, int depth, Format format) { this(new PixmapTextureData(new Pixmap(depth, height, format), null, false, true), new PixmapTextureData(new Pixmap(depth, height, format), null, false, true), new PixmapTextureData(new Pixmap(width, depth, format), null, false, true), new PixmapTextureData(new Pixmap(width, depth, format), null, false, true), new PixmapTextureData(new Pixmap(width, height, format), null, false, true), new PixmapTextureData(new Pixmap(width, height, format), null, false, true)); }
public void run () { Pixmap pixmap = new Pixmap(rawImageBytes, 0, rawImageBytes.length); texture = new Texture(pixmap); } });
public static Pixmap generatePixmap (int width, int height, int min, int max, int octaveCount) { byte[] bytes = generateHeightMap(width, height, min, max, octaveCount); Pixmap pixmap = new Pixmap(width, height, Format.RGBA8888); for (int i = 0, idx = 0; i < bytes.length; i++) { byte val = bytes[i]; pixmap.getPixels().put(idx++, val); pixmap.getPixels().put(idx++, val); pixmap.getPixels().put(idx++, val); pixmap.getPixels().put(idx++, (byte)255); } return pixmap; }
public static TextureData loadFromFile (FileHandle file, Format format, boolean useMipMaps) { if (file == null) return null; if (file.name().endsWith(".cim")) return new FileTextureData(file, PixmapIO.readCIM(file), format, useMipMaps); if (file.name().endsWith(".etc1")) return new ETC1TextureData(file, useMipMaps); if (file.name().endsWith(".ktx") || file.name().endsWith(".zktx")) return new KTXTextureData(file, useMipMaps); return new FileTextureData(file, new Pixmap(file), format, useMipMaps); }
public static TextureData loadFromFile (FileHandle file, Format format, boolean useMipMaps) { if (file == null) return null; if (file.name().endsWith(".cim")) return new FileTextureData(file, PixmapIO.readCIM(file), format, useMipMaps); if (file.name().endsWith(".etc1")) return new ETC1TextureData(file, useMipMaps); if (file.name().endsWith(".ktx") || file.name().endsWith(".zktx")) return new KTXTextureData(file, useMipMaps); return new FileTextureData(file, new Pixmap(file), format, useMipMaps); }
/** 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 void setIcon(long windowHandle, String[] imagePaths, Files.FileType imageFileType) { if (SharedLibraryLoader.isMac) return; Pixmap[] pixmaps = new Pixmap[imagePaths.length]; for (int i = 0; i < imagePaths.length; i++) { pixmaps[i] = new Pixmap(Gdx.files.getFileHandle(imagePaths[i], imageFileType)); } setIcon(windowHandle, pixmaps); for (Pixmap pixmap : pixmaps) { pixmap.dispose(); } }
static void setIcon(long windowHandle, String[] imagePaths, Files.FileType imageFileType) { if (SharedLibraryLoader.isMac) return; Pixmap[] pixmaps = new Pixmap[imagePaths.length]; for (int i = 0; i < imagePaths.length; i++) { pixmaps[i] = new Pixmap(Gdx.files.getFileHandle(imagePaths[i], imageFileType)); } setIcon(windowHandle, pixmaps); for (Pixmap pixmap : pixmaps) { pixmap.dispose(); } }
public static Pixmap getFrameBufferPixmap (int x, int y, int w, int h) { Gdx.gl.glPixelStorei(GL20.GL_PACK_ALIGNMENT, 1); final Pixmap pixmap = new Pixmap(w, h, Format.RGBA8888); ByteBuffer pixels = pixmap.getPixels(); Gdx.gl.glReadPixels(x, y, w, h, GL20.GL_RGBA, GL20.GL_UNSIGNED_BYTE, pixels); return pixmap; }
public static Pixmap getFrameBufferPixmap (int x, int y, int w, int h) { Gdx.gl.glPixelStorei(GL20.GL_PACK_ALIGNMENT, 1); final Pixmap pixmap = new Pixmap(w, h, Format.RGBA8888); ByteBuffer pixels = pixmap.getPixels(); Gdx.gl.glReadPixels(x, y, w, h, GL20.GL_RGBA, GL20.GL_UNSIGNED_BYTE, pixels); return pixmap; }
/** 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(); }
@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(); }
public void create () { batch = new SpriteBatch(); // Load a texture with premultiplied alpha FileTextureData data = new FileTextureData(Gdx.files.internal("data/premultiplied_alpha_test.png"), null, null, false); goodTexture = new Texture(data); // Load the texture again. But this time, force the GWT implementation of Pixmap to move to a Canvas representation of the image Pixmap pixmap = new Pixmap(Gdx.files.internal("data/premultiplied_alpha_test.png")); pixmap.getPixel(0, 0); FileTextureData data1 = new FileTextureData(null, pixmap, null, false); badTexture = new Texture(data1); }
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); }
@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()); }