本文整理汇总了Java中com.badlogic.gdx.graphics.Pixmap.Blending类的典型用法代码示例。如果您正苦于以下问题:Java Blending类的具体用法?Java Blending怎么用?Java Blending使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Blending类属于com.badlogic.gdx.graphics.Pixmap包,在下文中一共展示了Blending类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: circle
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
private void circle(int x, int y, int radius, DrawType drawType) {
if (blending == Blending.None) {
context.setFillStyle(clearColor);
context.setStrokeStyle(clearColor);
context.setGlobalCompositeOperation("clear");
context.beginPath();
context.arc(x, y, radius, 0, 2 * Math.PI, false);
fillOrStrokePath(drawType);
context.closePath();
context.setFillStyle(color);
context.setStrokeStyle(color);
context.setGlobalCompositeOperation("source-over");
}
context.beginPath();
context.arc(x, y, radius, 0, 2 * Math.PI, false);
fillOrStrokePath(drawType);
context.closePath();
pixels = null;
}
开发者ID:konsoletyper,项目名称:teavm-libgdx,代码行数:20,代码来源:PixmapEmulator.java
示例2: line
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
private void line(int x, int y, int x2, int y2, DrawType drawType) {
if (blending == Blending.None) {
context.setFillStyle(clearColor);
context.setStrokeStyle(clearColor);
context.setGlobalCompositeOperation("clear");
context.beginPath();
context.moveTo(x, y);
context.lineTo(x2, y2);
fillOrStrokePath(drawType);
context.closePath();
context.setFillStyle(color);
context.setStrokeStyle(color);
context.setGlobalCompositeOperation("source-over");
}
context.beginPath();
context.moveTo(x, y);
context.lineTo(x2, y2);
fillOrStrokePath(drawType);
context.closePath();
}
开发者ID:konsoletyper,项目名称:teavm-libgdx,代码行数:21,代码来源:PixmapEmulator.java
示例3: rectangle
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
private void rectangle(int x, int y, int width, int height, DrawType drawType) {
if (blending == Blending.None) {
context.setFillStyle(clearColor);
context.setStrokeStyle(clearColor);
context.setGlobalCompositeOperation("clear");
context.beginPath();
context.rect(x, y, width, height);
fillOrStrokePath(drawType);
context.closePath();
context.setFillStyle(color);
context.setStrokeStyle(color);
context.setGlobalCompositeOperation("source-over");
}
context.beginPath();
context.rect(x, y, width, height);
fillOrStrokePath(drawType);
context.closePath();
pixels = null;
}
开发者ID:konsoletyper,项目名称:teavm-libgdx,代码行数:20,代码来源:PixmapEmulator.java
示例4: triangle
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
private void triangle(int x1, int y1, int x2, int y2, int x3, int y3, DrawType drawType) {
if (blending == Blending.None) {
context.setFillStyle(clearColor);
context.setStrokeStyle(clearColor);
context.setGlobalCompositeOperation("clear");
context.beginPath();
context.moveTo(x1, y1);
context.lineTo(x2, y2);
context.lineTo(x3, y3);
context.lineTo(x1, y1);
fillOrStrokePath(drawType);
context.closePath();
context.setFillStyle(color);
context.setStrokeStyle(color);
context.setGlobalCompositeOperation("source-over");
}
context.beginPath();
context.moveTo(x1, y1);
context.lineTo(x2, y2);
context.lineTo(x3, y3);
context.lineTo(x1, y1);
fillOrStrokePath(drawType);
context.closePath();
pixels = null;
}
开发者ID:konsoletyper,项目名称:teavm-libgdx,代码行数:26,代码来源:PixmapEmulator.java
示例5: consumeCubemapData
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
@Override
public void consumeCubemapData () {
for (int i = 0; i < data.length; i++) {
if (data[i].getType() == TextureData.TextureDataType.Custom) {
data[i].consumeCustomData(GL20.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i);
} else {
Pixmap pixmap = data[i].consumePixmap();
boolean disposePixmap = data[i].disposePixmap();
if (data[i].getFormat() != pixmap.getFormat()) {
Pixmap tmp = new Pixmap(pixmap.getWidth(), pixmap.getHeight(), data[i].getFormat());
Blending blend = Pixmap.getBlending();
Pixmap.setBlending(Blending.None);
tmp.drawPixmap(pixmap, 0, 0, 0, 0, pixmap.getWidth(), pixmap.getHeight());
Pixmap.setBlending(blend);
if (data[i].disposePixmap()) pixmap.dispose();
pixmap = tmp;
disposePixmap = true;
}
Gdx.gl.glPixelStorei(GL20.GL_UNPACK_ALIGNMENT, 1);
Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, pixmap.getGLInternalFormat(), pixmap.getWidth(),
pixmap.getHeight(), 0, pixmap.getGLFormat(), pixmap.getGLType(), pixmap.getPixels());
}
}
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:25,代码来源:FacedCubemapData.java
示例6: generateMipMapCPU
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
private static void generateMipMapCPU (int target, Pixmap pixmap, int textureWidth, int textureHeight) {
Gdx.gl.glTexImage2D(target, 0, pixmap.getGLInternalFormat(), pixmap.getWidth(), pixmap.getHeight(), 0,
pixmap.getGLFormat(), pixmap.getGLType(), pixmap.getPixels());
if ((Gdx.gl20 == null) && textureWidth != textureHeight)
throw new GdxRuntimeException("texture width and height must be square when using mipmapping.");
int width = pixmap.getWidth() / 2;
int height = pixmap.getHeight() / 2;
int level = 1;
Blending blending = Pixmap.getBlending();
Pixmap.setBlending(Blending.None);
while (width > 0 && height > 0) {
Pixmap tmp = new Pixmap(width, height, pixmap.getFormat());
tmp.drawPixmap(pixmap, 0, 0, pixmap.getWidth(), pixmap.getHeight(), 0, 0, width, height);
if (level > 1) pixmap.dispose();
pixmap = tmp;
Gdx.gl.glTexImage2D(target, level, pixmap.getGLInternalFormat(), pixmap.getWidth(), pixmap.getHeight(), 0,
pixmap.getGLFormat(), pixmap.getGLType(), pixmap.getPixels());
width = pixmap.getWidth() / 2;
height = pixmap.getHeight() / 2;
level++;
}
Pixmap.setBlending(blending);
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:26,代码来源:MipMapGenerator.java
示例7: initArmorLeft
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
private Texture initArmorLeft(int step, Color c) {
Blending bck = Pixmap.getBlending();
Pixmap.setBlending(Blending.None);
int sqs = engine.getGridSquareSize();
Pixmap p = new Pixmap(sqs, sqs + 4, Pixmap.Format.RGBA8888);
p.setColor(c);
//p.drawRectangle(0, 0, sqs, 3);
int w = step * sqs / armorLeftStep;
p.fillRectangle(0, 0, w, 3);
Texture t = new Texture(p);
p.dispose();
Pixmap.setBlending(bck);
return t;
}
开发者ID:nrv,项目名称:BASToD,代码行数:21,代码来源:SpriteManager.java
示例8: updateComponent
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
@Override
public Texture updateComponent() {
Blending bck = Pixmap.getBlending();
Pixmap.setBlending(Blending.None);
Pixmap p = new Pixmap(getWidth(), getHeight(), Pixmap.Format.RGBA8888);
Color c1 = GUIResources.getInstance().getColor(player.getColor()).cpy();
c1.a = 1f;
p.setColor(c1);
p.drawRectangle(0, 0, getWidth(), getHeight());
c1.a = 0.5f;
p.setColor(c1);
int w = player.getScore() * (getWidth() - 2) / player.getMaxScore();
p.fillRectangle(1, 1, w, getHeight() - 2);
str = Integer.toString(player.getScore());
Texture t = new Texture(p);
p.dispose();
Pixmap.setBlending(bck);
return t;
}
开发者ID:nrv,项目名称:BASToD,代码行数:26,代码来源:SingleScoreBar.java
示例9: copySubRect
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
/**
* Takes a sub-rect {@code srcRect} from {@code src} and copies it to a sub-rect {@code dstRect} in {@code dst}.
*
* @param filter Determines which type of interpolation to use if the src/dst rects are a different size.
*/
public static void copySubRect(Pixmap src, Rect srcRect, Pixmap dst, Rect dstRect, Filter filter) {
Blending oldBlend = dst.getBlending();
Filter oldFilter = Filter.BiLinear;
try {
dst.setBlending(Blending.None);
dst.setFilter(filter);
dst.drawPixmap(src, srcRect.x, srcRect.y, srcRect.w, srcRect.h,
dstRect.x, dstRect.y, dstRect.w, dstRect.h);
} finally {
dst.setBlending(oldBlend);
dst.setFilter(oldFilter);
}
}
开发者ID:anonl,项目名称:nvlist,代码行数:20,代码来源:PixmapUtil.java
示例10: uploadImageData
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
public static void uploadImageData (int target, TextureData data, int miplevel) {
if (data == null) {
// FIXME: remove texture on target?
return;
}
if (!data.isPrepared()) data.prepare();
final TextureDataType type = data.getType();
if (type == TextureDataType.Custom) {
data.consumeCustomData(target);
return;
}
Pixmap pixmap = data.consumePixmap();
boolean disposePixmap = data.disposePixmap();
if (data.getFormat() != pixmap.getFormat()) {
Pixmap tmp = new Pixmap(pixmap.getWidth(), pixmap.getHeight(), data.getFormat());
Blending blend = Pixmap.getBlending();
Pixmap.setBlending(Blending.None);
tmp.drawPixmap(pixmap, 0, 0, 0, 0, pixmap.getWidth(), pixmap.getHeight());
Pixmap.setBlending(blend);
if (data.disposePixmap()) {
pixmap.dispose();
}
pixmap = tmp;
disposePixmap = true;
}
Gdx.gl.glPixelStorei(GL20.GL_UNPACK_ALIGNMENT, 1);
if (data.useMipMaps()) {
MipMapGenerator.generateMipMap(target, pixmap, pixmap.getWidth(), pixmap.getHeight());
} else {
Gdx.gl.glTexImage2D(target, miplevel, pixmap.getGLInternalFormat(), pixmap.getWidth(), pixmap.getHeight(), 0,
pixmap.getGLFormat(), pixmap.getGLType(), pixmap.getPixels());
}
if (disposePixmap) pixmap.dispose();
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:39,代码来源:GLTexture.java
示例11: getPixmap
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
/**
* @return Pixmap representing the glyph, needs to be disposed manually.
*/
public Pixmap getPixmap(Format format) {
Pixmap pixmap = new Pixmap(getWidth(), getRows(), Format.Alpha);
BufferUtils.copy(getBuffer(), pixmap.getPixels(), pixmap.getPixels().capacity());
Pixmap converted = new Pixmap(pixmap.getWidth(), pixmap.getHeight(), format);
Blending blending = Pixmap.getBlending();
Pixmap.setBlending(Blending.None);
converted.drawPixmap(pixmap, 0, 0);
Pixmap.setBlending(blending);
pixmap.dispose();
return converted;
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:15,代码来源:FreeType.java
示例12: show
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
public void show(ModelEntity imageEntity) {
if (!hasParent()) {
container.addActor(this);
Pixmap.setBlending(Blending.None);
controller.getCommands().pushStack(MAX_COMMANDS);
setBounds(0, 0, container.getWidth(), container.getHeight());
mesh.initializeRenderingResources();
setMode(Mode.DRAW);
if (imageEntity != null) {
toEdit = imageEntity;
Gdx.app.postRunnable(editImage);
}
}
}
开发者ID:e-ucm,项目名称:ead,代码行数:16,代码来源:BrushStrokes.java
示例13: hide
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
/**
* Clears undo/redo history and invokes {@link MeshHelper#release()}.
*
* @param release
*/
public void hide(boolean release) {
if (hasParent()) {
Pixmap.setBlending(Blending.SourceOver);
remove();
if (release) {
release();
}
controller.getCommands().popStack(false);
}
}
开发者ID:e-ucm,项目名称:ead,代码行数:16,代码来源:BrushStrokes.java
示例14: renderDebugLoS
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
public void renderDebugLoS(Vector pos) {
Blending bck = Pixmap.getBlending();
Pixmap.setBlending(Blending.None);
Dimension dimG = engine.getGridDimension();
Dimension dimB = engine.getBoardDimension();
Pixmap p = new Pixmap(dimB.getW() + 1, dimB.getH() + 1, Pixmap.Format.RGBA8888);
Color ok = Color.GREEN;
ok.a = 0.2f;
Color nok = Color.ORANGE;
nok.a = 0.2f;
for (int x= 0; x < dimG.getW(); x++) {
for (int y= 0; y < dimG.getH(); y++) {
Vector v = new Vector(x, y);
if (engine.lineOfSight(pos, v)) {
drawTintedSquare(p, ok, engine.fromGridToBoard(v));
} else {
drawTintedSquare(p, nok, engine.fromGridToBoard(v));
}
}
}
Texture debug = new Texture(p);
p.dispose();
Pixmap.setBlending(bck);
batchBegin();
draw(debug, Engine._SP_SIDE, Engine._SP_BOTTOM);
batchEnd();
debug.dispose();
}
开发者ID:nrv,项目名称:BASToD,代码行数:36,代码来源:OverlayManager.java
示例15: renderBuildPositions
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
public void renderBuildPositions() {
if (buildPositions == null) {
Dimension dimB = engine.getBoardDimension();
Blending bck = Pixmap.getBlending();
Pixmap.setBlending(Blending.None);
Pixmap p = new Pixmap(dimB.getW() + 1, dimB.getH() + 1, Pixmap.Format.RGBA8888);
for (Player player : engine.getPlayers()) {
Color c = GUIResources.getInstance().getColor(player.getColor()).cpy();
c.a = 0.2f;
List<Vector> pos = engine.getBuildPositions(player);
if (pos != null) {
for (Vector v : pos) {
if ((Engine.PRECOMPUTE_OPEN_BUILD_POSITIONS && engine.isOpenedBuildPosition(v)) || (engine.isOpenedOnGrid(v))) {
Vector vb = engine.fromGridToBoard(v);
drawTintedSquare(p, c, vb);
}
}
}
}
buildPositions = new Texture(p);
p.dispose();
Pixmap.setBlending(bck);
}
batchBegin();
draw(buildPositions, Engine._SP_SIDE, Engine._SP_BOTTOM);
batchEnd();
}
开发者ID:nrv,项目名称:BASToD,代码行数:35,代码来源:OverlayManager.java
示例16: renderGrid
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
public void renderGrid() {
if (grid == null) {
Dimension dimG = engine.getGridDimension();
Dimension dimB = engine.getBoardDimension();
int sqs = engine.getGridSquareSize();
Blending bck = Pixmap.getBlending();
Pixmap.setBlending(Blending.None);
Pixmap p = new Pixmap(dimB.getW() + 1, dimB.getH() + 1, Pixmap.Format.RGBA8888);
Color c = Color.WHITE.cpy();
c.a = 0.2f;
p.setColor(c);
for (int x = 0; x <= dimG.getW(); x++) {
int bx = x * sqs;
p.drawLine(bx, 0, bx, dimB.getH() - 1);
}
for (int y = 0; y <= dimG.getH(); y++) {
int by = y * sqs;
p.drawLine(0, by, dimB.getW() - 1, by);
}
grid = new Texture(p);
p.dispose();
Pixmap.setBlending(bck);
}
batchBegin();
draw(grid, Engine._SP_SIDE, Engine._SP_BOTTOM);
batchEnd();
}
开发者ID:nrv,项目名称:BASToD,代码行数:34,代码来源:OverlayManager.java
示例17: renderUnitOverlay
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
public void renderUnitOverlay(Unit selected) {
if (selected != null) {
if (selected instanceof Tower) {
int shotRange = (int) (((Tower) selected).getRangeOnBoard());
String k = selected.getPlayer().getColor() + "-" + shotRange;
if (!towerRanges.containsKey(k)) {
int gfxSize = shotRange * 2;
Blending bck = Pixmap.getBlending();
Pixmap.setBlending(Blending.None);
Pixmap p = new Pixmap(gfxSize, gfxSize, Pixmap.Format.RGBA8888);
Color c = GUIResources.getInstance().getColor(selected.getPlayer().getColor()).cpy();
c.a = 0.2f;
p.setColor(c);
p.fillCircle(shotRange, shotRange, shotRange);
Texture t = new Texture(p);
p.dispose();
Pixmap.setBlending(bck);
towerRanges.put(k, t);
}
batchBegin();
draw(towerRanges.get(k), Engine._SP_SIDE + selected.getPositionOnBoard().getX() - shotRange, Engine._SP_BOTTOM + selected.getPositionOnBoard().getY() - shotRange);
batchEnd();
}
}
}
开发者ID:nrv,项目名称:BASToD,代码行数:30,代码来源:OverlayManager.java
示例18: UnitInfoBox
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
public UnitInfoBox(Unit u) {
super(u.getName() + "-InfoBox", -1, -1, 200, 100);
this.unit = u;
setNeedUpdate(false);
font = GUIResources.getInstance().getFont(INFOBOX_FONT);
moveTo(u.getPositionOnBoard().getXInt(), u.getPositionOnBoard().getYInt());
Blending bck = Pixmap.getBlending();
Pixmap.setBlending(Blending.None);
Pixmap p = new Pixmap(getWidth(), getHeight(), Pixmap.Format.RGBA8888);
Color c1 = Color.YELLOW;
c1.a = 1f;
p.setColor(c1);
p.drawRectangle(0, 0, getWidth(), getHeight());
c1 = Color.BLACK;
c1.a = 0.5f;
p.setColor(c1);
p.fillRectangle(1, 1, getWidth() - 2, getHeight() - 2);
setBackground(new Texture(p));
p.dispose();
Pixmap.setBlending(bck);
}
开发者ID:nrv,项目名称:BASToD,代码行数:30,代码来源:UnitInfoBox.java
示例19: updateComponent
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
@Override
public Texture updateComponent() {
Blending bck = Pixmap.getBlending();
Pixmap.setBlending(Blending.None);
Pixmap p = new Pixmap(getWidth(), getHeight(), Pixmap.Format.RGBA8888);
Color c = GUIResources.getInstance().getColor(GUIResources.WHITE);
Color c1 = GUIResources.getInstance().getColor(player1.getColor()).cpy();
c1.a = 0.5f;
Color c2 = GUIResources.getInstance().getColor(player2.getColor()).cpy();
c2.a = 0.5f;
int w = player1.getScore() * (getWidth() - 2) / (player1.getScore() + player2.getScore());
p.setColor(c1);
p.fillRectangle(1, 1, w, getHeight() - 2);
p.setColor(c2);
p.fillRectangle(w + 1, 1, getWidth() - 2 - w, getHeight() - 2);
p.setColor(c);
p.drawRectangle(0, 0, getWidth(), getHeight());
str1 = Integer.toString(player1.getScore());
str2 = Integer.toString(player2.getScore());
Texture t = new Texture(p);
p.dispose();
Pixmap.setBlending(bck);
return t;
}
开发者ID:nrv,项目名称:BASToD,代码行数:34,代码来源:DualScoreBar.java
示例20: updateComponent
import com.badlogic.gdx.graphics.Pixmap.Blending; //导入依赖的package包/类
@Override
public Texture updateComponent() {
Blending bck = Pixmap.getBlending();
Pixmap.setBlending(Blending.None);
Pixmap p = new Pixmap(getWidth(), getHeight(), Pixmap.Format.RGBA8888);
Color c1 = GUIResources.getInstance().getColor(player.getColor()).cpy();
c1.a = 1f;
p.setColor(c1);
p.drawRectangle(0, 0, getWidth(), getHeight());
c1.a = 0.5f;
p.setColor(c1);
int w = player.getMetal() * (getWidth() - 2) / player.getMaxMetal();
p.fillRectangle(1, 1, w, getHeight() - 2);
strMetal = "$ " + player.getMetal();
strDeltaA = df.format(player.getMetalAddedMean(engine.getNow()));
strDeltaR = df.format(-1 * player.getMetalRemovedMean(engine.getNow()));
Texture t = new Texture(p);
p.dispose();
Pixmap.setBlending(bck);
return t;
}
开发者ID:nrv,项目名称:BASToD,代码行数:28,代码来源:MetalBar.java
注:本文中的com.badlogic.gdx.graphics.Pixmap.Blending类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论