本文整理汇总了Java中com.badlogic.gdx.graphics.Pixmap.setBlending方法的典型用法代码示例。如果您正苦于以下问题:Java Pixmap.setBlending方法的具体用法?Java Pixmap.setBlending怎么用?Java Pixmap.setBlending使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.Pixmap
的用法示例。
在下文中一共展示了Pixmap.setBlending方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import com.badlogic.gdx.graphics.Pixmap; //导入方法依赖的package包/类
@Override
public void initialize() {
//Allocate a pixmap big enough to accommodate four banks of pattern
//tables (bg and spr each for all four banks)
patternTablePixmap = new Pixmap(128, 1024, Pixmap.Format.RGBA8888);
//Set blending to none so we can rewrite the pixmap and draw it to the
//pattern table texture when graphics are regenerated.
patternTablePixmap.setBlending(Pixmap.Blending.None);
//Allocate a pixmap the size of one tile for live CHR-RAM updates.
patternPixmap = new Pixmap(8, 8, Pixmap.Format.RGBA8888);
patternPixmap.setBlending(Pixmap.Blending.None);
patternTableTexture = new Texture(patternTablePixmap, false);
TextureRegion[][] textureRegions = TextureRegion.split(patternTableTexture, 8, 8);
patternTableSprites = new Sprite[128][16];
for(int row = 0; row < 128; row++) {
for(int column = 0; column < 16; column++) {
TextureRegion textureRegion = textureRegions[row][column];
patternTableSprites[row][column] = new Sprite(textureRegion);
}
}
initializeMonochromePalette();
}
示例2: initialize
import com.badlogic.gdx.graphics.Pixmap; //导入方法依赖的package包/类
/**
* Initializes the pattern table textures and pixmap.
*/
public void initialize() {
//Allocate a pixmap big enough to accommodate both pattern tables.
patternTablePixmap = new Pixmap(128, 256, Pixmap.Format.RGBA8888);
//Set blending to none so we can rewrite the pixmap and draw it to the
//pattern table texture when graphics are regenerated.
patternTablePixmap.setBlending(Pixmap.Blending.None);
//Allocate a pixmap the size of one tile for live CHR-RAM updates.
patternPixmap = new Pixmap(8, 8, Pixmap.Format.RGBA8888);
patternPixmap.setBlending(Pixmap.Blending.None);
patternTableTexture = new Texture(patternTablePixmap, false);
TextureRegion[][] textureRegions = TextureRegion.split(patternTableTexture, 8, 8);
patternTableSprites = new Sprite[32][16];
for(int row = 0; row < 32; row++) {
for(int column = 0; column < 16; column++) {
TextureRegion textureRegion = textureRegions[row][column];
patternTableSprites[row][column] = new Sprite(textureRegion);
}
}
initializeMonochromePalette();
}
示例3: testGraphics
import com.badlogic.gdx.graphics.Pixmap; //导入方法依赖的package包/类
public void testGraphics(){
Object[] objects = new Object[5];
objects[0] = new Color(random.nextFloat(), random.nextFloat(), random.nextFloat(), random.nextFloat());
OrthographicCamera orthographicCamera = new OrthographicCamera();
orthographicCamera.position.set(randFloat(), randFloat(), randFloat());
orthographicCamera.viewportWidth = random.nextInt(1000);
orthographicCamera.viewportHeight = random.nextInt(1000);
orthographicCamera.zoom = random.nextFloat() * random.nextInt(3);
orthographicCamera.near = 0.014f;
orthographicCamera.far = 5000.35f;
orthographicCamera.up.rotateRad(new Vector3(randFloat(), randFloat(), randFloat()).nor(), randFloat());
orthographicCamera.update();
objects[1] = orthographicCamera;
PerspectiveCamera perspectiveCamera = new PerspectiveCamera();
perspectiveCamera.position.set(randFloat(), randFloat(), randFloat());
perspectiveCamera.viewportWidth = random.nextInt(1000);
perspectiveCamera.viewportHeight = random.nextInt(1000);
perspectiveCamera.fieldOfView = (random.nextFloat() * 0.5f + 0.5f) * 60;
perspectiveCamera.near = random.nextFloat() * 5;
perspectiveCamera.far = (random.nextFloat() * 0.5f + 0.5f) * 5000;
perspectiveCamera.up.rotateRad(new Vector3(randFloat(), randFloat(), randFloat()).nor(), randFloat());
perspectiveCamera.update();
objects[2] = perspectiveCamera;
Pixmap pixmap = new Pixmap(2, 3, Pixmap.Format.RGBA8888);
for (int i = 0; i < pixmap.getWidth(); i++) {
for (int j = 0; j < pixmap.getHeight(); j++) {
pixmap.drawPixel(i, j, random.nextInt());
}
}
pixmap.setBlending(Pixmap.Blending.None);
pixmap.setFilter(Pixmap.Filter.NearestNeighbour);
objects[3] = pixmap;
Pixmap pixmap2 = new Pixmap(50, 50, Pixmap.Format.RGBA8888);
for (int i = 0; i < pixmap2.getWidth(); i++) {
for (int j = 0; j < pixmap2.getHeight(); j++) {
pixmap2.drawPixel(i, j, random.nextInt());
}
}
pixmap2.setBlending(Pixmap.Blending.SourceOver);
pixmap2.setFilter(Pixmap.Filter.BiLinear);
objects[4] = pixmap2;
Object[] returned = simpleRoundTrip(objects);
pixmap.dispose();
pixmap2.dispose();
((Pixmap)returned[3]).dispose();
((Pixmap)returned[4]).dispose();
}