diff multipaint.pde @ 92:4161d798cb64

Clean up/refactor image (jpeg/png) importing a bit and rename function.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 06 Jul 2018 00:43:19 +0300
parents dffafe05d520
children aadcd5f7e9dc
line wrap: on
line diff
--- a/multipaint.pde	Fri Jul 06 00:42:06 2018 +0300
+++ b/multipaint.pde	Fri Jul 06 00:43:19 2018 +0300
@@ -324,8 +324,15 @@
 }
 
 
-void mpLoadPNGImage(String name)
+bool mpLoadPNGImage(String name)
 {
+    PImage simg = null;
+    if (simg == null)
+    {
+        message("Error 1");
+        return false;
+    }
+
     int lefth = g_farge;
     int righth = g_backg;
     storeparameters();
@@ -334,7 +341,11 @@
     g_data[int('t')] = 0;
     g_data[int('b')] = 1; //old IQ
 
-    import_image(name);
+    if (!mpImportFromImage(simg))
+    {
+        message("Error 2");
+        return false;
+    }
 
     restoreparameters();
     refreshpalette();
@@ -343,6 +354,7 @@
     message("Image|loaded");
     selectcolor(0, lefth);
     selectcolor(1, righth);
+    return true;
 }