亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Java實(shí)現(xiàn)圖片倒影的源碼實(shí)例內(nèi)容

 更新時(shí)間:2019年09月03日 16:26:33   作者:anemone27  
在本篇文章里小編給大家整理的是關(guān)于Java實(shí)現(xiàn)圖片倒影的源碼以及相關(guān)知識(shí)點(diǎn),有需要的朋友們學(xué)習(xí)下。

把做工程過程常用的一些代碼段做個(gè)記錄,下面代碼是關(guān)于Java實(shí)現(xiàn)圖片倒影的的代碼,應(yīng)該對(duì)大家有較大用處。

 

public class ButtonImageActivity extends Activity {
private ImageView image_btn;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
image_btn=(ImageView)findViewById(R.id.image_btn);
Bitmap bitmap =((BitmapDrawable)getResources().getDrawable(R.drawable.image_btn)).getBitmap();
image_btn.setImageBitmap(createReflectedImage(bitmap));
image_btn.setOnClickListener(new OnClickListener() {

public void onClick(View v) {

}
});
}
private Bitmap createReflectedImage(Bitmap originalBitmap) { 
final int reflectionGap = 4; 

int width = originalBitmap.getWidth(); 
int height = originalBitmap.getHeight(); 

Matrix matrix = new Matrix(); 
matrix.preScale(1, -1); 
Bitmap reflectionBitmap = Bitmap.createBitmap(originalBitmap, 0, 
height / 2, width, height / 2, matrix, false); 
Bitmap withReflectionBitmap = Bitmap.createBitmap(width, (height 
+ height / 2 + reflectionGap), Config.ARGB_8888); 

Canvas canvas = new Canvas(withReflectionBitmap); 
canvas.drawBitmap(originalBitmap, 0, 0, null); 

Paint defaultPaint = new Paint(); 
canvas.drawRect(0, height, width, height + reflectionGap, defaultPaint); 

canvas.drawBitmap(reflectionBitmap, 0, height + reflectionGap, null); 

Paint paint = new Paint(); 
LinearGradient shader = new LinearGradient(0, originalBitmap.getHeight(), 
0, withReflectionBitmap.getHeight(), 0x70ffffff, 0x00ffffff, 
TileMode.MIRROR); 
paint.setShader(shader); 
paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN)); 

canvas.drawRect(0, height, width, withReflectionBitmap.getHeight(), paint); 

return withReflectionBitmap; 
} 
} 

以上就是本次介紹的全部知識(shí)點(diǎn)內(nèi)容,感謝大家對(duì)腳本之家的支持。

相關(guān)文章

  • Spring boot打包jar分離lib和resources方法實(shí)例

    Spring boot打包jar分離lib和resources方法實(shí)例

    這篇文章主要介紹了Spring boot打包jar分離lib和resources方法實(shí)例,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-05-05
  • 執(zhí)行java請(qǐng)求時(shí)導(dǎo)致在腳本執(zhí)行結(jié)束時(shí)JVM無法退出

    執(zhí)行java請(qǐng)求時(shí)導(dǎo)致在腳本執(zhí)行結(jié)束時(shí)JVM無法退出

    這篇文章主要介紹了執(zhí)行java請(qǐng)求,導(dǎo)致在腳本執(zhí)行結(jié)束時(shí)JVM無法退出問題,本文通過原因分析給出解決方案,需要的朋友可以參考下
    2020-02-02
  • 使用原生JDBC動(dòng)態(tài)解析并獲取表格列名和數(shù)據(jù)的方法

    使用原生JDBC動(dòng)態(tài)解析并獲取表格列名和數(shù)據(jù)的方法

    這篇文章主要介紹了使用原生JDBC動(dòng)態(tài)解析并獲取表格列名和數(shù)據(jù),本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-08-08
  • 最新評(píng)論