Home Forum
Welcome, Guest
Username Password: Remember me

How to use Canvas.DrawBitMap with clipping
(1 viewing) (1) Guest
Discussion related to creating Android software
  • Page:
  • 1

TOPIC: How to use Canvas.DrawBitMap with clipping

How to use Canvas.DrawBitMap with clipping 3 years, 1 month ago #145

Say I have a bitmap measuring 100x100 and want to show just the top left, ie 50x50. I don't want it resized, just clipped.

Rect r = new Rect(100, 150, 100, 150);
canvas.drawBitmap(bitmap, null, r, paint);
 


Still resizes the bitmap, i.e. distorts the 100 to squeeze into the 50. That's useful in other cases but not here, I just want to clip the top area. Anyone know please?
Last Edit: 3 years, 1 month ago by bill.damage.
  • Page:
  • 1
Time to create page: 0.22 seconds
Copyright © 2012 Android Academy. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.
 
Glossary
We have 32 guests online