本文整理匯總了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();
}