android - Canvas drawCircle behind an existing image -


please me figure i'm doing wrong. have draw circle behind image (given bitmap) different color based on app logic, using following code.

        bitmap workingbitmap = bitmap.createbitmap(bitmap);         bitmap mutablebitmap = workingbitmap.copy(bitmap.config.argb_8888, true);          canvas canvas = new canvas(mutablebitmap);          paint paint = new paint();         paint.setantialias(true);         paint.setcolor(color.blue);         paint.setstyle(paint.style.fill_and_stroke);          int horizontalpadding = (iconsize - drawingwidth) / 2;         int verticalpadding = (iconsize - drawingheight) / 2;          canvas.drawcircle(120, 120, 100, paint);         return mutablebitmap; 

what i'm getting circle above image, covers image, how tell code image has upper layer.

thanks

in code use mutablebitmap canvas , draw circle on it. if want draw image above circle should draw after drawing circle. code:

    bitmap workingbitmap = bitmap.createbitmap(bitmap);     bitmap mutablebitmap = workingbitmap.copy(bitmap.config.argb_8888, true);     // create empty bitmap     bitmap output = bitmap.createbitmap(mutablebitmap.getwidth(), mutablebitmap.getheight(),              mutablebitmap.getconfig());     // use empty bitmap canvas     canvas canvas = new canvas(output);      paint paint = new paint();     paint.setantialias(true);     paint.setcolor(color.blue);     paint.setstyle(paint.style.fill_and_stroke);      int horizontalpadding = (iconsize - drawingwidth) / 2;     int verticalpadding = (iconsize - drawingheight) / 2;      canvas.drawcircle(120, 120, 100, paint);     // , draw image above circle     canvas.drawbitmap(mutablebitmap, 0, 0, null);     return output; 

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -