Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add image to Canvas to Sketch on and Save #7

Open
GitHubDroid opened this issue Oct 18, 2013 · 2 comments
Open

Add image to Canvas to Sketch on and Save #7

GitHubDroid opened this issue Oct 18, 2013 · 2 comments

Comments

@GitHubDroid
Copy link

How could I go about adding an image from a specific location on sdcard to the canvas and use that as the background to sketch on and be able to save the image with background and markups to a specified folder?

Would this be possible ? Any help would be greatly appreciated. Thanks in advance.

@GitHubDroid
Copy link
Author

?

@mattmarchany
Copy link
Owner

Hey! Sorry for the late reply - I haven't been on here in awhile. I haven't yet researched how to add that functionality but it's definitely possible. If I have time to look through the Android Reference pages in detail (http://developer.android.com/reference/packages.html) but I'll let you know what I find.

I did look around quickly and it looks like if you're able to add a method in DrawView for importing an image:

public MyImageView(Context context) {
this(context, null, 0);
mImage = getResources().getDrawable(R.drawable.imagename);
}

Then in the OnDraw method (where the background currently defaults to white) you can draw the image on the canvas:

mImage.draw(canvas);

Of course you'll have to link that to a menu item in MainActivity that fires off the image retrieval. I'm not sure if there's more involved than that but more details and a full implementation are here: http://stackoverflow.com/questions/5743328/image-in-canvas-with-touch-events

I'll try to get to implementing this soon but if you beat me to it let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants