android - What is "Bitmap source" in createBitmap() parameters? -


i'm following this s.o. post how crop image using bitmap.

as confirmed in android documentation, there method createbitmap() has following parameters:

createbitmap(bitmap source, int x, int y, int width, int height) 

but don't understand bitmap source needs be. believe must refer image wish use bitmap object. image wish use stored drawable named rainbow, tried following:

    bitmap cropedbitmap = bitmap.createbitmap(r.id.rainbow, 0, 0, 300, 300); 

in case android studio reports "cannot resolve symbol 'rainbow'

i tried:

      bitmap cropedbitmap = bitmap.createbitmap(r.drawable.rainbow, 0, 0, 300, 300); 

and android studio reports "cannot resolve method createbitmap(int, int, int, int, int)

i see documentation first parameter bitmap. wouldn't using bitmap create bitmap? don't see constructors bitmap class on documentation page.

any suggestions on i'm missing or try next?

if want crop out piece of bitmap can load piece directly resource ram bitmapfactory.options quite common when animate things in games , images out of bigger sprite


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -