java - How to obtain the current bitmap of a canvas? -


i want current bitmap associated canvas can perform operations on it. can't see how though.

i've seen examples create bitmap , set canvas use bitmap, can access later, i'm using canvas returned surfaceholder there's no constructor.

for instance, examples show kind of thing:

bitmap bmp = bitmap.createbitmap(xxx, yyy, bitmap.config.argb_8888); canvas c = new canvas(bmp); 
  • so @ point can see bmp.

in case, canvas obtained by:

final surfaceholder holder = getsurfaceholder();      canvas c = null;     try {         c = holder.lockcanvas(); 

so how can bitmap c?

edit @reuben - may right, did wonder this. in short, aim capture current canvas contents have drawn "stuff", , make copy of it, reversed, put underneath. reflection. example of found performed via bitmaps, assumed needed somehow capture current canvas bitmap use it. if there better way can this, i'm ears!

better late never :)

bitmapdrawable bitdrawable = new bitmapdrawable(); bitmapdrawable.draw(videoview.getholder().lockcanvas()); 

you can access bitmap bitmapdrawable.

in case did this:

imageview.setimagebitmap(bitmapdrawable.getbitmap());


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -