List of usage examples for com.badlogic.gdx.graphics Pixmap Pixmap
public Pixmap(byte[] encodedData, int offset, int len)
From source file:hku.fyp14017.blencode.stage.Passepartout.java
License:Open Source License
Passepartout(int screenWidth, int screenHeight, int screenViewPortWidth, int screenViewPortHeight, float virtualScreenWidth, float virtualScreenHeight) { this.virtualScreenWidth = virtualScreenWidth; this.virtualScreenHeight = virtualScreenHeight; passepartoutHeight = ((screenHeight / (screenViewPortHeight / virtualScreenHeight)) - virtualScreenHeight) / 2f;// w w w. j av a 2 s . c o m passepartoutWidth = ((screenWidth / (screenViewPortWidth / virtualScreenWidth)) - virtualScreenWidth) / 2f; Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888); pixmap.setColor(Color.BLACK); pixmap.fill(); texture = new Texture(pixmap); }
From source file:hku.fyp14017.blencode.stage.StageListener.java
License:Open Source License
private LookData createWhiteBackgroundLookData() { LookData whiteBackground = new LookData(); Pixmap whiteBackgroundPixmap = new Pixmap((int) virtualWidth, (int) virtualHeight, Format.RGBA8888); whiteBackgroundPixmap.setColor(Color.WHITE); whiteBackgroundPixmap.fill();//from w w w. j a va 2s.co m whiteBackground.setPixmap(whiteBackgroundPixmap); whiteBackground.setTextureRegion(); return whiteBackground; }
From source file:io.lonelyrobot.empires.client.screens.overlay.LoginStatusOverlay.java
License:Apache License
@Override public void build() { label = new Label("Attempting to connect to server "/* + server.getName() */ + " with username '" + this.player.getName() + "'", Assets.R2_UI_SKIN); cancel = new TextButton("Aboard connect", Assets.R2_UI_SKIN); main.debug();/*from w w w . j a v a 2 s. c o m*/ main.add(label).colspan(2).padBottom(150f); main.row(); main.add(cancel).maxWidth(150); Skin skin = new Skin(); Pixmap pixmap = new Pixmap(10, 10, Format.RGBA8888); pixmap.setColor(Color.WHITE); pixmap.fill(); skin.add("white", new Texture(pixmap)); TextureRegionDrawable textureBar = new TextureRegionDrawable( new TextureRegion(new Texture(Gdx.files.internal("barGreen_horizontalMid.png")))); ProgressBarStyle barStyle = new ProgressBarStyle(skin.newDrawable("white", Color.DARK_GRAY), textureBar); barStyle.knobBefore = barStyle.knob; bar = new ProgressBar(0, 100, 0.5f, false, barStyle); // bar.setFillParent(true); bar.setSize(400, bar.getPrefHeight()); bar.setAnimateDuration(0.75f); main.add(bar).left().minWidth(400); main.center().setY(75f); }
From source file:lib.Graphics2D.java
public void fillRect(int x, int y, int width, int height, Color color) { Pixmap pixmap = new Pixmap(width, height, Pixmap.Format.RGBA8888); pixmap.setColor(new com.badlogic.gdx.graphics.Color(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f)); pixmap.fillRectangle(0, 0, width, height); if (cuttentTex >= BUF_SISE) { textureBuf[cuttentTex % BUF_SISE].dispose(); }/*from w w w.j av a 2 s. c o m*/ textureBuf[cuttentTex % BUF_SISE] = new Texture(pixmap); pixmap.dispose(); batch.draw(textureBuf[cuttentTex % BUF_SISE], x, y, width, height); cuttentTex++; if (cuttentTex == 100) cuttentTex = BUF_SISE; //texture.dispose(); }
From source file:lib.TextureManager.java
/** * ?/*from www . j a v a2 s. c o m*/ * * @param img * @return ? */ public static Texture imageToTexture(BufferedImage img) { Pixmap px = new Pixmap(img.getWidth(), img.getHeight(), Pixmap.Format.RGBA8888); Pixmap.setBlending(Pixmap.Blending.None); px.setColor(Color.CYAN); for (int i = 0; i < img.getWidth(); i++) { for (int j = 0; j < img.getHeight(); j++) { int color = img.getRGB(i, j); // Components will be in the range of 0..255: int red = (color & 0x00ff0000) >> 16; int green = (color & 0x0000ff00) >> 8; int blue = color & 0x000000ff; int alpha = (color >> 24) & 0xff; px.setColor(red / 255.0f, green / 255.0f, blue / 255.0f, alpha / 255.0f); px.drawPixel(i, j); } } return new Texture(px); }
From source file:me.dumfing.gdxtools.GifDecoderOptimized.java
License:Open Source License
public Animation getAnimation(PlayMode playType) { int nrFrames = getFrameCount(); // if(nrFrames > 100) // {/*from ww w. j a v a2 s. c om*/ // nrFrames=100; // } advance(); Pixmap frame = getNextFrame(); int width = frame.getWidth(); int height = frame.getHeight(); int vzones = (int) Math.sqrt((double) nrFrames); int hzones = vzones; while (vzones * hzones < nrFrames) vzones++; int v, h; Pixmap target = new Pixmap(width * hzones, height * vzones, Pixmap.Format.RGBA8888); int frameCountCurrent = 0; for (h = 0; h < hzones; h++) { for (v = 0; v < vzones; v++) { if (frameCountCurrent < nrFrames) { frameCountCurrent++; advance(); frame = getNextFrame(); target.drawPixmap(frame, h * width, v * height); int pixelSize = (int) (frame.getWidth() * 0.025f); target.setColor(Color.BLACK); int xPos, yPos; xPos = h * width; yPos = v * height; // target.fillRectangle(xPos, yPos, frame.getWidth(), pixelSize); // target.fillRectangle(xPos + frame.getWidth()-pixelSize, yPos, pixelSize, frame.getHeight()); // target.fillRectangle(xPos, yPos + frame.getHeight()-pixelSize, frame.getWidth(), pixelSize); // target.fillRectangle(xPos, yPos,pixelSize, frame.getHeight()); } } } Texture texture = new Texture(target); target.dispose(); target = null; Array<TextureRegion> texReg = new Array<TextureRegion>(); TextureRegion tr = new TextureRegion(texture); for (h = 0; h < hzones; h++) { for (v = 0; v < vzones; v++) { int frameID = v + h * vzones; if (frameID < nrFrames) { tr = new TextureRegion(texture, h * width, v * height, width, height); texReg.add(tr); } } } float frameDuration = (float) getDelay(0); frameDuration /= 500; // convert milliseconds into seconds Animation result = new Animation(frameDuration, texReg, playType); texReg.clear(); frames.clear(); prefix = null; suffix = null; pixelStack = null; mainPixels = null; mainScratch = null; copyScratch = null; return result; //return animation object }
From source file:mobi.shad.s3lib.gfx.effect.Copper.java
License:Apache License
/** * Initialize class//from w w w . ja v a2s. c om */ @Override public final void init() { Color[] copperCollorsInistdeLoc = new Color[count + 10]; Color[] copperCollorsOutsideLoc = new Color[count + 10]; Color[] copperCollorsInistde2Loc = new Color[count + 10]; Color[] copperCollorsOutside2Loc = new Color[count + 10]; for (int i = 0; i < count + 10; ++i) { copperCollorsInistdeLoc[i] = new Color(colorOutSide); copperCollorsOutsideLoc[i] = new Color(colorInSide); copperCollorsInistde2Loc[i] = new Color(colorInSide2); copperCollorsOutside2Loc[i] = new Color(colorOutSide2); } copperCollorsOutside = copperCollorsInistdeLoc; copperCollorsInistde = copperCollorsOutsideLoc; copperCollorsInistde2 = copperCollorsInistde2Loc; copperCollorsOutside2 = copperCollorsOutside2Loc; if (pixmap == null) { pixmap = new Pixmap(textureSizeX, textureSizeY, Format.RGBA8888); } if (copperTexture == null) { copperTexture = new Texture(pixmap); copperTexture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); } positionBuffer = new Float[count * 4]; coordsBuffer = new Float[count * 4]; int v = 0; for (int i = 0; i < count; ++i) { int offset = i * 4; calculateBobsTexture2D(texturePerRow, texturePerColumn, i, coordsBuffer, offset); } // // Generate texture // for (int i = 0; i < count; ++i) { calculateCopperBarTexture2D(copperCollorsOutside[i], copperCollorsInistde[i], copperCollorsInistde2[i], copperCollorsOutside2[i], texturePerRow, texturePerColumn, i, pixmap, textureSizeX, textureSizeY); } copperTexture.draw(pixmap, 0, 0); }
From source file:mobi.shad.s3lib.gfx.effect.Plasma.java
License:Apache License
/** * Initialize class/*from w ww. ja v a 2 s . co m*/ */ @Override public final void init() { countLayer = 0; if (layer1) { countLayer++; } if (layer2) { countLayer++; } if (layer3) { countLayer++; } if (layer4) { countLayer++; } if (countLayer > 0) { stepLayer = 1.0f / (float) countLayer; } if (pixmap == null) { pixmap = new Pixmap(sizeX, sizeY, Format.RGBA8888); } if (texture == null) { texture = new Texture(pixmap); texture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); } }
From source file:mobi.shad.s3lib.gfx.effect.SimpleShader.java
License:Apache License
/** * */// www . j a v a 2 s. co m @Override public final void init() { if (pixmap == null) { pixmap = new Pixmap(S3Constans.proceduralTextureSize, 1, Pixmap.Format.RGBA8888); pixmap.setColor(1, 1, 1, 1); pixmap.fill(); texture = new Texture(pixmap); } if (shader == null) { shader = new mobi.shad.s3lib.gfx.g3d.shaders.SimpleShader(); } }
From source file:mobi.shad.s3lib.gfx.effect.TopBorder.java
License:Apache License
/** * *///from ww w . j a v a 2 s .c o m @Override public final void init() { if (pixmap == null) { pixmap = new Pixmap(S3Constans.proceduralTextureSize, 1, Pixmap.Format.RGBA8888); pixmap.setColor(1, 1, 1, 1); pixmap.fill(); texture = new Texture(pixmap); } }