当前位置: 首页>>代码示例>>Java>>正文


Java Format类代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.Pixmap.Format的典型用法代码示例。如果您正苦于以下问题:Java Format类的具体用法?Java Format怎么用?Java Format使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Format类属于com.badlogic.gdx.graphics.Pixmap包,在下文中一共展示了Format类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import com.badlogic.gdx.graphics.Pixmap.Format; //导入依赖的package包/类
@Override
public Texture create(int width, int height) {
	
	Pixmap map = new Pixmap(width, height, Format.RGBA8888);
	
	Color skinColor = getSkinColor();
	Color hairColor = getHairColor();
	Color shoeColor = getShoeColor();
	Color trousesColor = getTrousesColor();
	Color shirtColor = getShirtColor();
	
	generate(map, skinColor, hairColor, shoeColor, trousesColor, shirtColor);

	Texture texture = new Texture(map);
	map.dispose();
	
	return texture;
}
 
开发者ID:bitbrain,项目名称:pretender,代码行数:19,代码来源:VillagerTextureGenerator.java

示例2: load

import com.badlogic.gdx.graphics.Pixmap.Format; //导入依赖的package包/类
@Override
public void load() {
	
	if(isLoaded())
		return;
	
	bird = loadTextureRegion("angrybirds/sprites/bird.png");
	pig = loadTexture("angrybirds/sprites/pig.png");
	sling = loadTextureRegion("angrybirds/sprites/sling.png");
	block = loadTexture("angrybirds/sprites/woods/block.gif");
	longwood = loadTexture("angrybirds/sprites/woods/long.gif");
	smallblock = loadTexture("angrybirds/sprites/woods/small.gif");
	tallwood = loadTexture("angrybirds/sprites/woods/tall.gif");
	background = loadTexture("bg.jpg", Format.RGB565, true);
	font = loadBitmapFont("default.fnt", "default.png");
	
	damaged_block = loadTexture("angrybirds/sprites/damaged_woods/block.gif");
	damaged_longwood = loadTexture("angrybirds/sprites/damaged_woods/long.gif");
	damaged_smallblock = loadTexture("angrybirds/sprites/damaged_woods/small.gif");
	damaged_tallwood = loadTexture("angrybirds/sprites/damaged_woods/tall.gif");
	
	setLoaded(true);
}
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:24,代码来源:Asset.java

示例3: createHighlightingGraphic

import com.badlogic.gdx.graphics.Pixmap.Format; //导入依赖的package包/类
private Texture createHighlightingGraphic(TextureRegion textureRegion)
{
	TextureData textureData = textureRegion.getTexture().getTextureData();
	textureData.prepare();
	Pixmap sourcePixmap = textureData.consumePixmap();
	Pixmap destinationPixmap = new Pixmap(textureRegion.getRegionWidth(), textureRegion.getRegionHeight(), Format.RGBA8888);
	Color color = new Color();

	for (int x = 0; x < textureRegion.getRegionWidth(); x++)
	{
		for (int y = 0; y < textureRegion.getRegionHeight(); y++)
		{
			int colorInt = sourcePixmap.getPixel(textureRegion.getRegionX() + x, textureRegion.getRegionY() + y);
			Color.rgba8888ToColor(color, colorInt);
			destinationPixmap.setColor(1.0f, 1f, 1.0f, 1);
			if (color.a > 0.004f)
				destinationPixmap.drawPixel(x, y);
		}
	}
	Texture result = new Texture(destinationPixmap);
	textureData.disposePixmap();
	destinationPixmap.dispose();
	return result;
}
 
开发者ID:MMORPG-Prototype,项目名称:MMORPG_Prototype,代码行数:25,代码来源:GameObjectHighlightGraphic.java

示例4: LightMap

