本文整理匯總了Java中android.graphics.PixelFormat.OPAQUE屬性的典型用法代碼示例。如果您正苦於以下問題:Java PixelFormat.OPAQUE屬性的具體用法?Java PixelFormat.OPAQUE怎麽用?Java PixelFormat.OPAQUE使用的例子?那麽恭喜您, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.graphics.PixelFormat的用法示例。
在下文中一共展示了PixelFormat.OPAQUE屬性的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。
示例1: drawableToBitmap
點讚 3
/**
* 將Drawable轉化為Bitmap .
* @author liulongzhenhai 2012-8-1 下午5:24:10
* @param drawable 圖片對象
* @return 圖片
*/
public static Bitmap drawableToBitmap(final Drawable drawable) {
// 取 drawable 的長寬
final int w = drawable.getIntrinsicWidth();
final int h = drawable.getIntrinsicHeight();
// 取 drawable 的顏色格式
final Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888
: Bitmap.Config.RGB_565;
// 建立對應 bitmap
final Bitmap bitmap = Bitmap.createBitmap(w, h, config);
// 建立對應 bitmap 的畫布
final Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, w, h);
// 把 drawable 內容畫到畫布中
drawable.draw(canvas);
return bitmap;
}
開發者ID:VK2012,項目名稱:AppCommonFrame,代碼行數:22,
示例2: drawable2Bitmap
點讚 3
private static Bitmap drawable2Bitmap(Drawable drawable) {
if (drawable == null) {
return null;
}
// 取 drawable 的長寬
int w = drawable.getIntrinsicWidth();
int h = drawable.getIntrinsicHeight();
// 取 drawable 的顏色格式
Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888
: Bitmap.Config.RGB_565;
// 建立對應 bitmap
Bitmap bitmap = Bitmap.createBitmap(w, h, config);
// 建立對應 bitmap 的畫布
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, w, h);
// 把 drawable 內容畫到畫布中
drawable.draw(canvas);
return bitmap;
}
開發者ID:joelan,項目名稱:ClouldReader,代碼行數:19,
示例3: drawable2Bitmap
點讚 3
private static Bitmap drawable2Bitmap(Drawable drawable) {
if (drawable == null) {
return null;
}
// 取 drawable 的長寬
int w = drawable.getIntrinsicWidth();
int h = drawable.getIntrinsicHeight();
// 取 drawable 的顏色格式
Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888
: Bitmap.Config.RGB_565;
// 建立對應 bitmap
Bitmap bitmap = Bitmap.createBitmap(w, h, config);
// 建立對應 bitmap 的畫布
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, w, h);
// 把 drawable 內容畫到畫布中
drawable.draw(canvas);
return bitmap;
}
開發者ID:wp521,項目名稱:MyFire,代碼行數:19,
示例4: drawable2Bitmap
點讚 3
private static Bitmap drawable2Bitmap(Drawable drawable) {
if (drawable == null) {
return null;
}
// 取 drawable 的長寬
int w = drawable.getIntrinsicWidth();
int h = drawable.getIntrinsicHeight();
// 取 drawable 的顏色格式
Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE
? Bitmap.Config.ARGB_8888
: Bitmap.Config.RGB_565;
// 建立對應 bitmap
Bitmap bitmap = Bitmap.createBitmap(w, h, config);
// 建立對應 bitmap 的畫布
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, w, h);
// 把 drawable 內容畫到畫布中
drawable.draw(canvas);
return bitmap;
}
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:20,
示例5: drawable2Bitmap
點讚 3
private static Bitmap drawable2Bitmap(Drawable drawable) {
if (drawable == null) {
return null;
}
// 取 drawable 的長寬
int w = drawable.getIntrinsicWidth();
int h = drawable.getIntrinsicHeight();
// 取 drawable 的顏色格式
Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565;
// 建立對應 bitmap
Bitmap bitmap = Bitmap.createBitmap(w, h, config);
// 建立對應 bitmap 的畫布
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, w, h);
// 把 drawable 內容畫到畫布中
drawable.draw(canvas);
return bitmap;
}
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:18,
示例6: drawable2Bitmap
點讚 3
private static Bitmap drawable2Bitmap(Drawable drawable) {
if (drawable == null) {
return null;
}
int w = drawable.getIntrinsicWidth();
int h = drawable.getIntrinsicHeight();
Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888
: Bitmap.Config.RGB_565;
Bitmap bitmap = Bitmap.createBitmap(w, h, config);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, w, h);
drawable.draw(canvas);
return bitmap;
}
開發者ID:zhou-you,項目名稱:RxEasyHttp,代碼行數:19,
示例7: getBitmapFromDrawable
點讚 3
/**
* 將Drawable轉化為Bitmap
*
* @param drawable Drawable
* @return Bitmap
*/
public static Bitmap getBitmapFromDrawable(Drawable drawable) {
if (drawable == null) {
return null;
}
// 取 drawable 的長寬
int w = drawable.getIntrinsicWidth();
int h = drawable.getIntrinsicHeight();
// 取 drawable 的顏色格式
Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888
: Bitmap.Config.RGB_565;
// 建立對應 bitmap
Bitmap bitmap = Bitmap.createBitmap(w, h, config);
// 建立對應 bitmap 的畫布
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, w, h);
// 把 drawable 內容畫到畫布中
drawable.draw(canvas);
return bitmap;
}
開發者ID:youth5201314,項目名稱:XFrame,代碼行數:25,
示例8: hasOpaqueBackground
點讚 2
private static boolean hasOpaqueBackground(View v) {
final Drawable bg = v.getBackground();
if (bg != null) {
return bg.getOpacity() == PixelFormat.OPAQUE;
}
return false;
}
開發者ID:rogues-dev,項目名稱:superglue,代碼行數:7,
示例9: getOpacityFromColor
點讚 2
@Opacity
public static int getOpacityFromColor(int color) {
int colorAlpha = color >>> 24;
if (colorAlpha == 255) {
return PixelFormat.OPAQUE;
} else if (colorAlpha == 0) {
return PixelFormat.TRANSPARENT;
} else {
return PixelFormat.TRANSLUCENT;
}
}
開發者ID:weexext,項目名稱:ucar-weex-core,代碼行數:11,
示例10: drawableToBitmap
點讚 2
static Bitmap drawableToBitmap(Drawable drawable) // drawable 轉換成bitmap
{
int width = drawable.getIntrinsicWidth();// 取drawable的長寬
int height = drawable.getIntrinsicHeight();
Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565;// 取drawable的顏色格式
Bitmap bitmap = Bitmap.createBitmap(width, height, config);// 建立對應bitmap
Canvas canvas = new Canvas(bitmap);// 建立對應bitmap的畫布
drawable.setBounds(0, 0, width, height);
drawable.draw(canvas);// 把drawable內容畫到畫布中
return bitmap;
}
開發者ID:Justson,項目名稱:AgentWebX5,代碼行數:11,
示例11: getOpacity
點讚 2
@Override
public int getOpacity() {
return (mBitmap == null || mBitmap.hasAlpha() || mBitmapPaint.getAlpha() < 255)
? PixelFormat.TRANSLUCENT
: PixelFormat.OPAQUE;
}
開發者ID:sciage,項目名稱:FinalProject,代碼行數:6,
示例12: getOpacity
點讚 2
@Override
public int getOpacity() {
return PixelFormat.OPAQUE;
}
開發者ID:natario1,項目名稱:ViewPrinter,代碼行數:4,
示例13: setOverlayVideoMode
點讚 2
/**
* Enables/disables overlay video mode. Affects alpha blending on this view.
* @param enabled Whether to enter or leave overlay video mode.
*/
public void setOverlayVideoMode(boolean enabled) {
mCurrentPixelFormat = enabled ? PixelFormat.TRANSLUCENT : PixelFormat.OPAQUE;
getHolder().setFormat(mCurrentPixelFormat);
nativeSetOverlayVideoMode(mNativeCompositorView, enabled);
}
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:9,
示例14: getOpacity
點讚 1
@Override public int getOpacity() { return PixelFormat.OPAQUE; }
開發者ID:Fueled,項目名稱:snippety,代碼行數:1,
注:本文中的android.graphics.PixelFormat.OPAQUE屬性示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。