Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- Bootstrap
- 웹 서비스
- TextBox
- MS-SQL
- 자바스크립트
- varags
- MANTIS
- WebView
- Redirect
- 자바
- asp.net
- Web Service
- html
- 안드로이드
- Android
- 이클립스
- 웹뷰
- Maven
- Eclipse
- MSsql
- scrollView
- STS
- Java
- decompiler
- javascript
- jsp
- C#
- 컬럼명
- SpringSource Tool Suite
- Apache Lucene
Archives
- Today
- Total
bboks.net™
이미지 flip 시키기 본문
1. 플립 메소드
public static final int FLIP_VERTICAL = 1;
public static final int FLIP_HORIZONTAL = 2;
private Bitmap flipImage(Bitmap src, int type) {
// create new matrix for transformation
Matrix matrix = new Matrix();
// if vertical
if (type == FLIP_VERTICAL) {
// y = y * -1
matrix.preScale(1.0f, -1.0f);
}
// if horizonal
else if (type == FLIP_HORIZONTAL) {
// x = x * -1
matrix.preScale(-1.0f, 1.0f);
// unknown type
} else {
return null;
}
// return transformed image
return Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(),
matrix, true);
}
2. 이미지 플립 시키미(호출쪽)
ImageView imgView = (ImageView) findViewById(R.id.imageView); imgView.setImageBitmap(flipImage(BitmapFactory.decodeResource(getResources(), R.drawable.img), FLIP_VERTICAL );