import com.badlogic.gdx.graphics.Pixmap.Format; //导入依赖的package包/类
public LightMap(RayHandler rayHandler, int fboWidth, int fboHeight) {
	this.rayHandler = rayHandler;

	if (fboWidth <= 0)
		fboWidth = 1;
	if (fboHeight <= 0)
		fboHeight = 1;
	frameBuffer = new FrameBuffer(Format.RGBA8888, fboWidth,
			fboHeight, false);
	pingPongBuffer = new FrameBuffer(Format.RGBA8888, fboWidth,
			fboHeight, false);

	lightMapMesh = createLightMapMesh();

	shadowShader = ShadowShader.createShadowShader();
	diffuseShader = DiffuseShader.createShadowShader();

	withoutShadowShader = WithoutShadowShader.createShadowShader();

	blurShader = Gaussian.createBlurShader(fboWidth, fboHeight);

}
 
开发者ID:bitbrain,项目名称:rbcgj-2016,代码行数:23,代码来源:LightMap.java

示例5: Renderer

import com.badlogic.gdx.graphics.Pixmap.Format; //导入依赖的package包/类
public Renderer () {
	try {
		lights = new Environment();
		lights.add(new DirectionalLight().set(Color.WHITE, new Vector3(-1, -0.5f, 0).nor()));

		spriteBatch = new SpriteBatch();
		modelBatch = new ModelBatch();

		backgroundTexture = new Texture(Gdx.files.internal("data/planet.jpg"), Format.RGB565, true);
		backgroundTexture.setFilter(TextureFilter.MipMap, TextureFilter.Linear);

		font = new BitmapFont(Gdx.files.internal("data/font10.fnt"), Gdx.files.internal("data/font10.png"), false);

		camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	} catch (Exception ex) {
		ex.printStackTrace();
	}
}
 
开发者ID:Motsai,项目名称:neblina-libgdx3d,代码行数:19,代码来源:Renderer.java

示例6: show

