DrawableView icon indicating copy to clipboard operation
DrawableView copied to clipboard

support importing a background to canvas

Open omidaminiva opened this issue 9 years ago • 10 comments

Is there any way to support importing a background to canvas. I tried to put an imageview behind deawableview and then get both bitmaps and overlay each other. How ever problem happens when image and canvas of drawableview are bigger than screen.

omidaminiva avatar Apr 02 '15 14:04 omidaminiva

At this time you can use "drawableView.setBackground..." But I don't think is a good idea because at each draw will re-paint the background + gestures. I will think on that.

PaNaVTEC avatar Apr 03 '15 09:04 PaNaVTEC

yes I agree it is not a good idea since you cannot choose the scaletype for background. I will look forward to see this feature on this library.

omidaminiva avatar Apr 04 '15 13:04 omidaminiva

In the develop branch you can set background color and border color for canvas. I will look for a better solution for draw a bitmap.

PaNaVTEC avatar Apr 05 '15 20:04 PaNaVTEC

I tried the bg color and border and it works great.

omidaminiva avatar Apr 07 '15 12:04 omidaminiva

Nice. When it will stable release?

jongha avatar Nov 01 '15 17:11 jongha

did this ever get done ?

amigax avatar Sep 26 '17 18:09 amigax

As I was saying previously, nothing stops you to do: drawableView.setBackground...

The optimization for that never got implemented, feel free to submit PRs with a better implementation, I will gladly take a look and merge it :+1:

PaNaVTEC avatar Sep 26 '17 21:09 PaNaVTEC

Thanks I managed to hack a solution together, will make it more elegant. But basically it involves painting a bitmap and scaling it up to the canvas size, it runs fast if the bitmap is not huge :) Great lib btw, thank you for your hard work.

amigax avatar Sep 26 '17 21:09 amigax

Actually I really cannot understand why the background is getting scaled each time even when it is in a different view behind this one. Real shame.

amigax avatar Sep 27 '17 09:09 amigax

I tried the bg color and border and it works great.

@omidaminiva, could you, please, inform how did you achieve that?

I tried using the develop-branch methods, however, I couldn't achieve that not even by setting the background programatically as it gets the color, but when I save the image into the gallery, it gets a black background as if it's transparent and whether I set the background from the layout it gets over the drawing stroke.

I might be overlooking something, so any help would be appreciated.

JorgeAmVF avatar Dec 14 '18 06:12 JorgeAmVF