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


Java Format.RGBA4444属性代码示例

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


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

示例1: generatePlanet

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,代码行数:23,代码来源:TextureFactory.java

示例2: generateNoise

public static Texture generateNoise(long seed, int size, double featureSize) {
	OpenSimplexNoise noise = new OpenSimplexNoise(seed);
	
	Pixmap pixmap = new Pixmap(size, size, Format.RGBA4444);
	
	//add layer of noise
	for (int y = 0; y < pixmap.getHeight(); ++y) {
		for (int x = 0; x < pixmap.getWidth(); ++x) {
			
			double nx = x / featureSize, ny = y / featureSize;
			double i = noise.eval(nx, ny, 0);
			i = (i * 0.5) + 0.5; // convert from range [-1:1] to [0:1]

			pixmap.setColor(new Color((float) i, (float) i, (float) i, 1));
			pixmap.drawPixel(x, y);

		}
	}
	

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

示例3: create

@Override
public void create () {
	FileHandle file = Gdx.files.internal("data/bobargb8888-32x32.png");
	nonMipMapped[0] = new Texture(file, Format.Alpha, false);
	nonMipMapped[1] = new Texture(file, Format.LuminanceAlpha, false);
	nonMipMapped[2] = new Texture(file, Format.RGB888, false);
	nonMipMapped[3] = new Texture(file, Format.RGB565, false);
	nonMipMapped[4] = new Texture(file, Format.RGBA8888, false);
	nonMipMapped[5] = new Texture(file, Format.RGBA4444, false);

	mipMapped[0] = new Texture(file, Format.Alpha, true);
	mipMapped[1] = new Texture(file, Format.LuminanceAlpha, true);
	mipMapped[2] = new Texture(file, Format.RGB888, true);
	mipMapped[3] = new Texture(file, Format.RGB565, true);
	mipMapped[4] = new Texture(file, Format.RGBA8888, true);
	mipMapped[5] = new Texture(file, Format.RGBA4444, true);

	batch = new SpriteBatch();
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:19,代码来源:TextureFormatTest.java

示例4: PostProcessor

/** Construct a new PostProcessor with the given parameters and the specified texture wrap mode */
public PostProcessor (int fboWidth, int fboHeight, boolean useDepth, boolean fsaa, boolean useAlphaChannel, boolean use32Bits,
	TextureWrap u, TextureWrap v) {
	if (use32Bits) {
		if (useAlphaChannel) {
			fbFormat = Format.RGBA8888;
		} else {
			fbFormat = Format.RGB888;
		}
	} else {
		if (useAlphaChannel) {
			fbFormat = Format.RGBA4444;
		} else {
			fbFormat = Format.RGB565;
		}
	}

	composite = newPingPongBuffer(fboWidth, fboHeight, fbFormat, useDepth, fsaa);
	setBufferTextureWrap(u, v);

	pipelineState = new PipelineState();

	capturing = false;
	hasCaptured = false;
	enabled = true;
	this.useDepth = useDepth;
	if (useDepth) {
		clearBits |= GL20.GL_DEPTH_BUFFER_BIT;
	}

	setViewport(null);
}
 
开发者ID:Osaris31,项目名称:exterminate,代码行数:32,代码来源:PostProcessor.java

示例5: PostProcessor

/**
 * Construct a new PostProcessor with the given parameters and the specified texture wrap mode
 */
public PostProcessor(int fboWidth, int fboHeight, boolean useDepth, boolean useAlphaChannel, boolean use32Bits,
      TextureWrap u, TextureWrap v) {
   if (use32Bits) {
      if (useAlphaChannel) {
         fbFormat = Format.RGBA8888;
      } else {
         fbFormat = Format.RGB888;
      }
   } else {
      if (useAlphaChannel) {
         fbFormat = Format.RGBA4444;
      } else {
         fbFormat = Format.RGB565;
      }
   }

   composite = newPingPongBuffer(fboWidth, fboHeight, fbFormat, useDepth);
   setBufferTextureWrap(u, v);

   pipelineState = new PipelineState();

   capturing = false;
   hasCaptured = false;
   enabled = true;
   this.useDepth = useDepth;
   if (useDepth) {
      clearBits |= GL20.GL_DEPTH_BUFFER_BIT;
   }

   setViewport(null);
}
 
开发者ID:bitbrain,项目名称:braingdx,代码行数:34,代码来源:PostProcessor.java

示例6: generateSpaceBackgroundStars

public static Texture generateSpaceBackgroundStars(int tileX, int tileY, int tileSize, float depth) {
	MathUtils.random.setSeed((long) (MyMath.getSeed(tileX, tileY) * depth));
	
	//pixmap = new Pixmap(tileSize, tileSize, Format.RGB565);
	pixmap = new Pixmap(tileSize, tileSize, Format.RGBA4444);
	
	int numStars = 300;
	pixmap.setColor(Color.WHITE);
	for (int i = 0; i < numStars; ++i){					
		
		int newX = MathUtils.random(tileSize);
		int newY = MathUtils.random(tileSize);
		
		pixmap.drawPixel(newX, newY);
		//pixmap.drawPixel(newX, newY, Color.rgba8888(MathUtils.random(1), MathUtils.random(1), MathUtils.random(1), 1));
	}
	
	/*
	//DEBUG - fill tile to visualize boundaries
	pixmap.setColor(MathUtils.random(), MathUtils.random(), MathUtils.random(), 0.5f);
	pixmap.fill();
	*/
	
	//create texture and dispose pixmap to prevent memory leak
	Texture t = new Texture(pixmap);
	pixmap.dispose(); 
	return t;
}
 
开发者ID:0XDE57,项目名称:SpaceProject,代码行数:28,代码来源:TextureFactory.java

示例7: generateStar

public static Texture generateStar(long seed, int radius) {
	OpenSimplexNoise noise = new OpenSimplexNoise(seed);
	
	Pixmap pixmap = new Pixmap(radius * 2, radius * 2, Format.RGBA4444);
	
	double scale = 20;//zoom
	
	// draw circle for planet
	pixmap.setColor(0.5f, 0.5f, 0.5f, 1);
	pixmap.fillCircle(radius, radius, radius - 1);
	
	//add layer of noise
	for (int y = 0; y < pixmap.getHeight(); ++y) {
		for (int x = 0; x < pixmap.getWidth(); ++x) {
			//only draw on circle
			if (pixmap.getPixel(x, y) != 0) {
				double nx = x/scale, ny = y/scale;
				double i = noise.eval(nx, ny, 0);
				i = (i * 0.5) + 0.5; //convert from range [-1:1] to [0:1]
				if (i > 0.5f){
					pixmap.setColor(new Color(1, 1, 0, (float)i));
				} else {
					pixmap.setColor(new Color(1, 0, 0, (float)(1-i)));
				}
				pixmap.drawPixel(x, y);
			}				
		}
	}
	

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

示例8: generateHouseRow

Sprite generateHouseRow(float y, int height) {
	// Bottom houses
	TextureGenerator houseTexGenerator = new HouseTextureGenerator();
	final int OFFSET = 70;
	final int MIN_HEIGHT = (int) (height);
	final int MAX_HEIGHT = (int) (MIN_HEIGHT + OFFSET);
	
	FrameBuffer buffer = new FrameBuffer(Format.RGBA4444, Gdx.graphics.getWidth(), MAX_HEIGHT, false);
	
	Matrix4 projectionMatrix = new Matrix4();
	projectionMatrix.setToOrtho2D(0, 0, buffer.getWidth(), buffer.getHeight());

	batch.setProjectionMatrix(projectionMatrix);
	
	buffer.begin();		
	batch.begin();
	
		int offsetX = (int) -(Math.random() * 250);
		
		while (offsetX < buffer.getWidth()) {
			Texture texture = houseTexGenerator.create((int)Math.round(150 + Math.random() * 50), (int)Math.round(MIN_HEIGHT + Math.random() * OFFSET));
			batch.draw(texture, offsetX, 0f);
			offsetX += texture.getWidth();
		}
		
	batch.end();
	batch.flush();		
	buffer.end();
	
	Sprite s = new Sprite(buffer.getColorBufferTexture());
	s.setY(y - OFFSET);
	return s;
}
 
开发者ID:bitbrain,项目名称:pretender,代码行数:33,代码来源:IngameScreen.java

示例9: defineFormat

private static Format defineFormat(boolean use32Bits, boolean alphaChannel) {
	return use32Bits ? alphaChannel ? Format.RGBA8888 : Format.RGB888
			: alphaChannel ? Format.RGBA4444 : Format.RGB565;
}
 
开发者ID:spookygames,项目名称:gdx-gfx,代码行数:4,代码来源:FrameBufferFactory.java

示例10: initialize

private void initialize(int FBO_W, int FBO_H, FrameBuffer fbo,
		boolean hasDepth, boolean useBlending, boolean use32bitFBO) {
	blending = useBlending;
	Format format = null;

	if (use32bitFBO) {
		if (useBlending) {
			format = Format.RGBA8888;
		} else {
			format = Format.RGB888;
		}

	} else {
		if (useBlending) {
			format = Format.RGBA4444;
		} else {
			format = Format.RGB565;
		}
	}
	if (fbo == null) {
		frameBuffer = new FrameBuffer(format, Gdx.graphics.getWidth(),
				Gdx.graphics.getHeight(), hasDepth);
	} else {
		frameBuffer = fbo;
	}

	pingPongBuffer1 = new FrameBuffer(format, FBO_W, FBO_H, false);

	pingPongBuffer2 = new FrameBuffer(format, FBO_W, FBO_H, false);

	original = frameBuffer.getColorBufferTexture();
	pingPongTex1 = pingPongBuffer1.getColorBufferTexture();
	pingPongTex2 = pingPongBuffer2.getColorBufferTexture();

	fullScreenQuad = createFullScreenQuad();
	final String alpha = useBlending ? "alpha_" : "";

	bloomShader = BloomShaderLoader.createShader("screenspace",
			alpha + "bloom");

	if (useAlphaChannelAsMask) {
		tresholdShader = BloomShaderLoader.createShader("screenspace",
				"maskedtreshold");
	} else {
		tresholdShader = BloomShaderLoader.createShader("screenspace",
				alpha + "treshold");
	}

	blurShader = BloomShaderLoader.createShader("blurspace",
			alpha + "gaussian");

	setSize(FBO_W, FBO_H);
	setBloomIntesity(2.5f);
	setOriginalIntesity(0.8f);
	setTreshold(0.5f);

	bloomShader.begin();
	{
		bloomShader.setUniformi("u_texture0", 0);
		bloomShader.setUniformi("u_texture1", 1);
	}
	bloomShader.end();
}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:63,代码来源:Bloom.java

示例11: writeSymbolGridToFile

public static void writeSymbolGridToFile(Symbol[][] grid, String filename, int tileSize)
	{
		// Get size of image
		int height = grid[0].length * tileSize;
		int width = grid.length * tileSize;

		// Create resources
		Pixmap pixmap = new Pixmap(width, height, Format.RGBA4444);

		// do render
		for (int x = 0; x < grid.length; x++)
		{
			for (int y = 0; y < grid[0].length; y++)
			{
				Symbol s = grid[x][y];

				if (s.character == '#')
				{
					pixmap.setColor(Color.MAROON);
				}
				else if (s.character == '.')
				{
					pixmap.setColor(Color.GREEN);
				}
				else
				{
					pixmap.setColor(Color.BLUE);
				}
				pixmap.fillRectangle(x*tileSize, y*tileSize, tileSize, tileSize);

//				if (s.hasEnvironmentEntity())
//				{
//					Pixmap src = TextureToPixmap(s.getEnvironmentEntity("").sprite.getCurrentTexture());
//					pixmap.drawPixmap(src,
//							0, 0, src.getWidth(), src.getHeight(),
//							x*tileSize, y*tileSize, tileSize, tileSize);
//					src.dispose();
//				}
//
//				if (s.hasGameEntity())
//				{
//					Pixmap src = TextureToPixmap(s.getGameEntity().sprite.getCurrentTexture());
//					pixmap.drawPixmap(src,
//							0, 0, src.getWidth(), src.getHeight(),
//							x*tileSize, y*tileSize, tileSize, tileSize);
//					src.dispose();
//				}
			}
		}

		// Save texture
		try
		{
			BufferedImage bi = pixmapToImage(pixmap);
			File outputfile = new File(filename);
			ImageIO.write(bi, "png", outputfile);

		}
		catch (Exception e)
		{
			e.printStackTrace();
		}

		// dispose of resources
		pixmap.dispose();
	}
 
开发者ID:infinity8,项目名称:Roguelike,代码行数:66,代码来源:ImageUtils.java

示例12: initialize

private void initialize(int FBO_W, int FBO_H, FrameBuffer fbo,
    boolean hasDepth, boolean useBlending, boolean use32bitFBO) {
  blending = useBlending;
  Format format = null;

  if (use32bitFBO) {
    if (useBlending) {
      format = Format.RGBA8888;
    } else {
      format = Format.RGB888;
    }

  } else {
    if (useBlending) {
      format = Format.RGBA4444;
    } else {
      format = Format.RGB565;
    }
  }
  if (fbo == null) {
    frameBuffer = new FrameBuffer(format, Gdx.graphics.getWidth(),
        Gdx.graphics.getHeight(), hasDepth);
  } else {
    frameBuffer = fbo;
  }

  pingPongBuffer1 = new FrameBuffer(format, FBO_W, FBO_H, false);

  pingPongBuffer2 = new FrameBuffer(format, FBO_W, FBO_H, false);

  original = frameBuffer.getColorBufferTexture();
  pingPongTex1 = pingPongBuffer1.getColorBufferTexture();
  pingPongTex2 = pingPongBuffer2.getColorBufferTexture();

  fullScreenQuad = createFullScreenQuad();
  final String alpha = useBlending ? "alpha_" : "";

  bloomShader = BloomShaderLoader.createShader("screenspace",
      alpha + "bloom");

  if (useAlphaChannelAsMask) {
    tresholdShader = BloomShaderLoader.createShader("screenspace",
        "maskedtreshold");
  } else {
    tresholdShader = BloomShaderLoader.createShader("screenspace",
        alpha + "treshold");
  }

  blurShader = BloomShaderLoader.createShader("blurspace",
      alpha + "gaussian");

  setSize(FBO_W, FBO_H);
  setBloomIntesity(2.5f);
  setOriginalIntesity(0.8f);
  setTreshold(0.5f);

  bloomShader.begin();
  {
    bloomShader.setUniformi("u_texture0", 0);
    bloomShader.setUniformi("u_texture1", 1);
  }
  bloomShader.end();
}
 
开发者ID:fauu,项目名称:HelixEngine,代码行数:63,代码来源:Bloom.java

示例13: resize

public void resize(int screenWidth, int screenHeight) {
	// TODO: set up the FBOs
	// TODO: what happens in case the FBO size won't be PoT?
	FrameBuffer fbo = new FrameBuffer(Format.RGBA4444, screenWidth, screenHeight, false);
}
 
开发者ID:nooone,项目名称:gdx-vr,代码行数:5,代码来源:VirtualRealityRenderer.java

示例14: initBuffers

private void initBuffers(int width, int height) {
  initialBuffer = new FrameBuffer(Format.RGBA4444, width, height, false);
  bufferA = new FrameBuffer(Format.RGBA4444, width, height, false);
  bufferB = new FrameBuffer(Format.RGBA4444, width, height, false);
}
 
开发者ID:bitbrain,项目名称:craft,代码行数:5,代码来源:SimpleShaderManager.java


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