public void draw (Batch batch, float x, float y, float width, float height) { Color spriteColor = sprite.getColor(); temp.set(spriteColor); sprite.setColor(spriteColor.mul(batch.getColor())); sprite.setRotation(0); sprite.setScale(1, 1); sprite.setBounds(x, y, width, height); sprite.draw(batch); sprite.setColor(temp); }
/** Tints all text currently in the cache. Does not affect subsequently added text. */ public void tint (Color tint) { float newTint = tint.toFloatBits(); if (currentTint == newTint) return; currentTint = newTint; int[] tempGlyphCount = this.tempGlyphCount; for (int i = 0, n = tempGlyphCount.length; i < n; i++) tempGlyphCount[i] = 0; for (int i = 0, n = layouts.size; i < n; i++) { GlyphLayout layout = layouts.get(i); for (int ii = 0, nn = layout.runs.size; ii < nn; ii++) { GlyphRun run = layout.runs.get(ii); Array<Glyph> glyphs = run.glyphs; float colorFloat = tempColor.set(run.color).mul(tint).toFloatBits(); for (int iii = 0, nnn = glyphs.size; iii < nnn; iii++) { Glyph glyph = glyphs.get(iii); int page = glyph.page; int offset = tempGlyphCount[page] * 20 + 2; tempGlyphCount[page]++; float[] vertices = pageVertices[page]; for (int v = 0; v < 20; v += 5) vertices[offset + v] = colorFloat; } } } }
/** Tints all text currently in the cache. Does not affect subsequently added text. */ public void tint (Color tint) { float newTint = tint.toFloatBits(); if (currentTint == newTint) return; currentTint = newTint; int[] tempGlyphCount = this.tempGlyphCount; for (int i = 0, n = tempGlyphCount.length; i < n; i++) tempGlyphCount[i] = 0; for (int i = 0, n = layouts.size; i < n; i++) { GlyphLayout layout = layouts.get(i); for (int ii = 0, nn = layout.runs.size; ii < nn; ii++) { GlyphRun run = layout.runs.get(ii); Array<Glyph> glyphs = run.glyphs; float colorFloat = tempColor.set(run.color).mul(tint).toFloatBits(); for (int iii = 0, nnn = glyphs.size; iii < nnn; iii++) { Glyph glyph = glyphs.get(iii); int page = glyph.page; int offset = tempGlyphCount[page] * 20 + 2; tempGlyphCount[page]++; float[] vertices = pageVertices[page]; for (int v = 0; v < 20; v += 5) vertices[offset + v] = colorFloat; } } } }
public void draw (Batch batch, float x, float y, float width, float height) { Color spriteColor = sprite.getColor(); temp.set(spriteColor); sprite.setColor(spriteColor.mul(batch.getColor())); sprite.setRotation(0); sprite.setScale(1, 1); sprite.setBounds(x, y, width, height); sprite.draw(batch); sprite.setColor(temp); }
public void draw (Batch batch, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation) { Color spriteColor = sprite.getColor(); temp.set(spriteColor); sprite.setColor(spriteColor.mul(batch.getColor())); sprite.setOrigin(originX, originY); sprite.setRotation(rotation); sprite.setScale(scaleX, scaleY); sprite.setBounds(x, y, width, height); sprite.draw(batch); sprite.setColor(temp); }
public void draw (Batch batch, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation) { Color spriteColor = sprite.getColor(); temp.set(spriteColor); sprite.setColor(spriteColor.mul(batch.getColor())); sprite.setOrigin(originX, originY); sprite.setRotation(rotation); sprite.setScale(scaleX, scaleY); sprite.setBounds(x, y, width, height); sprite.draw(batch); sprite.setColor(temp); }
private final void addVertex (final float[] values, final int offset) { final int o = vertices.size; vertices.addAll(values, offset, stride); lastIndex = (short)(vindex++); if (vertexTransformationEnabled) { transformPosition(vertices.items, o + posOffset, posSize, positionTransform); if (norOffset >= 0) transformNormal(vertices.items, o + norOffset, 3, normalTransform); if (biNorOffset >= 0) transformNormal(vertices.items, o + biNorOffset, 3, normalTransform); if (tangentOffset >= 0) transformNormal(vertices.items, o + tangentOffset, 3, normalTransform); } final float x = vertices.items[o + posOffset]; final float y = (posSize > 1) ? vertices.items[o + posOffset + 1] : 0f; final float z = (posSize > 2) ? vertices.items[o + posOffset + 2] : 0f; bounds.ext(x, y, z); if (hasColor) { if (colOffset >= 0) { vertices.items[o + colOffset] *= color.r; vertices.items[o + colOffset + 1] *= color.g; vertices.items[o + colOffset + 2] *= color.b; if (colSize > 3) vertices.items[o + colOffset + 3] *= color.a; } else if (cpOffset >= 0) { Color.abgr8888ToColor(tempC1, vertices.items[o + cpOffset]); vertices.items[o + cpOffset] = tempC1.mul(color).toFloatBits(); } } if (hasUVTransform && uvOffset >= 0) { vertices.items[o + uvOffset] = uOffset + uScale * vertices.items[o + uvOffset]; vertices.items[o + uvOffset + 1] = vOffset + vScale * vertices.items[o + uvOffset + 1]; } }
private final void addVertex (final float[] values, final int offset) { final int o = vertices.size; vertices.addAll(values, offset, stride); lastIndex = (short)(vindex++); if (vertexTransformationEnabled) { transformPosition(vertices.items, o + posOffset, posSize, positionTransform); if (norOffset >= 0) transformNormal(vertices.items, o + norOffset, 3, normalTransform); if (biNorOffset >= 0) transformNormal(vertices.items, o + biNorOffset, 3, normalTransform); if (tangentOffset >= 0) transformNormal(vertices.items, o + tangentOffset, 3, normalTransform); } final float x = vertices.items[o + posOffset]; final float y = (posSize > 1) ? vertices.items[o + posOffset + 1] : 0f; final float z = (posSize > 2) ? vertices.items[o + posOffset + 2] : 0f; bounds.ext(x, y, z); if (hasColor) { if (colOffset >= 0) { vertices.items[o + colOffset] *= color.r; vertices.items[o + colOffset + 1] *= color.g; vertices.items[o + colOffset + 2] *= color.b; if (colSize > 3) vertices.items[o + colOffset + 3] *= color.a; } else if (cpOffset >= 0) { Color.abgr8888ToColor(tempC1, vertices.items[o + cpOffset]); vertices.items[o + cpOffset] = tempC1.mul(color).toFloatBits(); } } if (hasUVTransform && uvOffset >= 0) { vertices.items[o + uvOffset] = uOffset + uScale * vertices.items[o + uvOffset]; vertices.items[o + uvOffset + 1] = vOffset + vScale * vertices.items[o + uvOffset + 1]; } }
private void prepareVertices (Batch batch, float x, float y, float width, float height) { final float centerColumnX = x + leftWidth; final float rightColumnX = x + width - rightWidth; final float middleRowY = y + bottomHeight; final float topRowY = y + height - topHeight; final float c = tmpDrawColor.set(color).mul(batch.getColor()).toFloatBits(); if (bottomLeft != -1) set(bottomLeft, x, y, centerColumnX - x, middleRowY - y, c); if (bottomCenter != -1) set(bottomCenter, centerColumnX, y, rightColumnX - centerColumnX, middleRowY - y, c); if (bottomRight != -1) set(bottomRight, rightColumnX, y, x + width - rightColumnX, middleRowY - y, c); if (middleLeft != -1) set(middleLeft, x, middleRowY, centerColumnX - x, topRowY - middleRowY, c); if (middleCenter != -1) set(middleCenter, centerColumnX, middleRowY, rightColumnX - centerColumnX, topRowY - middleRowY, c); if (middleRight != -1) set(middleRight, rightColumnX, middleRowY, x + width - rightColumnX, topRowY - middleRowY, c); if (topLeft != -1) set(topLeft, x, topRowY, centerColumnX - x, y + height - topRowY, c); if (topCenter != -1) set(topCenter, centerColumnX, topRowY, rightColumnX - centerColumnX, y + height - topRowY, c); if (topRight != -1) set(topRight, rightColumnX, topRowY, x + width - rightColumnX, y + height - topRowY, c); }
private void prepareVertices (Batch batch, float x, float y, float width, float height) { final float centerColumnX = x + leftWidth; final float rightColumnX = x + width - rightWidth; final float middleRowY = y + bottomHeight; final float topRowY = y + height - topHeight; final float c = tmpDrawColor.set(color).mul(batch.getColor()).toFloatBits(); if (bottomLeft != -1) set(bottomLeft, x, y, centerColumnX - x, middleRowY - y, c); if (bottomCenter != -1) set(bottomCenter, centerColumnX, y, rightColumnX - centerColumnX, middleRowY - y, c); if (bottomRight != -1) set(bottomRight, rightColumnX, y, x + width - rightColumnX, middleRowY - y, c); if (middleLeft != -1) set(middleLeft, x, middleRowY, centerColumnX - x, topRowY - middleRowY, c); if (middleCenter != -1) set(middleCenter, centerColumnX, middleRowY, rightColumnX - centerColumnX, topRowY - middleRowY, c); if (middleRight != -1) set(middleRight, rightColumnX, middleRowY, x + width - rightColumnX, topRowY - middleRowY, c); if (topLeft != -1) set(topLeft, x, topRowY, centerColumnX - x, y + height - topRowY, c); if (topCenter != -1) set(topCenter, centerColumnX, topRowY, rightColumnX - centerColumnX, y + height - topRowY, c); if (topRight != -1) set(topRight, rightColumnX, topRowY, x + width - rightColumnX, y + height - topRowY, c); }
public void draw (Batch batch, float parentAlpha) { validate(); Color color = tempColor.set(getColor()); color.a *= parentAlpha; if (style.background != null) { batch.setColor(color.r, color.g, color.b, color.a); style.background.draw(batch, getX(), getY(), getWidth(), getHeight()); } if (style.fontColor != null) color.mul(style.fontColor); cache.tint(color); cache.setPosition(getX(), getY()); cache.draw(batch); }
public void draw (Batch batch, float parentAlpha) { validate(); Color color = tempColor.set(getColor()); color.a *= parentAlpha; if (style.background != null) { batch.setColor(color.r, color.g, color.b, color.a); style.background.draw(batch, getX(), getY(), getWidth(), getHeight()); } if (style.fontColor != null) color.mul(style.fontColor); cache.tint(color); cache.setPosition(getX(), getY()); cache.draw(batch); }
public void draw (Batch batch, float x, float y, float width, float height) { Color batchColor = batch.getColor(); temp.set(batchColor); batch.setColor(batchColor.mul(color));
public void draw (Batch batch, float x, float y, float width, float height) { Color batchColor = batch.getColor(); temp.set(batchColor); batch.setColor(batchColor.mul(color));
/** * Gets a modified copy of color as if it is lit with a colored light source. * @param color the color to shine the light on * @param light the color of the light source * @return a copy of the Color color that factors in the lighting of the Color light. */ public Color lightWith(Color color, Color light) { return filter(color.cpy().mul(light)); }
public void drag(SpriteActor a) { draggingActor = a; tmpTint.set(DRAG_NOT_HOTSPOT_COLOR); if (a != null && draggingActor.getTint() != null) tmpTint.mul(draggingActor.getTint()); }
public void draw (Batch batch, float x, float y, float width, float height) { Color spriteColor = sprite.getColor(); temp.set(spriteColor); sprite.setColor(spriteColor.mul(batch.getColor())); sprite.setRotation(0); sprite.setScale(1, 1); sprite.setBounds(x, y, width, height); sprite.draw(batch); sprite.setColor(temp); }
@Override public void draw (Batch batch, float parentAlpha) { super.draw(batch, parentAlpha); Drawable underline = style.underline; if (underline != null && clickListener.isOver()) { Color color = tempColor.set(getColor()); color.a *= parentAlpha; if (style.fontColor != null) color.mul(style.fontColor); batch.setColor(color); underline.draw(batch, getX(), getY(), getWidth(), 1); } }
public void draw (Batch batch, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation) { Color spriteColor = sprite.getColor(); temp.set(spriteColor); sprite.setColor(spriteColor.mul(batch.getColor())); sprite.setOrigin(originX, originY); sprite.setRotation(rotation); sprite.setScale(scaleX, scaleY); sprite.setBounds(x, y, width, height); sprite.draw(batch); sprite.setColor(temp); }
@Override public void draw(Batch batch, float parentAlpha) { batch.setColor(tmpColor.set(getColor()).mul(1f,1f,1f,parentAlpha)); if (horizontal) { // Horizontal line drawable.draw(batch, getX()-thickness*0.5f, getY()-thickness*0.5f, getWidth()+thickness, thickness); } else { // Vertical line drawable.draw(batch, getX()-thickness*0.5f, getY()-thickness*0.5f, thickness, getHeight()+thickness); } }