Mercurial > hg > forks > multipaint-js
comparison files.pde @ 228:c9a77d87e380
Cleanup.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 05 Sep 2018 22:28:15 +0300 |
parents | 1c9deae71fb1 |
children |
comparison
equal
deleted
inserted
replaced
227:2d424d096281 | 228:c9a77d87e380 |
---|---|
156 | 156 |
157 return mpSaveBinaryBlob(name, blob); | 157 return mpSaveBinaryBlob(name, blob); |
158 } | 158 } |
159 | 159 |
160 | 160 |
161 // bordh/v = 64, 32, omag = 1 | 161 boolean mpImportAnyImage(PImage simg) |
162 void mpSavePNGImage(String name, int fmt, boolean border, int bordh, int bordv, int omag) | 162 { |
163 { | |
164 PImage simg = mpRenderImage(border, bordh, bordv, omag); | |
165 // if (g_data[int('Q')] == 0) | |
166 | |
167 if (simg !== null) | |
168 { | |
169 // XXX TODO .. actually save the image, something like .. | |
170 //simg.canvas.toBlob(function(idata){ mpSaveBinaryFile(name, idata); }, "image/png", 0.95); | |
171 } | |
172 } | |
173 | |
174 | |
175 int mpLoadPNGImage(String name) | |
176 { | |
177 PImage simg = null; | |
178 if (simg == null) | |
179 return -1; | |
180 | |
181 int lefth = g_farge; | 163 int lefth = g_farge; |
182 int righth = g_backg; | 164 int righth = g_backg; |
183 storeparameters(); | 165 storeparameters(); |
184 | 166 |
185 g_data[int('d')] = 0; | 167 g_data[int('d')] = 0; |
186 g_data[int('t')] = 0; | 168 g_data[int('t')] = 0; |
187 g_data[int('b')] = 1; //old IQ | 169 g_data[int('b')] = 1; //old IQ |
188 | 170 |
189 if (!mpImportFromImage(simg)) | 171 if (!mpImportFromImage(simg)) |
190 return -2; | 172 return false; |
191 | 173 |
192 restoreparameters(); | 174 restoreparameters(); |
193 refreshpalette(); | 175 refreshpalette(); |
194 refresh(); | 176 refresh(); |
195 g_boxreconstruct = 2; | 177 g_boxreconstruct = 2; |
196 selectcolor(0, lefth); | 178 selectcolor(0, lefth); |
197 selectcolor(1, righth); | 179 selectcolor(1, righth); |
198 return 0; | 180 return true; |
199 } | 181 } |
200 | 182 |
201 | 183 |
202 byte[] mpGetNativeImage() | 184 byte[] mpGetNativeImage() |
203 { | 185 { |