當前位置: 首頁>>代碼示例>>Java>>正文


Java Pixmap.setBlending方法代碼示例

本文整理匯總了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();
}
 
開發者ID:gradualgames,項目名稱:ggvm,代碼行數:25,代碼來源:ChrRamPatternTableManager.java

示例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();
}
 
開發者ID:gradualgames,項目名稱:ggvm,代碼行數:26,代碼來源:PatternTableManager.java

示例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();
}
 
開發者ID:CypherCove,項目名稱:gdx-cclibs,代碼行數:55,代碼來源:GraphicsTest.java


注:本文中的com.badlogic.gdx.graphics.Pixmap.setBlending方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。