Mercurial > hg > forks > multipaint-js
diff exporters.pde @ 175:3ddf4d799fe6
Get rid of globals g_omag, g_bordh and g_bordv which set PNG/JPEG image
magnification factor (default 1) and horiz/vert border sizes (64/32).
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 23 Aug 2018 12:38:52 +0300 |
parents | e77a726a587e |
children | 934934bb1fbb |
line wrap: on
line diff
--- a/exporters.pde Thu Aug 23 11:32:38 2018 +0300 +++ b/exporters.pde Thu Aug 23 12:38:52 2018 +0300 @@ -1260,7 +1260,7 @@ } -void mpRenderToImageAt(PImage output, int xoffs, int yoffs) +void mpRenderToImageAt(PImage output, int xoffs, int yoffs, int omag) { if (output == null) return; @@ -1287,35 +1287,35 @@ color c = color(g_r[f], g_g[f], g_b[f]); - for (int vertti = 0; vertti <= g_omag; vertti++) - for (int mortti = 0; mortti <= g_omag; mortti++) + for (int vertti = 0; vertti <= omag; vertti++) + for (int mortti = 0; mortti <= omag; mortti++) { output.set( - xx * g_omag + xoffs + mortti, - yy * g_omag + yoffs + vertti, + xx * omag + xoffs + mortti, + yy * omag + yoffs + vertti, c); } } } -PImage mpRenderImage(boolean border) +PImage mpRenderImage(boolean border, int bordh, int bordv, int omag) { PImage output; if (border) { pimage = createImage( - X * g_omag + g_bordh * g_omag, - Y * g_omag + g_bordv * g_omag, + (X + bordh) * omag, + (Y + bordv) * omag, RGB); - mpRenderToImageAt(output, int((g_bordh * g_omag) / 2), int((g_bordv * g_omag) / 2)); + mpRenderToImageAt(output, int((bordh * omag) / 2), int((bordv * omag) / 2), omag); } else { - output = createImage(X * g_omag, Y * g_omag, RGB); - mpRenderToImageAt(output, 0, 0); + output = createImage(X * omag, Y * omag, RGB); + mpRenderToImageAt(output, 0, 0, omag); } return output;