magoアプリのブログ

詰まった時に更新します。とりあえずはAndroidアプリをやろう。

全体表示

[ リスト ]

【Android】drawBitmapから2種類

android.graphics.CanvasのdrawBitmapについて

drawBitmapは6つあって
・drawBitmap(int[] colors, int offset, int stride, float x, float y, int width, int height, boolean hasAlpha, Paint paint)
・drawBitmap(Bitmap bitmap, Matrix matrix, Paint paint)
・drawBitmap(int[] colors, int offset, int stride, int x, int y, int width, int height, boolean hasAlpha, Paint paint)
・drawBitmap(Bitmap bitmap, Rect src, RectF dst, Paint paint)
・drawBitmap(Bitmap bitmap, float left, float top, Paint paint)
・drawBitmap(Bitmap bitmap, Rect src, Rect dst, Paint paint)
がある。


今のところ使っているのは5番目と6番目なので、使い方をメモします。

・drawBitmap(Bitmap bitmap, float left, float top, Paint paint)について
イメージ 2

bitmapをそのまま描画する。引数には左上の座標を指定する。
簡単だが、拡大縮小できない。


・drawBitmap(Bitmap bitmap, Rect src, Rect dst, Paint paint)について
イメージ 1

bitmapの指定した部分を切り出して、指定した大きさに拡大縮小する。

※Rectクラスは左上の座標と、右下の座標を指定する。
        ↑Rect(int left, int top, int right, int bottom)
Rectの大きさが固定の場合は
Rect.offsetTo(int newLeft, int newTop)を使ってRectを平行移動させると、
画像を多く貼り付けるときに便利。

閉じる コメント(0) ※投稿されたコメントはブログ開設者の承認後に公開されます。

コメント投稿
名前パスワードブログ
投稿

閉じる トラックバック(0) ※トラックバックはブログ開設者の承認後に公開されます。

トラックバックされた記事

トラックバックされている記事がありません。

トラックバック先の記事

  • トラックバック先の記事がありません。


.

magoアプリ
人気度

ヘルプ

Yahoo Image

  今日 全体
訪問者 1 891
ブログリンク 0 0
コメント 0 0
トラックバック 0 0

ケータイで見る

モバイル版Yahoo!ブログにアクセス!

モバイル版Yahoo!ブログにアクセス!

URLをケータイに送信
(Yahoo! JAPAN IDでのログインが必要です)

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

標準グループ

登録されていません

開設日: 2011/10/20(木)

注目の情報
男35歳、年収400万円台で買う!

「もう通勤がつらいのは嫌だ:夫」そして、「きれいなキッチン!広々リビング!:妻」そんな夫婦のワガママを叶えるマンション、実は…あるんです。乗り換えなしで直通通勤。SUUMO
通勤ラクラク新築マンションは…


プライバシーポリシー -  利用規約 -  ガイドライン -  順守事項 -  ヘルプ・お問い合わせ

Copyright (C) 2012 Yahoo Japan Corporation. All Rights Reserved.