# HG changeset patch # User Matti Hamalainen # Date 1535017132 -10800 # Node ID 3ddf4d799fe63b7a11f105a03d057fea0ee20074 # Parent aa3d05b4dfa5d74c47ee0de678eb7570806f7325 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). diff -r aa3d05b4dfa5 -r 3ddf4d799fe6 exporters.pde --- 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; diff -r aa3d05b4dfa5 -r 3ddf4d799fe6 multipaint.pde --- a/multipaint.pde Thu Aug 23 11:32:38 2018 +0300 +++ b/multipaint.pde Thu Aug 23 12:38:52 2018 +0300 @@ -33,10 +33,9 @@ int machine = -1; // change this to autoselect int platform = PSJS; -int g_active, g_tooltrigger, g_prevtool; -int g_rband, g_rbang, g_boxreconstruct, g_charlimit; -int g_animx, g_animy, g_animframes, g_animno, g_animtime, g_animspeed; -int g_omag, g_bordh, g_bordv, g_keymacpos; +int g_active, g_tooltrigger, g_prevtool, g_rband, g_rbang, + g_boxreconstruct, g_charlimit, g_animx, g_animy, + g_animframes, g_animno, g_animtime, g_animspeed, g_keymacpos; int g_wheelup = int(':'), g_wheeldown = int(';'), g_middlebutton = int(','); boolean g_control = false, g_shift = false, g_dirty, g_inhibit_aspect = false; @@ -151,10 +150,6 @@ g_magpiy[121] = 8; g_magpiy[122] = 14; - g_omag = 1; - g_bordh = 64; - g_bordv = 32; - // Set up UI g_uizoom = 2; g_animspeed = 1; @@ -444,9 +439,10 @@ } -void mpSavePNGImage(String name, int fmt, boolean border) +// bordh/v = 64, 32, omag = 1 +void mpSavePNGImage(String name, int fmt, boolean border, int bordh, int bordv, int omag) { - PImage simg = mpRenderImage(border); + PImage simg = mpRenderImage(border, bordh, bordv, omag); // if (g_data[int('Q')] == 0) if (simg !== null)