import com.badlogic.gdx.graphics.Pixmap.Format; //导入依赖的package包/类
@Override
public void show () {
	font = new BitmapFont(Gdx.files.internal("fonts/font.fnt"));
	cache = font.getCache();

	if (Gdx.app.getType() == ApplicationType.Android)
		font.getData().setScale(2);
	polygonBatch = new PolygonSpriteBatch();
	camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

	Pixmap pixMap = new Pixmap(1, 1, Format.RGB565);
	pixMap.setColor(Color.WHITE);
	pixMap.fill();
	emptyTexture = new Texture(pixMap);
	pixMap.dispose();
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:17,代码来源:RemoteEditLoadingScreen.java

示例7: resize

import com.badlogic.gdx.graphics.Pixmap.Format; //导入依赖的package包/类
/** Resizes internal RavCamera for framebuffer use, call this in you ApplicationListener's resize.
 * 
 * @param width - new screen width
 * @param height - new screen height
 * @param resizeFramebuffers - whether all of the framebuffers should be recreated to match new screen size */
public void resize (int width, int height, boolean resizeFramebuffers) {
	// ?????
	if (resizeFramebuffers) {
		Keys<String> keys = frameBuffers.keys();
		while (keys.hasNext) {
			String key = keys.next();
			FrameBuffer fb = frameBuffers.get(key);
			int oldWidth = fb.getWidth();
			int oldHeight = fb.getHeight();
			Format format = fb.getColorBufferTexture().getTextureData().getFormat();
			fb.dispose();
			frameBuffers.put(key, null);
			float factorX = 1f * width / screenCamera.viewportWidth;
			float factorY = 1f * height / screenCamera.viewportHeight;
			createFB(key, format, (int)(factorX * oldWidth), (int)(factorY * oldHeight));
			// System.out.println("Recreated FB '" + key + "' from " +
			// oldWidth + "x" + oldHeight + " to " +
			// frameBuffers.get(key).getWidth() + "x" +
			// frameBuffers.get(key).getHeight());
		}
	}
	screenCamera = new OrthographicCamera(width, height);
	createScreenQuad();
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:30,代码来源:ShaderManager.java

示例8: PowerLUT

import com.badlogic.gdx.graphics.Pixmap.Format; //导入依赖的package包/类
/** W power will be in luminance, and H power will be in alpha**/
public PowerLUT(float powerW, float intensityW, float powerH, float intensityH, int width, int height){

	Pixmap pixmap = new Pixmap(width, height, Format.RGBA8888);
	for (int i=0; i<width; i++){
		float valueW = (float)Math.pow((float)i/width, powerW) * intensityW;
           for (int j = 0; j < height; j++) {
               float valueH = (float)Math.pow((float)j/height, powerH) * intensityH;
               pixmap.setColor(valueW, valueH, 1.0f, 1.0f);
               pixmap.drawPixel(i, j);
           }
	}
	
	PixmapTextureData data = new PixmapTextureData(pixmap, Format.RGBA8888, false, false, true);
	
	texture = new Texture(data);
	texture.setWrap(TextureWrap.ClampToEdge, TextureWrap.ClampToEdge);
	texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
}
 
开发者ID:CypherCove,项目名称:DoubleHelix,代码行数:20,代码来源:PowerLUT.java

示例9: toBufferedImageType

import com.badlogic.gdx.graphics.Pixmap.Format; //导入依赖的package包/类
/**
 * Returns the equivalent buffered image type ({@link BufferedImage#getType()}) for the given pixmap
 * format.
 */
public static int toBufferedImageType(Format format) {
    switch (format) {
    case Intensity:
    case Alpha:
        return BufferedImage.TYPE_BYTE_GRAY;
    case RGB565:
    case RGB888:
        return BufferedImage.TYPE_3BYTE_BGR;
    case LuminanceAlpha:
    case RGBA4444:
    case RGBA8888:
        return BufferedImage.TYPE_INT_ARGB;
    default:
        throw new IllegalArgumentException("Unsupported format: " + format);
    }
}
 
开发者ID:anonl,项目名称:nvlist,代码行数:21,代码来源:BufferedImageHelper.java

示例10: loadAsync

import com.badlogic.gdx.graphics.Pixmap.Format; //导入依赖的package包/类
@Override
public void loadAsync(AssetManager manager, String fileName, FileHandle file,
        TextureParameter parameter) {

    if (parameter == null || parameter.textureData == null) {
        Format format = null;
        boolean genMipMaps = false;
        info.texture = null;

        if (parameter != null) {
            format = parameter.format;
            genMipMaps = parameter.genMipMaps;
            info.texture = parameter.texture;
        }

        info.data = loadTexData(file, format, genMipMaps);
    } else {
        info.data = parameter.textureData;
        info.texture = parameter.texture;
    }
    if (!info.data.isPrepared()) {
        info.data.prepare();
    }
}
 
开发者ID:anonl,项目名称:nvlist,代码行数:25,代码来源:PremultTextureLoader.java

示例11: flipVertical

import com.badlogic.gdx.graphics.Pixmap.Format; //导入依赖的package包/类
/**
 * @param pixels A Pixmap in {@link Format#RGBA8888}.
 */
public static void flipVertical(Pixmap pixels) {
    Checks.checkArgument(pixels.getFormat() == Format.RGBA8888,
            "Pixmap with unsupported format: " + pixels.getFormat());

    int bytesPerRow = pixels.getWidth() * 4; // RGBA8888
    int h = pixels.getHeight();
    byte[] lineBuffer0 = new byte[bytesPerRow];
    byte[] lineBuffer1 = new byte[bytesPerRow];
    ByteBuffer pixelsBuffer = pixels.getPixels();
    for (int y = 0; y < h / 2; y++) {
        int y0 = y * bytesPerRow;
        int y1 = (h - 1 - y) * bytesPerRow;

        // Swap pixels in rows
        pixelsBuffer.position(y0);
        pixelsBuffer.get(lineBuffer0);
        pixelsBuffer.position(y1);
        pixelsBuffer.get(lineBuffer1);
        pixelsBuffer.position(y1);
        pixelsBuffer.put(lineBuffer0);
        pixelsBuffer.position(y0);
        pixelsBuffer.put(lineBuffer1);
    }
    pixelsBuffer.rewind();
}
 
开发者ID:anonl,项目名称:nvlist,代码行数:29,代码来源:PixmapUtil.java

示例12: convert

import com.badlogic.gdx.graphics.Pixmap.Format; //导入依赖的package包/类
/**
 * Converts the given pixmap to the specified target color format. If the source pixmap is already in the
 * correct format, the original pixmap is returned unmodified.
 */
public static Pixmap convert(Pixmap source, Format targetFormat, boolean disposeSource) {
    if (source.getFormat() == targetFormat) {
        return source; // Already the correct format
    }

    int iw = source.getWidth();
    int ih = source.getHeight();
    Pixmap result = newUninitializedPixmap(iw, ih, targetFormat);
    copySubRect(source, Rect.of(0, 0, iw, ih), result, Rect.of(0, 0, iw, ih), Filter.NearestNeighbour);

    if (disposeSource) {
        source.dispose();
    }
    return result;
}
 
开发者ID:anonl,项目名称:nvlist,代码行数:20,代码来源:PixmapUtil.java

示例13: copy

import com.badlogic.gdx.graphics.Pixmap.Format; //导入依赖的package包/类
/**
 * Copies the contents of {@code src} to {@code dst}.
 *
 * @throws IllegalArgumentException If the pixmaps are different sizes or different formats.
 */
public static void copy(Pixmap src, Pixmap dst) {
    Format srcFmt = src.getFormat();
    Format dstFmt = dst.getFormat();
    Checks.checkArgument(srcFmt == dstFmt, "Formats not equal: src=" + srcFmt + ", dst=" + dstFmt);

    int srcW = src.getWidth();
    int dstW = dst.getWidth();
    Checks.checkArgument(srcW == dstW, "Widths not equal: src.w=" + srcW + ", dst.w=" + dstW);

    int srcH = src.getHeight();
    int dstH = src.getHeight();
    Checks.checkArgument(srcH == dstH, "Heights not equal: src.h=" + srcH + ", dst.h=" + dstH);

    ByteBuffer srcPixels = src.getPixels();
    ByteBuffer dstPixels = dst.getPixels();
    BufferUtils.copy(srcPixels, dstPixels, srcPixels.limit());
    srcPixels.clear();
    dstPixels.clear();
}
 
开发者ID:anonl,项目名称:nvlist,代码行数:25,代码来源:PixmapUtil.java

示例14: testFlipVertical

import com.badlogic.gdx.graphics.Pixmap.Format; //导入依赖的package包/类
@Test
public void testFlipVertical() {
    Pixmap flip = new Pixmap(2, 3, Format.RGBA8888);
    flip.drawPixel(0, 0, 0xAABBCCDD);
    flip.drawPixel(1, 2, 0x11223344);
    PixmapUtil.flipVertical(flip);

    Pixmap expected = new Pixmap(2, 3, Format.RGBA8888);
    expected.drawPixel(0, 2, 0xAABBCCDD);
    expected.drawPixel(1, 0, 0x11223344);

    pixmapEquals.assertEquals(expected, flip);

    flip.dispose();
    expected.dispose();
}
 
开发者ID:anonl,项目名称:nvlist,代码行数:17,代码来源:PixmapUtilTest.java

示例15: generatePlanet

import com.badlogic.gdx.graphics.Pixmap.Format; //导入依赖的package包/类
public static Texture generatePlanet(int[][] tileMap, ArrayList<Tile> tiles) {
	int s = tileMap.length;
	Pixmap pixmap = new Pixmap(s, s, Format.RGBA4444);
	
	// draw circle for planet
	pixmap.setColor(1, 1, 1, 1);
	pixmap.fillCircle(s/2,s/2,s/2-1);
	
	//draw noise
	for (int y = 0; y < s; ++y) {
		for (int x = 0; x < s; ++x) {
			//only draw on circle
			if (pixmap.getPixel(x, y) != 0) {					
				pixmap.setColor(tiles.get(tileMap[x][y]).getColor());
				pixmap.drawPixel(x, y);
			}				
		}
	}

	Texture t = new Texture(pixmap);
	pixmap.dispose();
	return t;
}
 
开发者ID:0XDE57,项目名称:SpaceProject,代码行数:24,代码来源:TextureFactory.java


注:本文中的com.badlogic.gdx.graphics.Pixmap.Format类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。