mirror of
				https://github.com/SimpleMobileTools/Simple-Draw.git
				synced 2025-06-05 21:59:17 +02:00 
			
		
		
		
	rescan svg file afer creation
This commit is contained in:
		| @@ -8,7 +8,6 @@ import java.io.* | ||||
| import java.util.* | ||||
|  | ||||
| object Svg { | ||||
|     @Throws(Exception::class) | ||||
|     fun saveSvg(output: File, canvas: MyCanvas) { | ||||
|         val backgroundColor = (canvas.background as ColorDrawable).color | ||||
|  | ||||
| @@ -18,7 +17,6 @@ object Svg { | ||||
|         writer.close() | ||||
|     } | ||||
|  | ||||
|     @Throws(IOException::class) | ||||
|     private fun writeSvg(writer: Writer, backgroundColor: Int, paths: Map<MyPath, PaintOptions>, width: Int, height: Int) { | ||||
|         writer.write("<svg width=\"") | ||||
|         writer.write(width.toString()) | ||||
| @@ -41,7 +39,6 @@ object Svg { | ||||
|         writer.write("</svg>") | ||||
|     } | ||||
|  | ||||
|     @Throws(IOException::class) | ||||
|     private fun writePath(writer: Writer, path: MyPath, options: PaintOptions) { | ||||
|         writer.write("<path d=\"") | ||||
|         for (action in path.getActions()) { | ||||
| @@ -56,7 +53,6 @@ object Svg { | ||||
|         writer.write("\" stroke-linecap=\"round\"/>") | ||||
|     } | ||||
|  | ||||
|     @Throws(Exception::class) | ||||
|     fun loadSvg(file: File, canvas: MyCanvas) { | ||||
|         val svg = parseSvg(file) | ||||
|  | ||||
| @@ -72,7 +68,6 @@ object Svg { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Throws(Exception::class) | ||||
|     private fun parseSvg(file: File): SSvg { | ||||
|         var inputStream: InputStream? = null | ||||
|         val svg = SSvg() | ||||
|   | ||||
| @@ -80,7 +80,6 @@ class SaveImageDialog(val activity: SimpleActivity, val curPath: String, val can | ||||
|                 try { | ||||
|                     out = FileOutputStream(file) | ||||
|                     canvas.getBitmap().compress(Bitmap.CompressFormat.PNG, 100, out) | ||||
|                     activity.scanFile(file) {} | ||||
|                 } catch (e: Exception) { | ||||
|                     return false | ||||
|                 } finally { | ||||
| @@ -89,6 +88,7 @@ class SaveImageDialog(val activity: SimpleActivity, val curPath: String, val can | ||||
|             } | ||||
|             SVG -> Svg.saveSvg(file, canvas) | ||||
|         } | ||||
|         activity.scanFile(file) {} | ||||
|         return true | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user