本文整理匯總了Java中com.badlogic.gdx.graphics.Pixmap.Format.RGBA8888屬性的典型用法代碼示例。如果您正苦於以下問題:Java Format.RGBA8888屬性的具體用法?Java Format.RGBA8888怎麽用?Java Format.RGBA8888使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.badlogic.gdx.graphics.Pixmap.Format
的用法示例。
在下文中一共展示了Format.RGBA8888屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createHighlightingGraphic
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;
}
示例2: LightMap
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);
}
示例3: PowerLUT
/** 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);
}
示例4: OrthogonalTiledMapRendererWithObjects
public OrthogonalTiledMapRendererWithObjects(TiledMap map) {
super(map);
this.occlusionFbo = new FrameBuffer(Format.RGBA8888, Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2, false);
this.shadowmapFbo = new FrameBuffer(Format.RGBA8888, Gdx.graphics.getWidth() / 2, 1, false);
this.shadowmapTex = shadowmapFbo.getColorBufferTexture();
this.shadowmapTex.setFilter(TextureFilter.Linear, TextureFilter.Linear);
this.shadowmapTex.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
//this.orthoCam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
//this.orthoCam.setToOrtho(Y_DOWN);
this.lights = new ArrayList<Light>();
this.mouseLight = new Light(0, 0, Color.WHITE);
}
示例5: testFlipVertical
@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();
}
示例6: saveScreenshot
private static void saveScreenshot() throws IOException {
int w = Gdx.graphics.getWidth();
int h = Gdx.graphics.getHeight();
final Pixmap pixmap = new Pixmap(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), Format.RGBA8888);
ByteBuffer pixels = pixmap.getPixels();
Gdx.gl.glReadPixels(0, 0, w, h, GL20.GL_RGBA, GL20.GL_UNSIGNED_BYTE, pixels);
final int numBytes = w * h * 4;
byte[] lines = new byte[numBytes];
final int numBytesPerLine = w * 4;
for (int i = 0; i < h; i++) {
pixels.position((h - i - 1) * numBytesPerLine);
pixels.get(lines, i * numBytesPerLine, numBytesPerLine);
}
pixels.clear();
pixels.put(lines);
System.out.println("Captured.");
PixmapIO.writePNG(new FileHandle(androidDir+(++photoNumber)+".png"), pixmap);
}
示例7: toWhite
public static Pixmap toWhite(Pixmap img) {
Pixmap alpha = new Pixmap(img.getWidth(), img.getHeight(), Format.RGBA8888);
//alpha.drawPixmap(img, 0, 0);
int width = alpha.getWidth();
int height = alpha.getHeight();
//alpha.setColor(0xff00009f);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int col = img.getPixel(x, y);
Color color = new Color(col);
if ( color.a > 0.2f ) {
alpha.drawPixel(x, y, Color.WHITE.toIntBits());
}
}
}
img.dispose();
return alpha;
}
示例8: ShaderTest
/**
*
*/
public ShaderTest() {
ShaderProgram.pedantic = false;
vertBlur = loadShader("blurv.frag");
horBlur = loadShader("blurh.frag");
light = loadShader("light.frag");
shader = loadShader("inprint.frag");
this.camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
this.camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
// camera.setToOrtho(false);
transform = new Matrix4();
camera.update();
batch = new SpriteBatch();//1024, shader);
batch.setShader(null);
batch.setProjectionMatrix(camera.combined);
batch.setTransformMatrix(transform);
this.buffer = new FrameBuffer(Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
this.fboPing = new FrameBuffer(Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
this.fboPong = new FrameBuffer(Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
}
示例9: DungeonMeter
public DungeonMeter(DungeonKeeper target) {
this.target = target;
currentValue = 1f;
Pixmap map = new Pixmap(128, 128, Format.RGBA8888);
Color color = new Color(Color.BLACK);
color.a = 0.3f;
map.setColor(color);
map.fill();
Texture texture = new Texture(map);
map.dispose();
background = new Sprite(texture);
map = new Pixmap(128, 128, Format.RGBA8888);
map.setColor(Color.valueOf("99aa66"));
map.fill();
texture = new Texture(map);
map.dispose();
life = new Sprite(texture);
padding = 5;
}
示例10: LifeBar
public LifeBar(GameObject target, TweenManager tweenManager) {
this.target = target;
Texture lifeTexture = Resources.get(Resources.LIFE, Texture.class);
currentPoints = target.getCurrentLife();
this.tweenManager = tweenManager;
Pixmap map = new Pixmap(20, 100, Format.RGBA8888);
map.setColor(Color.BLACK);
map.fill();
Texture backgroundTexture = new Texture(map);
map.dispose();
life = new Sprite(lifeTexture);
background = new Sprite(backgroundTexture);
padding = 10;
getColor().a = 0.5f;
}
示例11: setupEye
private void setupEye(Eye eye, int width, int height, boolean hasStencil) {
FrameBuffer buffer = new FrameBuffer(Format.RGBA8888, width, height, true, hasStencil);
TextureRegion region = new TextureRegion(buffer.getColorBufferTexture());
region.flip(false, true);
VRCamera camera = new VRCamera(this, eye);
camera.near = 0.1f;
camera.far = 1000f;
perEyeData[eye.index] = new VRPerEyeData(buffer, region, camera);
}
示例12: Create1x1ColorTexture
private Texture Create1x1ColorTexture(Color color)
{
Pixmap pixmap = new Pixmap(1, 1, Format.RGBA8888);
pixmap.setColor(color);
pixmap.fill();
return new Texture(pixmap);
}
示例13: Outline
public Outline (int width, int height, float viewportWidth, float viewportHeight) {
buffer = new BouncingBuffer(Format.RGBA8888, width, height, false);
superimpose = new Superimpose();
filter = new OutlineFilter();
filter.setViewportInverse(1f / viewportWidth, 1f / viewportHeight);
}
示例14: 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);
}
示例15: export
public void export() {
float world[][] = this.world;
Pixmap pixmap = new Pixmap(world.length, world.length, Format.RGBA8888);
float maxh = 0;
for (int i = 0; i < world.length; i++) {
for (int j = 0; j < world.length; j++) {
maxh = Math.max(maxh, world[i][j]);
}
}
for (int i = 0; i < world.length; i++) {
for (int j = 0; j < world.length; j++) {
pixmap.setColor(world[i][j] / maxh, world[i][j] / maxh,
world[i][j] / maxh, 1);
if (world[i][j] < IslandManager.hauteurEau) {
pixmap.setColor(world[i][j] / maxh, world[i][j] / maxh,
0.8f, 1);
}
pixmap.drawPixel(i, j);
}
}
FileHandle f = new FileHandle("map.png");
PixmapIO.writePNG(f, pixmap);
System.out.println("map exported. " + f.path());
}