Mercurial > hg > forks > multipaint-js
comparison events.pde @ 202:06d3840b15ae
Implement PNG export, via Ctrl + click on (format) export icon.
It is a bit difficult to trigger, though. Will have to explore better
ways later.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 29 Aug 2018 14:10:11 +0300 |
parents | 475a6ab70cd1 |
children | c4a17bf7b4de |
comparison
equal
deleted
inserted
replaced
201:823672f83ae9 | 202:06d3840b15ae |
---|---|
953 message("SAVED"); | 953 message("SAVED"); |
954 else | 954 else |
955 message("ERROR!"); | 955 message("ERROR!"); |
956 } | 956 } |
957 | 957 |
958 if (g_data[int('E')] == 1) { | 958 if (g_data[int('E')] == 1) |
959 { | |
959 g_data[int('E')] = 0; | 960 g_data[int('E')] = 0; |
960 | 961 |
961 // message("Export SRC|is disabled"); | 962 // message("Export SRC|is disabled"); |
962 | 963 |
963 message("Source|export"); | 964 message("Source|export"); |
1004 } | 1005 } |
1005 | 1006 |
1006 if (g_data[int('W')] == 1) | 1007 if (g_data[int('W')] == 1) |
1007 { | 1008 { |
1008 g_data[int('W')] = 0; | 1009 g_data[int('W')] = 0; |
1009 if (g_formatext != "") { | 1010 |
1011 if (g_control) | |
1012 { | |
1013 message("PNG|export"); | |
1014 | |
1015 String fname = filename +"_"+ (g_spare ? "spare" : "main") +".png"; | |
1016 PImage simg = mpRenderImage(true, 64, 32, 1); | |
1017 | |
1018 if (simg !== null) | |
1019 { | |
1020 simg.sourceImg.toBlob(function(idata){ mpSaveBinaryBlob(fname, idata); }, "image/png", 0.95); | |
1021 } | |
1022 } | |
1023 else | |
1024 if (g_formatext != "") | |
1025 { | |
1010 message("Format|export"); | 1026 message("Format|export"); |
1011 | 1027 |
1012 String fname = filename +"_"+ (g_spare ? "spare" : "main") +"."+ g_formatext; | 1028 String fname = filename +"_"+ (g_spare ? "spare" : "main") +"."+ g_formatext; |
1013 MPWriteCtx ctx = new MPWriteCtx(); | 1029 MPWriteCtx ctx = new MPWriteCtx(); |
1014 | 1030 |