本文整理匯總了Java中android.graphics.Paint.getAlpha方法的典型用法代碼示例。如果您正苦於以下問題:Java Paint.getAlpha方法的具體用法?Java Paint.getAlpha怎麽用?Java Paint.getAlpha使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.graphics.Paint
的用法示例。
在下文中一共展示了Paint.getAlpha方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: StatusbarBattery
import android.graphics.Paint; //導入方法依賴的package包/類
public StatusbarBattery(View batteryView) {
mBattery = batteryView;
createHooks();
try {
Object drawable = getDrawable();
final int[] colors = (int[]) XposedHelpers.getObjectField(drawable, "mColors");
mDefaultColor = colors[colors.length - 1];
if (Utils.isLineageOs()) {
Drawable frameDrawable = (Drawable) XposedHelpers.getObjectField(drawable, "mFrameDrawable");
// mDefaultFrameColor = frameDrawable.setTint();
mFrameAlpha = frameDrawable.getAlpha();
} else {
final Paint framePaint = (Paint) XposedHelpers.getObjectField(drawable, "mFramePaint");
mDefaultFrameColor = framePaint.getColor();
mFrameAlpha = framePaint.getAlpha();
}
mDefaultChargeColor = XposedHelpers.getIntField(drawable, "mChargeColor");
} catch (Throwable t) {
log("Error backing up original colors: " + t.getMessage());
}
if (SysUiManagers.IconManager != null) {
SysUiManagers.IconManager.registerListener(this);
}
}
示例2: setTransparentCircleColor
import android.graphics.Paint; //導入方法依賴的package包/類
/**
* Sets the color the transparent-circle should have.
*
* @param color
*/
public void setTransparentCircleColor(int color) {
Paint p = ((PieChartRenderer) mRenderer).getPaintTransparentCircle();
int alpha = p.getAlpha();
p.setColor(color);
p.setAlpha(alpha);
}
示例3: draw
import android.graphics.Paint; //導入方法依賴的package包/類
public int draw(BaseDanmaku danmaku) {
float top = danmaku.getTop();
float left = danmaku.getLeft();
if (this.canvas == null) {
return 0;
}
Paint alphaPaint = null;
boolean needRestore = false;
if (danmaku.getType() == 7) {
if (danmaku.getAlpha() == AlphaValue.TRANSPARENT) {
return 0;
}
if (!(danmaku.rotationZ == 0.0f && danmaku.rotationY == 0.0f)) {
saveCanvas(danmaku, this.canvas, left, top);
needRestore = true;
}
if (danmaku.getAlpha() != AlphaValue.MAX) {
alphaPaint = this.ALPHA_PAINT;
alphaPaint.setAlpha(danmaku.getAlpha());
}
}
if (alphaPaint != null && alphaPaint.getAlpha() == AlphaValue.TRANSPARENT) {
return 0;
}
boolean cacheDrawn = false;
int result = 1;
if (danmaku.hasDrawingCache() && danmaku.cache != null) {
DrawingCacheHolder holder = ((DrawingCache) danmaku.cache).get();
if (holder != null) {
cacheDrawn = holder.draw(this.canvas, left, top, alphaPaint);
}
}
if (!cacheDrawn) {
if (alphaPaint != null) {
this.PAINT.setAlpha(alphaPaint.getAlpha());
} else {
resetPaintAlpha(this.PAINT);
}
drawDanmaku(danmaku, this.canvas, left, top, false);
result = 2;
}
if (danmaku.isClickZan) {
this.sStuffer.drawClickBg(danmaku, this.canvas, left, top);
}
if (needRestore) {
restoreCanvas(this.canvas);
}
return result;
}
示例4: resetPaintAlpha
import android.graphics.Paint; //導入方法依賴的package包/類
private void resetPaintAlpha(Paint paint) {
if (paint.getAlpha() != AlphaValue.MAX) {
paint.setAlpha(AlphaValue.MAX);
}
}
示例5: draw
import android.graphics.Paint; //導入方法依賴的package包/類
@Override
public int draw(BaseDanmaku danmaku) {
float top = danmaku.getTop();
float left = danmaku.getLeft();
if (canvas != null) {
Paint alphaPaint = null;
boolean needRestore = false;
if (danmaku.getType() == BaseDanmaku.TYPE_SPECIAL) {
if (danmaku.getAlpha() == AlphaValue.TRANSPARENT) {
return IRenderer.NOTHING_RENDERING;
}
if (danmaku.rotationZ != 0 || danmaku.rotationY != 0) {
saveCanvas(danmaku, canvas, left, top);
needRestore = true;
}
int alpha = danmaku.getAlpha();
if (alpha != AlphaValue.MAX) {
alphaPaint = ALPHA_PAINT;
alphaPaint.setAlpha(danmaku.getAlpha());
}
}
// skip drawing when danmaku is transparent
if (alphaPaint != null && alphaPaint.getAlpha() == AlphaValue.TRANSPARENT) {
return IRenderer.NOTHING_RENDERING;
}
// drawing cache
boolean cacheDrawn = false;
int result = IRenderer.CACHE_RENDERING;
if (danmaku.hasDrawingCache()) {
DrawingCacheHolder holder = ((DrawingCache) danmaku.cache).get();
if (holder != null) {
cacheDrawn = holder.draw(canvas, left, top, alphaPaint);
}
}
if (!cacheDrawn) {
if (alphaPaint != null) {
PAINT.setAlpha(alphaPaint.getAlpha());
} else {
resetPaintAlpha(PAINT);
}
drawDanmaku(danmaku, canvas, left, top, false);
result = IRenderer.TEXT_RENDERING;
}
if (needRestore) {
restoreCanvas(canvas);
}
return result;
}
return IRenderer.NOTHING_RENDERING;
}