https://www.reddit.com/r/Anki/comments/1t1qpzm/does_drawing_picture_instead_of_adding_the_image/
We save the Whiteboard as JPG with quality 95.
|
private fun saveWhiteboard(view: WhiteboardView): Uri { |
|
val bitmap = createBitmap(view.width, view.height) |
|
val canvas = Canvas(bitmap) |
|
|
|
val backgroundColor = |
|
if (Themes.isNightTheme) { |
|
Color.BLACK |
|
} else { |
|
Color.WHITE |
|
} |
|
canvas.drawColor(backgroundColor) |
|
|
|
view.draw(canvas) |
|
|
|
val baseFileName = "Whiteboard" + getTimestamp(TimeManager.time) |
|
return CompatHelper.compat.saveImage(requireContext(), bitmap, baseFileName, "jpg", Bitmap.CompressFormat.JPEG, 95) |
|
} |
- Determine the output file we want
- I suspect we should generate a SVG, since the file should be moved to
collection.media
https://www.reddit.com/r/Anki/comments/1t1qpzm/does_drawing_picture_instead_of_adding_the_image/
We save the Whiteboard as JPG with quality 95.
Anki-Android/AnkiDroid/src/main/java/com/ichi2/anki/DrawingFragment.kt
Lines 83 to 99 in 0498bdf
collection.media