f.effects.cc (fotoxx-23.0) | : | f.effects.cc (fotoxx-23.1) | ||
---|---|---|---|---|
/******************************************************************************* * | /******************************************************************************* * | |||
Fotoxx edit photos and manage collections | Fotoxx - edit photos and manage collections | |||
Copyright 2007-2023 Michael Cornelison | Copyright 2007-2023 Michael Cornelison | |||
source code URL: https://kornelix.net | source code URL: https://kornelix.net | |||
contact: mkornelix@gmail.com | contact: mkornelix@gmail.com | |||
This program is free software: you can redistribute it and/or modify | This program is free software: you can redistribute it and/or modify | |||
it under the terms of the GNU General Public License as published by | it under the terms of the GNU General Public License as published by | |||
the Free Software Foundation, either version 3 of the License, or | the Free Software Foundation, either version 3 of the License, or | |||
(at your option) any later version. See https://www.gnu.org/licenses | (at your option) any later version. See https://www.gnu.org/licenses | |||
skipping to change at line 71 | skipping to change at line 71 | |||
int algorithm = 1; // which algorithm to use | int algorithm = 1; // which algorithm to use | |||
uint8 fgrgb[3] = { 0, 0, 0 }; // foreground color (black) | uint8 fgrgb[3] = { 0, 0, 0 }; // foreground color (black) | |||
uint8 bgrgb[3] = { 255, 255, 255 }; // background color (white) | uint8 bgrgb[3] = { 255, 255, 255 }; // background color (white) | |||
int Eww, Ehh, cc; // image dimensions | int Eww, Ehh, cc; // image dimensions | |||
uint8 *britness; // maps pixel brightness 0-255 | uint8 *britness; // maps pixel brightness 0-255 | |||
uint8 *CLcont; // maps pixel color contrast 0-255 | uint8 *CLcont; // maps pixel color contrast 0-255 | |||
uint8 *monopix; // output pixel map 0-255 | uint8 *monopix; // output pixel map 0-255 | |||
uint8 *fclip; // output clipping flag 0/1 | uint8 *fclip; // output clipping flag 0/1 | |||
} | } | |||
void m_sketch(GtkWidget *, const char *menu) | void m_sketch(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace sketch_names; | using namespace sketch_names; | |||
int sketch_dialog_event(zdialog* zd, const char *event); | int sketch_dialog_event(zdialog* zd, ch *event); | |||
void * sketch_thread(void *); | void * sketch_thread(void *); | |||
int ii, px, py; | int ii, px, py; | |||
float *pix0, *pix1, *pix2, *pix3, *pix4; | float *pix0, *pix1, *pix2, *pix3, *pix4; | |||
float f1, f2; | float f1, f2; | |||
cchar *title = "Convert to Sketch"; | ch *title = "Convert to Sketch"; | |||
F1_help_topic = "sketch"; | F1_help_topic = "sketch"; | |||
Plog(1,"m_sketch \n"); | Plog(1,"m_sketch \n"); | |||
EFsketch.menuname = "Sketch"; | EFsketch.menuname = "Sketch"; | |||
EFsketch.menufunc = m_sketch; | EFsketch.menufunc = m_sketch; | |||
EFsketch.Farea = 2; // select area usable | EFsketch.Farea = 2; // select area usable | |||
EFsketch.Fscript = 1; // scripting supported | EFsketch.Fscript = 1; // scripting supported | |||
EFsketch.threadfunc = sketch_thread; // thread function | EFsketch.threadfunc = sketch_thread; // thread function | |||
skipping to change at line 103 | skipping to change at line 103 | |||
Eww = E3pxm->ww; | Eww = E3pxm->ww; | |||
Ehh = E3pxm->hh; | Ehh = E3pxm->hh; | |||
cc = Eww * Ehh; | cc = Eww * Ehh; | |||
britness = (uint8 *) zmalloc(cc,"sketch"); | britness = (uint8 *) zmalloc(cc,"sketch"); | |||
CLcont = (uint8 *) zmalloc(cc,"sketch"); | CLcont = (uint8 *) zmalloc(cc,"sketch"); | |||
monopix = (uint8 *) zmalloc(cc,"sketch"); | monopix = (uint8 *) zmalloc(cc,"sketch"); | |||
fclip = (uint8 *) zmalloc(cc,"sketch"); | fclip = (uint8 *) zmalloc(cc,"sketch"); | |||
for (py = 1; py < Ehh-1; py++) // precalculate pixel brightness | for (py = 1; py < Ehh-1; py++) // precalculate pixel brightness | |||
for (px = 1; px < Eww-1; px++) | for (px = 1; px < Eww-1; px++) | |||
{ | { | |||
pix0 = PXMpix(E1pxm,px,py); | pix0 = PXMpix(E1pxm,px,py); | |||
ii = py * Eww + px; | ii = py * Eww + px; | |||
britness[ii] = 0.333 * (pix0[0] + pix0[1] + pix0[2]); // brightness 0-255 (PIXBRIGHT() nodiff) | britness[ii] = 0.333 * (pix0[0] + pix0[1] + pix0[2]); // brightness 0-255 (PIXBRIGHT() nodiff) | |||
} | } | |||
for (py = 1; py < Ehh-1; py++) // precalculate pixel contrast | for (py = 1; py < Ehh-1; py++) // precalculate pixel contrast | |||
for (px = 1; px < Eww-1; px++) | for (px = 1; px < Eww-1; px++) | |||
{ | { | |||
skipping to change at line 191 | skipping to change at line 191 | |||
zdialog_resize(zd,250,0); | zdialog_resize(zd,250,0); | |||
zdialog_run(zd,sketch_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,sketch_dialog_event,"save"); // run dialog - parallel | |||
thread_signal(); | thread_signal(); | |||
return; | return; | |||
} | } | |||
// sketch dialog event and completion function | // sketch dialog event and completion function | |||
int sketch_dialog_event(zdialog *zd, const char *event) | int sketch_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace sketch_names; | using namespace sketch_names; | |||
int ii; | int ii; | |||
cchar *pp; | ch *pp; | |||
char color[20]; | ch color[20]; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"focus")) return 1; | if (strmatch(event,"focus")) return 1; | |||
if (strmatch(event,"done")) zd->zstat = 1; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 1; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 2; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 2; // from f_open() | |||
if (zd->zstat) | if (zd->zstat) | |||
{ | { | |||
if (zd->zstat == 1) { // commit edit | if (zd->zstat == 1) { // commit edit | |||
edit_addhist("Br:%.3f Th:%d Con:%.3f Clip:%d Alg:%d", | edit_addhist("Br:%.3f Th:%d Con:%.3f Clip:%d Alg:%d", | |||
skipping to change at line 546 | skipping to change at line 546 | |||
int kuwahara_depth = 2; | int kuwahara_depth = 2; | |||
int priorKD, priorBR; | int priorKD, priorBR; | |||
int Eww, Ehh; | int Eww, Ehh; | |||
float *pixcon; | float *pixcon; | |||
float Fthreshold; | float Fthreshold; | |||
float Wrad[41][41]; // radius <= 20 | float Wrad[41][41]; // radius <= 20 | |||
} | } | |||
// menu function | // menu function | |||
void m_cartoon(GtkWidget *, cchar *menu) | void m_cartoon(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace cartoon; | using namespace cartoon; | |||
int cartoon_dialog_event(zdialog *zd, cchar *event); | int cartoon_dialog_event(zdialog *zd, ch *event); | |||
void * cartoon_thread(void *); | void * cartoon_thread(void *); | |||
F1_help_topic = "cartoon"; | F1_help_topic = "cartoon"; | |||
Plog(1,"m_cartoon \n"); | Plog(1,"m_cartoon \n"); | |||
EFcartoon.menuname = "Cartoon"; | EFcartoon.menuname = "Cartoon"; | |||
EFcartoon.menufunc = m_cartoon; | EFcartoon.menufunc = m_cartoon; | |||
EFcartoon.Farea = 2; // select area usable | EFcartoon.Farea = 2; // select area usable | |||
EFcartoon.Fscript = 1; // scripting supported | EFcartoon.Fscript = 1; // scripting supported | |||
skipping to change at line 618 | skipping to change at line 618 | |||
zdialog_fetch(zd,"kuwahara_depth",kuwahara_depth); | zdialog_fetch(zd,"kuwahara_depth",kuwahara_depth); | |||
blur_radius = 2 * kuwahara_depth; // 22.30 | blur_radius = 2 * kuwahara_depth; // 22.30 | |||
priorKD = priorBR = -1; // initial edit | priorKD = priorBR = -1; // initial edit | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int cartoon_dialog_event(zdialog *zd, cchar *event) // dialog event function | int cartoon_dialog_event(zdialog *zd, ch *event) // dialog event function | |||
{ | { | |||
using namespace cartoon; | using namespace cartoon; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"focus")) return 1; | if (strmatch(event,"focus")) return 1; | |||
if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | |||
if (strmatch(event,"apply")) zd->zstat = 1; // from script | if (strmatch(event,"apply")) zd->zstat = 1; // from script | |||
zdialog_fetch(zd,"line_threshold",line_threshold); // get outline threshold 0-1000 | zdialog_fetch(zd,"line_threshold",line_threshold); // get outline threshold 0-1000 | |||
skipping to change at line 642 | skipping to change at line 642 | |||
blur_radius = 2 * kuwahara_depth; // 22.30 | blur_radius = 2 * kuwahara_depth; // 22.30 | |||
if (zd->zstat) | if (zd->zstat) | |||
{ | { | |||
if (zd->zstat == 1) { // [apply] | if (zd->zstat == 1) { // [apply] | |||
zd->zstat = 0; // keep dialog active | zd->zstat = 0; // keep dialog active | |||
thread_signal(); | thread_signal(); | |||
return 1; | return 1; | |||
} | } | |||
Fkillfunc = 1; | ||||
zmainsleep(1); | ||||
Fkillfunc = 0; | ||||
if (zd->zstat == 2) { // [ OK ] | if (zd->zstat == 2) { // [ OK ] | |||
edit_addhist("line thresh:%d width:%d blur rad:%d Kuwa depth:%d", | edit_addhist("line thresh:%d width:%d blur rad:%d Kuwa depth:%d", | |||
line_threshold,line_width,blur_radius,kuwahara_depth); // edit parms > edit hist | line_threshold,line_width,blur_radius,kuwahara_depth); // edit parms > edit hist | |||
edit_done(0); | edit_done(0); | |||
} | } | |||
else edit_cancel(0); | ||||
// discard edit | else { | |||
Fescape = 1; | ||||
// cancel edit | ||||
edit_cancel(0); | ||||
} | ||||
zfree(pixcon); | zfree(pixcon); | |||
} | } | |||
return 1; | return 1; | |||
} | } | |||
// thread function to update image | // thread function to update image | |||
void * cartoon_thread(void *) | void * cartoon_thread(void *) | |||
{ | { | |||
using namespace cartoon; | using namespace cartoon; | |||
void cartoon_blur(); | void cartoon_blur(); | |||
void cartoon_kuwahara(); | void cartoon_kuwahara(); | |||
void cartoon_contrast_map(); | void cartoon_contrast_map(); | |||
void cartoon_drawlines(); | void cartoon_drawlines(); | |||
int Fblur, Fkuwa, Fcon; | int Fblur, Fkuwa, Fcon; | |||
Fwatchescape = 1; | ||||
// killable process 23.1 | ||||
Fescape = 0; | ||||
Fblur = Fkuwa = Fcon = 0; | Fblur = Fkuwa = Fcon = 0; | |||
if (blur_radius != priorBR) Fblur = Fkuwa = Fcon = 1; | if (blur_radius != priorBR) Fblur = Fkuwa = Fcon = 1; | |||
if (kuwahara_depth != priorKD) Fkuwa = Fcon = 1; | if (kuwahara_depth != priorKD) Fkuwa = Fcon = 1; | |||
priorBR = blur_radius; // capture now, can change during process | priorBR = blur_radius; // capture now, can change during process | |||
priorKD = kuwahara_depth; | priorKD = kuwahara_depth; | |||
progress_reset((Fblur*Fkuwa*Fcon+1)*Eww*Ehh); // 22.30 | progress_reset((Fblur*Fkuwa*Fcon+1)*Eww*Ehh); // 22.30 | |||
if (Fblur) cartoon_blur(); // E1 + blur >> E8 | if (Fblur) cartoon_blur(); // E1 + blur >> E8 | |||
if (Fkuwa) cartoon_kuwahara(); // E8 + kuwahara >> E9 | if (Fkuwa) cartoon_kuwahara(); // E8 + kuwahara >> E9 | |||
if (Fcon) cartoon_contrast_map(); // compute E9 pixel contrast | if (Fcon) cartoon_contrast_map(); // compute E9 pixel contrast | |||
cartoon_drawlines(); // draw lines where contrast > threshold | cartoon_drawlines(); // draw lines where contrast > threshold | |||
progress_reset(0); | progress_reset(0); | |||
Fwatchescape = Fescape = 0; | ||||
CEF->Fmods++; | CEF->Fmods++; | |||
CEF->Fsaved = 0; | CEF->Fsaved = 0; | |||
Fpaint2(); // update window | Fpaint2(); // update window | |||
return 0; | return 0; | |||
} | } | |||
// Blur the image using blur_radius. E1 + blur >> E8 | // Blur the image using blur_radius. E1 + blur >> E8 | |||
void cartoon_blur() | void cartoon_blur() | |||
skipping to change at line 744 | skipping to change at line 750 | |||
int index = *((int *) arg); | int index = *((int *) arg); | |||
int rad = blur_radius; | int rad = blur_radius; | |||
int ii, dist = 0, px, py, qx, qy; | int ii, dist = 0, px, py, qx, qy; | |||
float W, Wsum, f1, f2; | float W, Wsum, f1, f2; | |||
float R, G, B, *pix1, *pixq, *pix8; | float R, G, B, *pix1, *pixq, *pix8; | |||
for (py = index + rad; py < Ehh-rad; py += NWT) // loop all image pixels | for (py = index + rad; py < Ehh-rad; py += NWT) // loop all image pixels | |||
for (px = rad; px < Eww-rad; px++) | for (px = rad; px < Eww-rad; px++) | |||
{ | { | |||
if (Fkillfunc) break; | if (Fescape) break; | |||
if (sa_stat == 3) { // select area active | if (sa_stat == 3) { // select area active | |||
ii = py * Eww + px; | ii = py * Eww + px; | |||
dist = sa_pixmap[ii]; // distance from edge | dist = sa_pixmap[ii]; // distance from edge | |||
if (! dist) continue; // pixel is outside area | if (! dist) continue; // pixel is outside area | |||
} | } | |||
R = G = B = Wsum = 0; | R = G = B = Wsum = 0; | |||
for (qy = -rad; qy <= rad; qy++) // compute weighted sum RGB for pixels | for (qy = -rad; qy <= rad; qy++) // compute weighted sum RGB for pixels | |||
skipping to change at line 828 | skipping to change at line 834 | |||
float vmin, vall, vred, vgreen, vblue; | float vmin, vall, vred, vgreen, vblue; | |||
float red9, green9, blue9; | float red9, green9, blue9; | |||
float f1, f2; | float f1, f2; | |||
rad = kuwahara_depth; // user input radius | rad = kuwahara_depth; // user input radius | |||
N = (rad + 1) * (rad + 1); | N = (rad + 1) * (rad + 1); | |||
for (py = index + rad; py < Ehh-rad; py += NWT) // loop all image pixels | for (py = index + rad; py < Ehh-rad; py += NWT) // loop all image pixels | |||
for (px = rad; px < Eww-rad; px++) | for (px = rad; px < Eww-rad; px++) | |||
{ | { | |||
if (Fkillfunc) break; | if (Fescape) break; | |||
if (sa_stat == 3) { // select area active | if (sa_stat == 3) { // select area active | |||
ii = py * Eww + px; | ii = py * Eww + px; | |||
dist = sa_pixmap[ii]; // distance from edge | dist = sa_pixmap[ii]; // distance from edge | |||
if (! dist) continue; // pixel is outside area | if (! dist) continue; // pixel is outside area | |||
} | } | |||
vmin = 99999; | vmin = 99999; | |||
red9 = green9 = blue9 = 0; | red9 = green9 = blue9 = 0; | |||
skipping to change at line 909 | skipping to change at line 915 | |||
int ii, px, py, qx, qy; | int ii, px, py, qx, qy; | |||
double sumcon, pix1con, maxcon; | double sumcon, pix1con, maxcon; | |||
float *pixx, *pixq; | float *pixx, *pixq; | |||
maxcon = 0; | maxcon = 0; | |||
for (py = 1; py < Ehh-1; py++) // make image pixel contrast map | for (py = 1; py < Ehh-1; py++) // make image pixel contrast map | |||
for (px = 1; px < Eww-1; px++) | for (px = 1; px < Eww-1; px++) | |||
{ | { | |||
if (Fkillfunc) break; | if (Fescape) break; | |||
sumcon = 0; | sumcon = 0; | |||
for (qy = py-1; qy <= py+1; qy++) | for (qy = py-1; qy <= py+1; qy++) | |||
for (qx = px-1; qx <= px+1; qx++) | for (qx = px-1; qx <= px+1; qx++) | |||
{ | { | |||
pixx = PXMpix(E9pxm,px,py); // pixel contrast is mean contrast | pixx = PXMpix(E9pxm,px,py); // pixel contrast is mean contrast | |||
pixq = PXMpix(E9pxm,qx,qy); // with 8 neighboring pixels | pixq = PXMpix(E9pxm,qx,qy); // with 8 neighboring pixels | |||
sumcon += fabsf(pixx[0] - pixq[0]); | sumcon += fabsf(pixx[0] - pixq[0]); | |||
sumcon += fabsf(pixx[1] - pixq[1]); | sumcon += fabsf(pixx[1] - pixq[1]); | |||
skipping to change at line 960 | skipping to change at line 966 | |||
int index = *((int *) arg); | int index = *((int *) arg); | |||
int px, py, qx, qy, ii, dist = 0; | int px, py, qx, qy, ii, dist = 0; | |||
float Fthresh, paint, f1, f2; | float Fthresh, paint, f1, f2; | |||
float *pix1, *pix3, *pix3q; | float *pix1, *pix3, *pix3q; | |||
Fthresh = 0.001 * line_threshold * Fthreshold; // 0 .. 1000 >> 0 .. Fthreshold | Fthresh = 0.001 * line_threshold * Fthreshold; // 0 .. 1000 >> 0 .. Fthreshold | |||
for (py = index+1; py < Ehh-1; py += NWT) | for (py = index+1; py < Ehh-1; py += NWT) | |||
for (px = 1; px < Eww-1; px++) | for (px = 1; px < Eww-1; px++) | |||
{ | { | |||
if (Fkillfunc) break; | if (Fescape) break; | |||
ii = py * Eww + px; | ii = py * Eww + px; | |||
if (sa_stat == 3) { // select area active | if (sa_stat == 3) { // select area active | |||
dist = sa_pixmap[ii]; // distance from edge | dist = sa_pixmap[ii]; // distance from edge | |||
if (! dist) continue; // pixel outside area | if (! dist) continue; // pixel outside area | |||
} | } | |||
if (pixcon[ii] < Fthresh) continue; | if (pixcon[ii] < Fthresh) continue; | |||
skipping to change at line 1032 | skipping to change at line 1038 | |||
namespace linedraw_names | namespace linedraw_names | |||
{ | { | |||
editfunc EFlinedraw; | editfunc EFlinedraw; | |||
float outline_thresh; // contrast threshold to make a line | float outline_thresh; // contrast threshold to make a line | |||
float outline_width; // drawn line width | float outline_width; // drawn line width | |||
float image_briteness; // background image brightness | float image_briteness; // background image brightness | |||
int blackwhite, negative; // flags | int blackwhite, negative; // flags | |||
} | } | |||
void m_drawing(GtkWidget *, cchar *menu) | void m_drawing(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace linedraw_names; | using namespace linedraw_names; | |||
int linedraw_dialog_event(zdialog* zd, cchar *event); | int linedraw_dialog_event(zdialog* zd, ch *event); | |||
void * linedraw_thread(void *); | void * linedraw_thread(void *); | |||
F1_help_topic = "drawing"; | F1_help_topic = "drawing"; | |||
Plog(1,"m_drawing \n"); | Plog(1,"m_drawing \n"); | |||
EFlinedraw.menuname = "Drawing"; | EFlinedraw.menuname = "Drawing"; | |||
EFlinedraw.menufunc = m_drawing; | EFlinedraw.menufunc = m_drawing; | |||
EFlinedraw.Farea = 2; // select area usable | EFlinedraw.Farea = 2; // select area usable | |||
EFlinedraw.Fscript = 1; // scripting supported | EFlinedraw.Fscript = 1; // scripting supported | |||
skipping to change at line 1098 | skipping to change at line 1104 | |||
zdialog_resize(zd,300,0); | zdialog_resize(zd,300,0); | |||
zdialog_run(zd,linedraw_dialog_event,"save"); // run dialog, parallel | zdialog_run(zd,linedraw_dialog_event,"save"); // run dialog, parallel | |||
thread_signal(); | thread_signal(); | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int linedraw_dialog_event(zdialog *zd, cchar *event) // dialog event function | int linedraw_dialog_event(zdialog *zd, ch *event) // dialog event function | |||
{ | { | |||
using namespace linedraw_names; | using namespace linedraw_names; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"focus")) return 1; | if (strmatch(event,"focus")) return 1; | |||
if (strmatch(event,"done")) zd->zstat = 1; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 1; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 2; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 2; // from f_open() | |||
if (zd->zstat) | if (zd->zstat) | |||
{ | { | |||
skipping to change at line 1290 | skipping to change at line 1296 | |||
namespace emboss_names | namespace emboss_names | |||
{ | { | |||
editfunc EFemboss; | editfunc EFemboss; | |||
int radius, depth; | int radius, depth; | |||
float kernel[20][20]; // support radius <= 9 | float kernel[20][20]; // support radius <= 9 | |||
} | } | |||
// menu function | // menu function | |||
void m_emboss(GtkWidget *, cchar *menu) | void m_emboss(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace emboss_names; | using namespace emboss_names; | |||
int emboss_dialog_event(zdialog* zd, cchar *event); | int emboss_dialog_event(zdialog* zd, ch *event); | |||
void * emboss_thread(void *); | void * emboss_thread(void *); | |||
F1_help_topic = "emboss"; | F1_help_topic = "emboss"; | |||
Plog(1,"m_emboss \n"); | Plog(1,"m_emboss \n"); | |||
EFemboss.menuname = "Emboss"; | EFemboss.menuname = "Emboss"; | |||
EFemboss.menufunc = m_emboss; | EFemboss.menufunc = m_emboss; | |||
EFemboss.Fscript = 1; // scripting supported | EFemboss.Fscript = 1; // scripting supported | |||
EFemboss.Farea = 2; // select area usable | EFemboss.Farea = 2; // select area usable | |||
skipping to change at line 1336 | skipping to change at line 1342 | |||
zdialog_add_widget(zd,"zspin","radius","hb1","0|9|1|0"); | zdialog_add_widget(zd,"zspin","radius","hb1","0|9|1|0"); | |||
zdialog_add_widget(zd,"label","lab2","hb1","Depth","space=5"); | zdialog_add_widget(zd,"label","lab2","hb1","Depth","space=5"); | |||
zdialog_add_widget(zd,"zspin","depth","hb1","0|99|1|0"); | zdialog_add_widget(zd,"zspin","depth","hb1","0|99|1|0"); | |||
zdialog_run(zd,emboss_dialog_event,"save"); // run dialog, parallel | zdialog_run(zd,emboss_dialog_event,"save"); // run dialog, parallel | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int emboss_dialog_event(zdialog *zd, cchar *event) // emboss dialog event function | int emboss_dialog_event(zdialog *zd, ch *event) // emboss dialog event function | |||
{ | { | |||
using namespace emboss_names; | using namespace emboss_names; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"focus")) return 1; | if (strmatch(event,"focus")) return 1; | |||
if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | |||
if (strmatch(event,"apply")) zd->zstat = 1; // from script | if (strmatch(event,"apply")) zd->zstat = 1; // from script | |||
if (zd->zstat) | if (zd->zstat) | |||
skipping to change at line 1505 | skipping to change at line 1511 | |||
// convert image to simulate square tiles | // convert image to simulate square tiles | |||
namespace tiles_names | namespace tiles_names | |||
{ | { | |||
editfunc EFtiles; | editfunc EFtiles; | |||
int size, gap, D3; | int size, gap, D3; | |||
float *pixmap = 0; | float *pixmap = 0; | |||
} | } | |||
void m_tiles(GtkWidget *, cchar *menu) | void m_tiles(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace tiles_names; | using namespace tiles_names; | |||
int tiles_dialog_event(zdialog *zd, cchar *event); | int tiles_dialog_event(zdialog *zd, ch *event); | |||
void * tiles_thread(void *); | void * tiles_thread(void *); | |||
F1_help_topic = "tiles"; | F1_help_topic = "tiles"; | |||
Plog(1,"m_tiles \n"); | Plog(1,"m_tiles \n"); | |||
EFtiles.menuname = "Tiles"; | EFtiles.menuname = "Tiles"; | |||
EFtiles.menufunc = m_tiles; | EFtiles.menufunc = m_tiles; | |||
EFtiles.Farea = 2; // select area usable | EFtiles.Farea = 2; // select area usable | |||
EFtiles.Fscript = 1; // scripting supported | EFtiles.Fscript = 1; // scripting supported | |||
skipping to change at line 1562 | skipping to change at line 1568 | |||
int cc = E1pxm->ww * E1pxm->hh * 3 * sizeof(float); | int cc = E1pxm->ww * E1pxm->hh * 3 * sizeof(float); | |||
pixmap = (float *) zmalloc(cc,"tiles"); // set up pixel color map | pixmap = (float *) zmalloc(cc,"tiles"); // set up pixel color map | |||
zdialog_run(zd,tiles_dialog_event,"save"); // run dialog, parallel | zdialog_run(zd,tiles_dialog_event,"save"); // run dialog, parallel | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int tiles_dialog_event(zdialog * zd, cchar *event) | int tiles_dialog_event(zdialog * zd, ch *event) | |||
{ | { | |||
using namespace tiles_names; | using namespace tiles_names; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"focus")) return 1; | if (strmatch(event,"focus")) return 1; | |||
if (strmatch(event,"apply")) zd->zstat = 1; // from script | if (strmatch(event,"apply")) zd->zstat = 1; // from script | |||
if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | |||
if (zd->zstat) // dialog complete | if (zd->zstat) // dialog complete | |||
skipping to change at line 1756 | skipping to change at line 1762 | |||
{ | { | |||
editfunc EFpainting; | editfunc EFpainting; | |||
int color_depth; | int color_depth; | |||
int group_area; | int group_area; | |||
int color_match; | int color_match; | |||
int borders; | int borders; | |||
typedef struct { | typedef struct { | |||
int16 px, py; | int16 px, py; | |||
char direc; | ch direc; | |||
} spixstack; | } spixstack; | |||
int Nstack; | int Nstack; | |||
spixstack *pixstack; // pixel group search memory | spixstack *pixstack; // pixel group search memory | |||
int *pixgroup; // maps (px,py) to pixel group no. | int *pixgroup; // maps (px,py) to pixel group no. | |||
int *groupcount; // count of pixels in each group | int *groupcount; // count of pixels in each group | |||
int group; | int group; | |||
char direc; | ch direc; | |||
float gcolor[3]; | float gcolor[3]; | |||
} | } | |||
void m_painting(GtkWidget *, cchar *menu) | void m_painting(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace painting_names; | using namespace painting_names; | |||
int painting_dialog_event(zdialog *zd, cchar *event); | int painting_dialog_event(zdialog *zd, ch *event); | |||
void * painting_thread(void *); | void * painting_thread(void *); | |||
F1_help_topic = "painting"; | F1_help_topic = "painting"; | |||
Plog(1,"m_painting \n"); | Plog(1,"m_painting \n"); | |||
EFpainting.menuname = "Painting"; | EFpainting.menuname = "Painting"; | |||
EFpainting.menufunc = m_painting; | EFpainting.menufunc = m_painting; | |||
EFpainting.Farea = 2; // select area usable | EFpainting.Farea = 2; // select area usable | |||
EFpainting.Fscript = 1; // scripting supported | EFpainting.Fscript = 1; // scripting supported | |||
skipping to change at line 1827 | skipping to change at line 1833 | |||
zdialog_add_widget(zd,"label","labbd","hbbd","borders","space=5"); | zdialog_add_widget(zd,"label","labbd","hbbd","borders","space=5"); | |||
zdialog_add_widget(zd,"check","borders","hbbd",0,"space=2"); | zdialog_add_widget(zd,"check","borders","hbbd",0,"space=2"); | |||
zdialog_restore_inputs(zd); // preload prior user inputs | zdialog_restore_inputs(zd); // preload prior user inputs | |||
zdialog_run(zd,painting_dialog_event,"save"); // run dialog, parallel | zdialog_run(zd,painting_dialog_event,"save"); // run dialog, parallel | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int painting_dialog_event(zdialog *zd, cchar *event) | int painting_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace painting_names; | using namespace painting_names; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"focus")) return 1; | if (strmatch(event,"focus")) return 1; | |||
if (strmatch(event,"apply")) zd->zstat = 1; // from script | if (strmatch(event,"apply")) zd->zstat = 1; // from script | |||
if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | |||
if (zd->zstat) | if (zd->zstat) | |||
skipping to change at line 2224 | skipping to change at line 2230 | |||
void painting_paintborders() | void painting_paintborders() | |||
{ | { | |||
using namespace painting_names; | using namespace painting_names; | |||
int ii, kk, px, py, cc; | int ii, kk, px, py, cc; | |||
float *pix3, *pixL, *pixA; | float *pix3, *pixL, *pixA; | |||
if (! borders) return; | if (! borders) return; | |||
cc = E3pxm->ww * E3pxm->hh; | cc = E3pxm->ww * E3pxm->hh; | |||
char * pixblack = (char *) zmalloc(cc,"painting"); | ch * pixblack = (ch *) zmalloc(cc,"painting"); | |||
if (sa_stat == 3) | if (sa_stat == 3) | |||
{ | { | |||
for (ii = 0; ii < E3pxm->ww * E3pxm->hh; ii++) // find pixels in select area | for (ii = 0; ii < E3pxm->ww * E3pxm->hh; ii++) // find pixels in select area | |||
{ | { | |||
if (! sa_pixmap[ii]) continue; | if (! sa_pixmap[ii]) continue; | |||
py = ii / E3pxm->ww; | py = ii / E3pxm->ww; | |||
px = ii - py * E3pxm->ww; | px = ii - py * E3pxm->ww; | |||
if (px < 1 || py < 1) continue; | if (px < 1 || py < 1) continue; | |||
skipping to change at line 2356 | skipping to change at line 2362 | |||
// apply a random texture to the image | // apply a random texture to the image | |||
namespace texturenames | namespace texturenames | |||
{ | { | |||
editfunc EFtexture; // edit function data | editfunc EFtexture; // edit function data | |||
int radius = 4; | int radius = 4; | |||
int power = 40; | int power = 40; | |||
int e3ww, e3hh; | int e3ww, e3hh; | |||
} | } | |||
void m_texture(GtkWidget *, cchar *menu) | void m_texture(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace texturenames; | using namespace texturenames; | |||
int texture_dialog_event(zdialog* zd, const char *event); | int texture_dialog_event(zdialog* zd, ch *event); | |||
void * texture_thread(void *); | void * texture_thread(void *); | |||
zdialog *zd; | zdialog *zd; | |||
F1_help_topic = "texture"; | F1_help_topic = "texture"; | |||
Plog(1,"m_texture \n"); | Plog(1,"m_texture \n"); | |||
EFtexture.menuname = "Texture"; | EFtexture.menuname = "Texture"; | |||
EFtexture.menufunc = m_texture; | EFtexture.menufunc = m_texture; | |||
skipping to change at line 2411 | skipping to change at line 2417 | |||
zdialog_stuff(zd,"radius",radius); | zdialog_stuff(zd,"radius",radius); | |||
zdialog_stuff(zd,"power",power); | zdialog_stuff(zd,"power",power); | |||
zdialog_run(zd,texture_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,texture_dialog_event,"save"); // run dialog - parallel | |||
return; | return; | |||
} | } | |||
// texture dialog event and completion function | // texture dialog event and completion function | |||
int texture_dialog_event(zdialog *zd, const char *event) | int texture_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace texturenames; | using namespace texturenames; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"focus")) return 1; | if (strmatch(event,"focus")) return 1; | |||
if (strmatch(event,"apply")) zd->zstat = 1; // from script | if (strmatch(event,"apply")) zd->zstat = 1; // from script | |||
if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | |||
if (zd->zstat) | if (zd->zstat) | |||
skipping to change at line 2576 | skipping to change at line 2582 | |||
/******************************************************************************* */ | /******************************************************************************* */ | |||
// pattern menu function | // pattern menu function | |||
// tile the image with a repeating pattern | // tile the image with a repeating pattern | |||
namespace patternnames | namespace patternnames | |||
{ | { | |||
editfunc EFpattern; // edit function data | editfunc EFpattern; // edit function data | |||
int e3ww, e3hh; | int e3ww, e3hh; | |||
char *pattfile = 0; // pattern image file | ch *pattfile = 0; // pattern image file | |||
PIXBUF *pixbuf = 0; // pattern pixbuf | PIXBUF *pixbuf = 0; // pattern pixbuf | |||
int pattww, patthh, pattrs; // pixbuf length, width, row stride | int pattww, patthh, pattrs; // pixbuf length, width, row stride | |||
uint8 *pixels; // pixbuf pixels | uint8 *pixels; // pixbuf pixels | |||
int olapww = 0, olaphh = 0; // pattern overlap | int olapww = 0, olaphh = 0; // pattern overlap | |||
int opacity = 0; // pattern opacity 0-100 | int opacity = 0; // pattern opacity 0-100 | |||
int contrast = 100; // pattern contrast 0-200 | int contrast = 100; // pattern contrast 0-200 | |||
float zoom = 1.0; // pattern magnification | float zoom = 1.0; // pattern magnification | |||
int Fgray = 0; // grayscale = no | int Fgray = 0; // grayscale = no | |||
} | } | |||
// menu function | // menu function | |||
void m_pattern(GtkWidget *, cchar *menu) | void m_pattern(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace patternnames; | using namespace patternnames; | |||
int pattern_dialog_event(zdialog* zd, const char *event); | int pattern_dialog_event(zdialog* zd, ch *event); | |||
zdialog *zd; | zdialog *zd; | |||
F1_help_topic = "pattern"; | F1_help_topic = "pattern"; | |||
Plog(1,"m_pattern \n"); | Plog(1,"m_pattern \n"); | |||
EFpattern.menuname = "Pattern"; | EFpattern.menuname = "Pattern"; | |||
EFpattern.menufunc = m_pattern; | EFpattern.menufunc = m_pattern; | |||
EFpattern.Farea = 2; // select area OK | EFpattern.Farea = 2; // select area OK | |||
skipping to change at line 2675 | skipping to change at line 2681 | |||
zdialog_restore_inputs(zd); // restore previous inputs | zdialog_restore_inputs(zd); // restore previous inputs | |||
zdialog_run(zd,pattern_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,pattern_dialog_event,"save"); // run dialog - parallel | |||
zdialog_send_event(zd,"init"); // initialize | zdialog_send_event(zd,"init"); // initialize | |||
return; | return; | |||
} | } | |||
// pattern dialog event and completion function | // pattern dialog event and completion function | |||
int pattern_dialog_event(zdialog *zd, const char *event) | int pattern_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace patternnames; | using namespace patternnames; | |||
void pattern_match(); | void pattern_match(); | |||
void pattern_image(); | void pattern_image(); | |||
char temp1[150], temp2[200]; | ch temp1[150], temp2[200]; | |||
char *file, *pp; | ch *file, *pp; | |||
PIXBUF *pixbuf2; | PIXBUF *pixbuf2; | |||
GError *gerror = 0; | GError *gerror = 0; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"focus")) return 1; | if (strmatch(event,"focus")) return 1; | |||
if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | |||
if (strmatch(event,"apply")) zd->zstat = 1; // from script | if (strmatch(event,"apply")) zd->zstat = 1; // from script | |||
if (zd->zstat) | if (zd->zstat) | |||
skipping to change at line 2896 | skipping to change at line 2902 | |||
return; | return; | |||
} | } | |||
// combine image and pattern | // combine image and pattern | |||
void pattern_image() | void pattern_image() | |||
{ | { | |||
using namespace patternnames; | using namespace patternnames; | |||
char *tmap; // maps tiles overlapping image pixel | ch *tmap; // maps tiles overlapping image pixel | |||
int ii, cc, dist; | int ii, cc, dist; | |||
int tcol, trow, Ntcols, Ntrows; // tile columns and rows | int tcol, trow, Ntcols, Ntrows; // tile columns and rows | |||
int pww, phh, prs; // pattern/tile dimensions | int pww, phh, prs; // pattern/tile dimensions | |||
int mpx, mpy, tpx, tpy; | int mpx, mpy, tpx, tpy; | |||
int R, G, B; | int R, G, B; | |||
uint8 *pixt; | uint8 *pixt; | |||
float *pix1, *pix3; | float *pix1, *pix3; | |||
float pbrite, f1, f2; | float pbrite, f1, f2; | |||
double mbrite = 0; | double mbrite = 0; | |||
float *tbmap; | float *tbmap; | |||
float max$; | float max$; | |||
pww = pattww; // capture and freeze volatile params | pww = pattww; // capture and freeze volatile params | |||
phh = patthh; | phh = patthh; | |||
prs = pattrs; | prs = pattrs; | |||
cc = e3ww * e3hh; // tile pixels mapping to image pixel | cc = e3ww * e3hh; // tile pixels mapping to image pixel | |||
tmap = (char *) zmalloc(cc,"pattern"); | tmap = (ch *) zmalloc(cc,"pattern"); | |||
cc = pww * phh * sizeof(float); // tile brightness map | cc = pww * phh * sizeof(float); // tile brightness map | |||
tbmap = (float *) zmalloc(cc,"pattern"); | tbmap = (float *) zmalloc(cc,"pattern"); | |||
for (mpy = 0; mpy < e3hh; mpy++) // clear output image to black | for (mpy = 0; mpy < e3hh; mpy++) // clear output image to black | |||
for (mpx = 0; mpx < e3ww; mpx++) | for (mpx = 0; mpx < e3ww; mpx++) | |||
{ | { | |||
pix3 = PXMpix(E3pxm,mpx,mpy); | pix3 = PXMpix(E3pxm,mpx,mpy); | |||
pix3[0] = pix3[1] = pix3[2] = 0; | pix3[0] = pix3[1] = pix3[2] = 0; | |||
} | } | |||
skipping to change at line 3052 | skipping to change at line 3058 | |||
} | } | |||
} | } | |||
return; | return; | |||
} | } | |||
/******************************************************************************* */ | /******************************************************************************* */ | |||
// Dither menu, incorporating dither0, dither1, dither2, dither3 | // Dither menu, incorporating dither0, dither1, dither2, dither3 | |||
void m_dither(GtkWidget *, cchar *menu) | void m_dither(GtkWidget *, ch *menu) | |||
{ | { | |||
int dither_dialog_event(zdialog *zd, cchar *event); | int dither_dialog_event(zdialog *zd, ch *event); | |||
zdialog *zd; | zdialog *zd; | |||
F1_help_topic = "dither"; | F1_help_topic = "dither"; | |||
Plog(1,"m_dither \n"); | Plog(1,"m_dither \n"); | |||
if (FGWM != 'F') return; | ||||
if (! curr_file) return; | if (! curr_file) return; | |||
if (FGWM != 'F') return; | ||||
/*** | /*** | |||
____________________________________________ | ____________________________________________ | |||
| Dither Image | | | Dither Image | | |||
| | | | | | |||
| [Dither0] Roy Lichtenstein effect | | | [Dither0] Roy Lichtenstein effect | | |||
| [Dither1] pure RGB or black/white dots | | | [Dither1] pure RGB or black/white dots | | |||
| [Dither2] RGB mix with given bit-depth | | | [Dither2] RGB mix with given bit-depth | | |||
| [Dither3] custom color palette | | | [Dither3] custom color palette | | |||
| | | | | | |||
skipping to change at line 3103 | skipping to change at line 3109 | |||
zdialog_add_widget(zd,"hbox","hb3","dialog"); | zdialog_add_widget(zd,"hbox","hb3","dialog"); | |||
zdialog_add_widget(zd,"button","dither3","hb3","Dither3","space=3"); | zdialog_add_widget(zd,"button","dither3","hb3","Dither3","space=3"); | |||
zdialog_add_widget(zd,"label","lab3","hb3","custom color palette","space=3"); | zdialog_add_widget(zd,"label","lab3","hb3","custom color palette","space=3"); | |||
zdialog_run(zd,dither_dialog_event,"save"); | zdialog_run(zd,dither_dialog_event,"save"); | |||
return; | return; | |||
} | } | |||
// dialog event and completion function | // dialog event and completion function | |||
int dither_dialog_event(zdialog *zd, cchar *event) | int dither_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (zd->zstat) { // done or [x] | if (zd->zstat) { // done or [x] | |||
zdialog_free(zd); // kill dialog | zdialog_free(zd); // kill dialog | |||
return 1; | return 1; | |||
} | } | |||
if (! zstrstr(event,"dither")) return 1; // ignore other events | if (! zstrstr(event,"dither")) return 1; // ignore other events | |||
skipping to change at line 3133 | skipping to change at line 3139 | |||
/******************************************************************************* */ | /******************************************************************************* */ | |||
// convert image to dot grid (like Roy Lichtenstein) | // convert image to dot grid (like Roy Lichtenstein) | |||
namespace dither0_names | namespace dither0_names | |||
{ | { | |||
int dot_size; // tile size enclosing dots | int dot_size; // tile size enclosing dots | |||
editfunc EFdither0; | editfunc EFdither0; | |||
} | } | |||
void m_dither0(GtkWidget *, cchar *menu) | void m_dither0(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace dither0_names; | using namespace dither0_names; | |||
int dither0_dialog_event(zdialog *zd, cchar *event); | int dither0_dialog_event(zdialog *zd, ch *event); | |||
void * dither0_thread(void *); | void * dither0_thread(void *); | |||
F1_help_topic = "dither"; | F1_help_topic = "dither"; | |||
Plog(1,"m_dither0 \n"); | Plog(1,"m_dither0 \n"); | |||
EFdither0.menuname = "dither0"; | EFdither0.menuname = "dither0"; | |||
EFdither0.menufunc = m_dither0; | EFdither0.menufunc = m_dither0; | |||
EFdither0.Farea = 2; // select area usable | EFdither0.Farea = 2; // select area usable | |||
EFdither0.Fscript = 1; // scripting supported | EFdither0.Fscript = 1; // scripting supported | |||
skipping to change at line 3167 | skipping to change at line 3173 | |||
zdialog_add_widget(zd,"zspin","size","hb1","4|99|1|9","space=5"); | zdialog_add_widget(zd,"zspin","size","hb1","4|99|1|9","space=5"); | |||
dot_size = 9; | dot_size = 9; | |||
zdialog_run(zd,dither0_dialog_event,"save"); // run dialog, parallel | zdialog_run(zd,dither0_dialog_event,"save"); // run dialog, parallel | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int dither0_dialog_event(zdialog * zd, cchar *event) | int dither0_dialog_event(zdialog * zd, ch *event) | |||
{ | { | |||
using namespace dither0_names; | using namespace dither0_names; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"focus")) return 1; | if (strmatch(event,"focus")) return 1; | |||
if (strmatch(event,"apply")) zd->zstat = 1; // from script | if (strmatch(event,"apply")) zd->zstat = 1; // from script | |||
if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | |||
if (zd->zstat) | if (zd->zstat) | |||
skipping to change at line 3348 | skipping to change at line 3354 | |||
namespace dither1_names | namespace dither1_names | |||
{ | { | |||
editfunc EFdither1; | editfunc EFdither1; | |||
int E3ww, E3hh; | int E3ww, E3hh; | |||
int RES, RGB, BW; | int RES, RGB, BW; | |||
int RAND; | int RAND; | |||
} | } | |||
// menu function | // menu function | |||
void m_dither1(GtkWidget *, const char *menu) | void m_dither1(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace dither1_names; | using namespace dither1_names; | |||
int dither1_dialog_event(zdialog* zd, const char *event); | int dither1_dialog_event(zdialog* zd, ch *event); | |||
void * dither1_thread(void *); | void * dither1_thread(void *); | |||
F1_help_topic = "dither"; | F1_help_topic = "dither"; | |||
Plog(1,"m_dither1 \n"); | Plog(1,"m_dither1 \n"); | |||
EFdither1.menuname = "dither1"; | EFdither1.menuname = "dither1"; | |||
EFdither1.menufunc = m_dither1; | EFdither1.menufunc = m_dither1; | |||
EFdither1.threadfunc = dither1_thread; // thread function | EFdither1.threadfunc = dither1_thread; // thread function | |||
EFdither1.Farea = 2; // select area usable | EFdither1.Farea = 2; // select area usable | |||
skipping to change at line 3407 | skipping to change at line 3413 | |||
zdialog_stuff(zd,"RAND",0); | zdialog_stuff(zd,"RAND",0); | |||
zdialog_restore_inputs(zd); // restore previous inputs | zdialog_restore_inputs(zd); // restore previous inputs | |||
zdialog_run(zd,dither1_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,dither1_dialog_event,"save"); // run dialog - parallel | |||
return; | return; | |||
} | } | |||
// dither1 dialog event and completion function | // dither1 dialog event and completion function | |||
int dither1_dialog_event(zdialog *zd, const char *event) | int dither1_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace dither1_names; | using namespace dither1_names; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"apply")) zd->zstat = 1; // from script | if (strmatch(event,"apply")) zd->zstat = 1; // from script | |||
if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | |||
zdialog_fetch(zd,"RES",RES); | zdialog_fetch(zd,"RES",RES); | |||
zdialog_fetch(zd,"RGB",RGB); | zdialog_fetch(zd,"RGB",RGB); | |||
skipping to change at line 3475 | skipping to change at line 3481 | |||
void * dither1_wthread_RGB(void *arg) | void * dither1_wthread_RGB(void *arg) | |||
{ | { | |||
using namespace dither1_names; | using namespace dither1_names; | |||
int index = *((int *) arg); | int index = *((int *) arg); | |||
int px, py, qx, qy; | int px, py, qx, qy; | |||
int ii, jj, kk, dist = 1; | int ii, jj, kk, dist = 1; | |||
int pixcc = 3 * sizeof(float); | int pixcc = 3 * sizeof(float); | |||
int RES2 = RES * RES; | int RES2 = RES * RES; | |||
char Pflag[1000]; // max. RES = 31 | ch Pflag[1000]; // max. RES = 31 | |||
float *pix1, *pix3; | float *pix1, *pix3; | |||
float Rs, Gs, Bs, Rp, Gp, Bp; | float Rs, Gs, Bs, Rp, Gp, Bp; | |||
float maxrgb; | float maxrgb; | |||
float f1, f2; | float f1, f2; | |||
pix3 = 0; // stop compiler 'uninitialized' | pix3 = 0; // stop compiler 'uninitialized' | |||
kk = 0; // warnings | kk = 0; // warnings | |||
for (py = index * RES; py < E3hh - RES; py += NWT * RES) // loop each pixel block | for (py = index * RES; py < E3hh - RES; py += NWT * RES) // loop each pixel block | |||
for (px = 0; px < E3ww - RES; px += RES) | for (px = 0; px < E3ww - RES; px += RES) | |||
skipping to change at line 3610 | skipping to change at line 3616 | |||
void * dither1_wthread_BW(void *arg) | void * dither1_wthread_BW(void *arg) | |||
{ | { | |||
using namespace dither1_names; | using namespace dither1_names; | |||
int index = *((int *) arg); | int index = *((int *) arg); | |||
int px, py, qx, qy; | int px, py, qx, qy; | |||
int ii, jj, kk, dist = 1; | int ii, jj, kk, dist = 1; | |||
int pixcc = 3 * sizeof(float); | int pixcc = 3 * sizeof(float); | |||
int RES2 = RES * RES; | int RES2 = RES * RES; | |||
char Pflag[1000]; // max. RES = 31 | ch Pflag[1000]; // max. RES = 31 | |||
float *pix1, *pix3; | float *pix1, *pix3; | |||
float white[3] = { 255, 255, 255 }; | float white[3] = { 255, 255, 255 }; | |||
float Nw, Nb, minrgb, pixrgb; | float Nw, Nb, minrgb, pixrgb; | |||
float f1, f2; | float f1, f2; | |||
pix3 = 0; // stop compiler 'uninitialized' | pix3 = 0; // stop compiler 'uninitialized' | |||
kk = 0; // warnings | kk = 0; // warnings | |||
for (py = index * RES; py < E3hh - RES; py += NWT * RES) // loop each pixel block | for (py = index * RES; py < E3hh - RES; py += NWT * RES) // loop each pixel block | |||
for (px = 0; px < E3ww - RES; px += RES) | for (px = 0; px < E3ww - RES; px += RES) | |||
skipping to change at line 3738 | skipping to change at line 3744 | |||
namespace dither2_names | namespace dither2_names | |||
{ | { | |||
editfunc EFdither2; | editfunc EFdither2; | |||
int E3ww, E3hh; | int E3ww, E3hh; | |||
int RES, RES2, DEPTH, COMP; | int RES, RES2, DEPTH, COMP; | |||
} | } | |||
// menu function | // menu function | |||
void m_dither2(GtkWidget *, const char *menu) | void m_dither2(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace dither2_names; | using namespace dither2_names; | |||
int dither2_dialog_event(zdialog* zd, const char *event); | int dither2_dialog_event(zdialog* zd, ch *event); | |||
void * dither2_thread(void *); | void * dither2_thread(void *); | |||
F1_help_topic = "dither"; | F1_help_topic = "dither"; | |||
Plog(1,"m_dither2 \n"); | Plog(1,"m_dither2 \n"); | |||
EFdither2.menuname = "dither2"; | EFdither2.menuname = "dither2"; | |||
EFdither2.menufunc = m_dither2; | EFdither2.menufunc = m_dither2; | |||
EFdither2.threadfunc = dither2_thread; // thread function | EFdither2.threadfunc = dither2_thread; // thread function | |||
EFdither2.Farea = 2; // select area usable | EFdither2.Farea = 2; // select area usable | |||
skipping to change at line 3794 | skipping to change at line 3800 | |||
zdialog_add_widget(zd,"check","COMP","hbcomp","error compensation","space=5") ; | zdialog_add_widget(zd,"check","COMP","hbcomp","error compensation","space=5") ; | |||
zdialog_restore_inputs(zd); // restore previous inputs | zdialog_restore_inputs(zd); // restore previous inputs | |||
zdialog_run(zd,dither2_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,dither2_dialog_event,"save"); // run dialog - parallel | |||
return; | return; | |||
} | } | |||
// dither2 dialog event and completion function | // dither2 dialog event and completion function | |||
int dither2_dialog_event(zdialog *zd, const char *event) | int dither2_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace dither2_names; | using namespace dither2_names; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"apply")) zd->zstat = 1; // from script | if (strmatch(event,"apply")) zd->zstat = 1; // from script | |||
if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | |||
zdialog_fetch(zd,"RES",RES); | zdialog_fetch(zd,"RES",RES); | |||
zdialog_fetch(zd,"DEPTH",DEPTH); | zdialog_fetch(zd,"DEPTH",DEPTH); | |||
skipping to change at line 3995 | skipping to change at line 4001 | |||
/******************************************************************************* */ | /******************************************************************************* */ | |||
// Dither image using custom colors and Floyd-Steinberg error distribution algo rithm. | // Dither image using custom colors and Floyd-Steinberg error distribution algo rithm. | |||
namespace dither3_names | namespace dither3_names | |||
{ | { | |||
editfunc EFdither3; | editfunc EFdither3; | |||
int E3ww, E3hh; | int E3ww, E3hh; | |||
int RES, RES2, COMP; | int RES, RES2, COMP; | |||
char palettename[100] = "none"; // palette file name | ch palettename[100] = "none"; // palette file name | |||
int Ncolors = 0; // palette color count | int Ncolors = 0; // palette color count | |||
} | } | |||
// menu function | // menu function | |||
void m_dither3(GtkWidget *, const char *menu) | void m_dither3(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace dither3_names; | using namespace dither3_names; | |||
int dither3_dialog_event(zdialog* zd, const char *event); | int dither3_dialog_event(zdialog* zd, ch *event); | |||
void * dither3_thread(void *); | void * dither3_thread(void *); | |||
F1_help_topic = "dither"; | F1_help_topic = "dither"; | |||
Plog(1,"m_dither3 \n"); | Plog(1,"m_dither3 \n"); | |||
EFdither3.menuname = "dither3"; | EFdither3.menuname = "dither3"; | |||
EFdither3.menufunc = m_dither3; | EFdither3.menufunc = m_dither3; | |||
EFdither3.threadfunc = dither3_thread; // thread function | EFdither3.threadfunc = dither3_thread; // thread function | |||
EFdither3.Farea = 2; // select area usable | EFdither3.Farea = 2; // select area usable | |||
skipping to change at line 4063 | skipping to change at line 4069 | |||
if (! Fscriptrun) zdialog_restore_inputs(zd); // restore previous inputs | if (! Fscriptrun) zdialog_restore_inputs(zd); // restore previous inputs | |||
zdialog_run(zd,dither3_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,dither3_dialog_event,"save"); // run dialog - parallel | |||
RES = 4; | RES = 4; | |||
COMP = 0; | COMP = 0; | |||
return; | return; | |||
} | } | |||
// dither3 dialog event and completion function | // dither3 dialog event and completion function | |||
int dither3_dialog_event(zdialog *zd, const char *event) | int dither3_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace dither3_names; | using namespace dither3_names; | |||
int load_palette_map(cchar *file); | int load_palette_map(ch *file); | |||
char palettefile[200], *pp; | ch palettefile[200], *pp; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"apply")) zd->zstat = 1; // from script | if (strmatch(event,"apply")) zd->zstat = 1; // from script | |||
if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | |||
if (zd->zstat) | if (zd->zstat) | |||
{ | { | |||
if (zd->zstat == 1) // [apply] | if (zd->zstat == 1) // [apply] | |||
{ | { | |||
skipping to change at line 4291 | skipping to change at line 4297 | |||
namespace palette_map_names | namespace palette_map_names | |||
{ | { | |||
int Np = 0, maxNp = 2000; | int Np = 0, maxNp = 2000; | |||
int palette[2000][3]; | int palette[2000][3]; | |||
int16 RGBmap[256][256][256]; | int16 RGBmap[256][256][256]; | |||
} | } | |||
// Load a palette file and map all RGB colors to best palette color. | // Load a palette file and map all RGB colors to best palette color. | |||
// Returns palette color count, or 0 if error. | // Returns palette color count, or 0 if error. | |||
int load_palette_map(cchar *file) | int load_palette_map(ch *file) | |||
{ | { | |||
using namespace palette_map_names; | using namespace palette_map_names; | |||
void * load_palette_map_thread(void *arg); | void * load_palette_map_thread(void *arg); | |||
FILE *fid; | FILE *fid; | |||
char buffer[200]; | ch buffer[200]; | |||
int nn, R, G, B; | int nn, R, G, B; | |||
Np = 0; | Np = 0; | |||
Plog(1,"read palette file: %s \n",file); | Plog(1,"read palette file: %s \n",file); | |||
fid = fopen(file,"r"); | fid = fopen(file,"r"); | |||
if (! fid) { | if (! fid) { | |||
zmessageACK(Mwin,strerror(errno)); | zmessageACK(Mwin,strerror(errno)); | |||
return 0; | return 0; | |||
} | } | |||
skipping to change at line 4408 | skipping to change at line 4414 | |||
// tiles can be clicked to pop-up a larger zoomable image. | // tiles can be clicked to pop-up a larger zoomable image. | |||
namespace mosaic_names | namespace mosaic_names | |||
{ | { | |||
editfunc EFmosaic; // edit function data | editfunc EFmosaic; // edit function data | |||
#define maxtiles maximages | #define maxtiles maximages | |||
int iww, ihh; // base image dimensions | int iww, ihh; // base image dimensions | |||
int tww, thh; // tile size (default 32x24) | int tww, thh; // tile size (default 32x24) | |||
int mww, mhh; // image size | int mww, mhh; // image size | |||
char *tilefile[maxtiles]; // tile files list (100K x 100 --> 10M) | ch *tilefile[maxtiles]; // tile files list (100K x 100 --> 10M) | |||
uint8 *tileimage[maxtiles]; // tile images (tww x thh x 3) (10 0K x 32 x 24 x 3 --> 230M) | uint8 *tileimage[maxtiles]; // tile images (tww x thh x 3) (10 0K x 32 x 24 x 3 --> 230M) | |||
int Ntiles, Ndone; // tile image count | int Ntiles, Ndone; // tile image count | |||
float tileRGB1[maxtiles][3]; // tile mean RGB values for each t ile quadrant | float tileRGB1[maxtiles][3]; // tile mean RGB values for each t ile quadrant | |||
float tileRGB2[maxtiles][3]; // (100K x 3 x 4B --> 1.2M x 4Q -- > 4.8M) | float tileRGB2[maxtiles][3]; // (100K x 3 x 4B --> 1.2M x 4Q -- > 4.8M) | |||
float tileRGB3[maxtiles][3]; | float tileRGB3[maxtiles][3]; | |||
float tileRGB4[maxtiles][3]; | float tileRGB4[maxtiles][3]; | |||
int *tilemap; // maps image [px,py] to tile used at that position | int *tilemap; // maps image [px,py] to tile used at that position | |||
int tbusy[max_threads]; | int tbusy[NWT]; | |||
} | } | |||
// menu function | // menu function | |||
void m_mosaic(GtkWidget *, const char *menu) | void m_mosaic(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace mosaic_names; | using namespace mosaic_names; | |||
int mosaic_dialog_event(zdialog*, cchar *); | int mosaic_dialog_event(zdialog*, ch *); | |||
void mosaic_mousefunc(); | void mosaic_mousefunc(); | |||
zdialog *zd; | zdialog *zd; | |||
cchar *title = "Create Mosaic"; | ch *title = "Create Mosaic"; | |||
char label[12]; | ch label[12]; | |||
int cc; | int cc; | |||
F1_help_topic = "mosaic"; | F1_help_topic = "mosaic"; | |||
Plog(1,"m_mosaic \n"); | Plog(1,"m_mosaic \n"); | |||
EFmosaic.menuname = "Mosaic"; | EFmosaic.menuname = "Mosaic"; | |||
EFmosaic.mousefunc = mosaic_mousefunc; // mouse function | EFmosaic.mousefunc = mosaic_mousefunc; // mouse function | |||
if (! edit_setup(EFmosaic)) return; // setup edit | if (! edit_setup(EFmosaic)) return; // setup edit | |||
tww = 32; // default tile size | tww = 32; // default tile size | |||
thh = 24; | thh = 24; | |||
Ntiles = 0; // tile file and image counts | Ntiles = 0; // tile file and image counts | |||
iww = E3pxm->ww; // base image dimensions | iww = E3pxm->ww; // base image dimensions | |||
ihh = E3pxm->hh; | ihh = E3pxm->hh; | |||
cc = maxtiles * sizeof(char *); // clear tile file list | cc = maxtiles * sizeof(ch *); // clear tile file list | |||
memset(tilefile,0,cc); | memset(tilefile,0,cc); | |||
cc = maxtiles * sizeof(uint8 *); // clear tile image list | cc = maxtiles * sizeof(uint8 *); // clear tile image list | |||
memset(tileimage,0,cc); | memset(tileimage,0,cc); | |||
cc = iww * ihh * sizeof(int); // allocate image/tile map | cc = iww * ihh * sizeof(int); // allocate image/tile map | |||
tilemap = (int *) zmalloc(cc,"mosaic"); | tilemap = (int *) zmalloc(cc,"mosaic"); | |||
memset(tilemap,-1,cc); | memset(tilemap,-1,cc); | |||
/*** | /*** | |||
skipping to change at line 4507 | skipping to change at line 4513 | |||
snprintf(label,12,"%d",Ntiles); | snprintf(label,12,"%d",Ntiles); | |||
zdialog_stuff(zd,"labNtiles",label); | zdialog_stuff(zd,"labNtiles",label); | |||
zdialog_run(zd,mosaic_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,mosaic_dialog_event,"save"); // run dialog - parallel | |||
return; | return; | |||
} | } | |||
// mosaic dialog event and completion function | // mosaic dialog event and completion function | |||
int mosaic_dialog_event(zdialog *zd, const char *event) | int mosaic_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace mosaic_names; | using namespace mosaic_names; | |||
void * mosaic_thread1(void *arg); | void * mosaic_thread1(void *arg); | |||
void * mosaic_thread2(void *arg); | void * mosaic_thread2(void *arg); | |||
void mosaic_mousefunc(); | void mosaic_mousefunc(); | |||
static int block = 0; | static int block = 0; | |||
char **flist = 0; | ch **flist = 0; | |||
char label[12]; | ch label[12]; | |||
int ii, err, NF; | int ii, err, NF; | |||
int trow, tcol, tpx, tpy, ipx, ipy; | int trow, tcol, tpx, tpy, ipx, ipy; | |||
uint8 *timage, *tpix; | uint8 *timage, *tpix; | |||
float blend, f1, f3; | float blend, f1, f3; | |||
float *pix1, *pix3; | float *pix1, *pix3; | |||
if (block) return 1; | if (block) return 1; | |||
block = 1; | block = 1; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
skipping to change at line 4666 | skipping to change at line 4672 | |||
for (trow = 0; trow < ihh/thh; trow++) // loop tile positions in base image | for (trow = 0; trow < ihh/thh; trow++) // loop tile positions in base image | |||
for (tcol = 0; tcol < iww/tww; tcol++) | for (tcol = 0; tcol < iww/tww; tcol++) | |||
{ | { | |||
for (tpy = 0; tpy < thh; tpy++) // loop tile pixels | for (tpy = 0; tpy < thh; tpy++) // loop tile pixels | |||
for (tpx = 0; tpx < tww; tpx++) | for (tpx = 0; tpx < tww; tpx++) | |||
{ | { | |||
ipy = trow * thh + tpy; // corresponding image pixels | ipy = trow * thh + tpy; // corresponding image pixels | |||
ipx = tcol * tww + tpx; | ipx = tcol * tww + tpx; | |||
ii = iww * ipy + ipx; // get tile used at image pixel | ii = iww * ipy + ipx; // get tile used at image pixel | |||
ii = tilemap[ii]; | ii = tilemap[ii]; | |||
if (ii < 0 || ii >= maxtiles) break; // bugfix 23.1 | ||||
timage = tileimage[ii]; | timage = tileimage[ii]; | |||
if (! timage) continue; | ||||
tpix = timage + tpy * tww * 3 + tpx * 3; // input tile pixel | tpix = timage + tpy * tww * 3 + tpx * 3; // input tile pixel | |||
pix1 = PXMpix(E1pxm,ipx,ipy); // input E1 image pixel | pix1 = PXMpix(E1pxm,ipx,ipy); // input E1 image pixel | |||
pix3 = PXMpix(E3pxm,ipx,ipy); // output E3 image pixel | pix3 = PXMpix(E3pxm,ipx,ipy); // output E3 image pixel | |||
pix3[0] = f1 * pix1[0] + f3 * tpix[0]; // replace image pixels with tile pixels | pix3[0] = f1 * pix1[0] + f3 * tpix[0]; // replace image pixels with tile pixels | |||
pix3[1] = f1 * pix1[1] + f3 * tpix[1]; | pix3[1] = f1 * pix1[1] + f3 * tpix[1]; | |||
pix3[2] = f1 * pix1[2] + f3 * tpix[2]; | pix3[2] = f1 * pix1[2] + f3 * tpix[2]; | |||
} | } | |||
} | } | |||
Fpaint2(); | Fpaint2(); | |||
skipping to change at line 4970 | skipping to change at line 4978 | |||
return 0; | return 0; | |||
} | } | |||
// mouse function - called for mouse events inside image | // mouse function - called for mouse events inside image | |||
void mosaic_mousefunc() | void mosaic_mousefunc() | |||
{ | { | |||
using namespace mosaic_names; | using namespace mosaic_names; | |||
int ii; | int ii; | |||
char *tfile, *mfile; | ch *tfile, *mfile; | |||
if (! LMclick) return; | if (! LMclick) return; | |||
LMclick = 0; | LMclick = 0; | |||
ii = Myclick * iww + Mxclick; | ii = Myclick * iww + Mxclick; | |||
ii = tilemap[ii]; | ii = tilemap[ii]; | |||
if (ii < 0) return; | if (ii < 0) return; | |||
tfile = tilefile[ii]; | tfile = tilefile[ii]; | |||
mfile = thumb2imagefile(tfile); | mfile = thumb2imagefile(tfile); | |||
if (mfile) popup_image(mfile,MWIN,1,256); | if (mfile) popup_image(mfile,MWIN,1,256); | |||
skipping to change at line 5000 | skipping to change at line 5008 | |||
{ | { | |||
editfunc EFadd_noise; | editfunc EFadd_noise; | |||
float size; // mean noise size, pixels (diameter) | float size; // mean noise size, pixels (diameter) | |||
float level; // mean noise level, 0-100% | float level; // mean noise level, 0-100% | |||
float Pmap[22][22]; // pixel noise distribution map (max. size 20) | float Pmap[22][22]; // pixel noise distribution map (max. size 20) | |||
int Eww, Ehh; | int Eww, Ehh; | |||
} | } | |||
// menu function | // menu function | |||
void m_add_noise(GtkWidget *, const char *menu) | void m_add_noise(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace add_noise_names; | using namespace add_noise_names; | |||
int add_noise_dialog_event(zdialog* zd, const char *event); | int add_noise_dialog_event(zdialog* zd, ch *event); | |||
void * add_noise_thread(void *); | void * add_noise_thread(void *); | |||
F1_help_topic = "add noise"; | F1_help_topic = "add noise"; | |||
Plog(1,"m_add_noise \n"); | Plog(1,"m_add_noise \n"); | |||
EFadd_noise.menufunc = m_add_noise; | EFadd_noise.menufunc = m_add_noise; | |||
EFadd_noise.menuname = "Add Noise"; | EFadd_noise.menuname = "Add Noise"; | |||
EFadd_noise.Farea = 2; // select area usable | EFadd_noise.Farea = 2; // select area usable | |||
EFadd_noise.Frestart = 1; // allow restart | EFadd_noise.Frestart = 1; // allow restart | |||
skipping to change at line 5054 | skipping to change at line 5062 | |||
level = 10; | level = 10; | |||
zdialog_resize(zd,300,0); | zdialog_resize(zd,300,0); | |||
zdialog_run(zd,add_noise_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,add_noise_dialog_event,"save"); // run dialog - parallel | |||
return; | return; | |||
} | } | |||
// dialog event and completion function | // dialog event and completion function | |||
int add_noise_dialog_event(zdialog *zd, const char *event) | int add_noise_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace add_noise_names; | using namespace add_noise_names; | |||
if (strmatch(event,"done")) zd->zstat = 3; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 3; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 4; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 4; // from f_open() | |||
int rx, ry, irad; | int rx, ry, irad; | |||
float r, frad; | float r, frad; | |||
float F, sumF; | float F, sumF; | |||
skipping to change at line 5228 | skipping to change at line 5236 | |||
namespace color_depth_names | namespace color_depth_names | |||
{ | { | |||
int color_depth = 16; // bits per RGB color | int color_depth = 16; // bits per RGB color | |||
editfunc EFcolor_depth; | editfunc EFcolor_depth; | |||
int E3ww, E3hh; | int E3ww, E3hh; | |||
} | } | |||
// menu function | // menu function | |||
void m_color_depth(GtkWidget *, cchar *menu) | void m_color_depth(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace color_depth_names; | using namespace color_depth_names; | |||
int color_depth_dialog_event(zdialog *zd, cchar *event); | int color_depth_dialog_event(zdialog *zd, ch *event); | |||
void * color_depth_thread(void *); | void * color_depth_thread(void *); | |||
cchar *colmess = "Set color depth to 1-16 bits"; | ch *colmess = "Set color depth to 1-16 bits"; | |||
F1_help_topic = "color depth"; | F1_help_topic = "color depth"; | |||
Plog(1,"m_color_depth \n"); | Plog(1,"m_color_depth \n"); | |||
EFcolor_depth.menuname = "Color Depth"; | EFcolor_depth.menuname = "Color Depth"; | |||
EFcolor_depth.menufunc = m_color_depth; | EFcolor_depth.menufunc = m_color_depth; | |||
EFcolor_depth.FprevReq = 1; // use preview | EFcolor_depth.FprevReq = 1; // use preview | |||
EFcolor_depth.Farea = 2; // select area usable | EFcolor_depth.Farea = 2; // select area usable | |||
EFcolor_depth.Fpaintedits = 1; // can use with paint edits | EFcolor_depth.Fpaintedits = 1; // can use with paint edits | |||
skipping to change at line 5282 | skipping to change at line 5290 | |||
color_depth = 16; | color_depth = 16; | |||
zdialog_resize(zd,200,0); | zdialog_resize(zd,200,0); | |||
zdialog_run(zd,color_depth_dialog_event,"save"); // run dialog, parallel | zdialog_run(zd,color_depth_dialog_event,"save"); // run dialog, parallel | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int color_depth_dialog_event(zdialog *zd, cchar *event) | int color_depth_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace color_depth_names; | using namespace color_depth_names; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"focus")) return 1; | if (strmatch(event,"focus")) return 1; | |||
if (strmatch(event,"apply")) event = "colors"; // from script | if (strmatch(event,"apply")) event = "colors"; // from script | |||
if (strmatch(event,"done")) zd->zstat = 1; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 1; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 2; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 2; // from f_open() | |||
if (strmatch(event,"fullsize")) { // from select area | if (strmatch(event,"fullsize")) { // from select area | |||
skipping to change at line 5393 | skipping to change at line 5401 | |||
namespace shiftcolors_names | namespace shiftcolors_names | |||
{ | { | |||
editfunc EFshiftcolors; // edit function data | editfunc EFshiftcolors; // edit function data | |||
float shiftred = 0.5, shiftgreen = 0.5, shiftblue = 0.5; | float shiftred = 0.5, shiftgreen = 0.5, shiftblue = 0.5; | |||
int E3ww, E3hh; | int E3ww, E3hh; | |||
} | } | |||
// menu function | // menu function | |||
void m_shift_colors(GtkWidget *, cchar *menu) | void m_shift_colors(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace shiftcolors_names; | using namespace shiftcolors_names; | |||
int shiftcolors_dialog_event(zdialog* zd, const char *event); | int shiftcolors_dialog_event(zdialog* zd, ch *event); | |||
void * shiftcolors_thread(void *); | void * shiftcolors_thread(void *); | |||
F1_help_topic = "shift colors"; | F1_help_topic = "shift colors"; | |||
Plog(1,"m_shift_colors \n"); | Plog(1,"m_shift_colors \n"); | |||
EFshiftcolors.menuname = "Shift Colors"; | EFshiftcolors.menuname = "Shift Colors"; | |||
EFshiftcolors.menufunc = m_shift_colors; | EFshiftcolors.menufunc = m_shift_colors; | |||
EFshiftcolors.FprevReq = 1; // use preview | EFshiftcolors.FprevReq = 1; // use preview | |||
EFshiftcolors.Farea = 2; // select area OK | EFshiftcolors.Farea = 2; // select area OK | |||
skipping to change at line 5471 | skipping to change at line 5479 | |||
shiftred = shiftgreen = shiftblue = 0.5; // neutral values | shiftred = shiftgreen = shiftblue = 0.5; // neutral values | |||
zdialog_resize(zd,400,0); | zdialog_resize(zd,400,0); | |||
zdialog_run(zd,shiftcolors_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,shiftcolors_dialog_event,"save"); // run dialog - parallel | |||
return; | return; | |||
} | } | |||
// shift color dialog event and completion function | // shift color dialog event and completion function | |||
int shiftcolors_dialog_event(zdialog *zd, const char *event) | int shiftcolors_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace shiftcolors_names; | using namespace shiftcolors_names; | |||
float shiftall; | float shiftall; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 2; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 3; // from f_open() | |||
if (strmatch(event,"fullsize")) { // from select area | if (strmatch(event,"fullsize")) { // from select area | |||
skipping to change at line 5673 | skipping to change at line 5681 | |||
namespace alien_colors_names | namespace alien_colors_names | |||
{ | { | |||
editfunc EFaliencolors; | editfunc EFaliencolors; | |||
float BLsz, Ampl; // block size, amplitude | float BLsz, Ampl; // block size, amplitude | |||
float Frand[200][200]; // random numbers | float Frand[200][200]; // random numbers | |||
#define maxblocks 200 // max. rows and cols | #define maxblocks 200 // max. rows and cols | |||
} | } | |||
// menu function | // menu function | |||
void m_alien_colors(GtkWidget *, cchar *menu) | void m_alien_colors(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace alien_colors_names; | using namespace alien_colors_names; | |||
int alien_colors_dialog_event(zdialog* zd, const char *event); | int alien_colors_dialog_event(zdialog* zd, ch *event); | |||
void * alien_colors_thread(void *); | void * alien_colors_thread(void *); | |||
F1_help_topic = "alien colors"; | F1_help_topic = "alien colors"; | |||
Plog(1,"m_alien_colors \n"); | Plog(1,"m_alien_colors \n"); | |||
EFaliencolors.menuname = "Alien Colors"; | EFaliencolors.menuname = "Alien Colors"; | |||
EFaliencolors.menufunc = m_alien_colors; | EFaliencolors.menufunc = m_alien_colors; | |||
EFaliencolors.Farea = 2; // select area usable | EFaliencolors.Farea = 2; // select area usable | |||
EFaliencolors.Fscript = 1; // scripting supported | EFaliencolors.Fscript = 1; // scripting supported | |||
EFaliencolors.threadfunc = alien_colors_thread; | EFaliencolors.threadfunc = alien_colors_thread; | |||
// preview mode not used - do not replace pattern when [OK] pressed 22.35 | // preview mode not used - do not replace pattern when [OK] pressed // 22.35 | |||
if (! edit_setup(EFaliencolors)) return; | if (! edit_setup(EFaliencolors)) return; | |||
/*** | /*** | |||
__________________________ | __________________________ | |||
| Alien Colors | | | Alien Colors | | |||
| | | | | | |||
| blocksize [___] | | | blocksize [___] | | |||
| amplitude [___] | | | amplitude [___] | | |||
| | | | | | |||
skipping to change at line 5723 | skipping to change at line 5731 | |||
zdialog_restore_inputs(zd); // restore previous inputs | zdialog_restore_inputs(zd); // restore previous inputs | |||
zdialog_run(zd,alien_colors_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,alien_colors_dialog_event,"save"); // run dialog - parallel | |||
zdialog_send_event(zd,"BLsz"); // initial image | zdialog_send_event(zd,"BLsz"); // initial image | |||
return; | return; | |||
} | } | |||
// alien dialog event and completion function | // alien dialog event and completion function | |||
int alien_colors_dialog_event(zdialog *zd, const char *event) // alien dialog event function | int alien_colors_dialog_event(zdialog *zd, ch *event) // alien dialog event function | |||
{ | { | |||
using namespace alien_colors_names; | using namespace alien_colors_names; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"focus")) return 1; | if (strmatch(event,"focus")) return 1; | |||
if (strmatch(event,"done")) zd->zstat = 1; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 1; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 2; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 2; // from f_open() | |||
if (zstrstr("BLsz Ampl Apply",event)) | if (zstrstr("BLsz Ampl Apply",event)) | |||
{ | { | |||
skipping to change at line 5940 | skipping to change at line 5948 | |||
namespace copy_colors_names | namespace copy_colors_names | |||
{ | { | |||
editfunc EFcopy_colors; | editfunc EFcopy_colors; | |||
int E3ww, E3hh; | int E3ww, E3hh; | |||
int Fred, Fgreen, Fblue; | int Fred, Fgreen, Fblue; | |||
} | } | |||
// menu function | // menu function | |||
void m_copy_colors(GtkWidget *, const char *menu) | void m_copy_colors(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace copy_colors_names; | using namespace copy_colors_names; | |||
int copy_colors_dialog_event(zdialog* zd, const char *event); | int copy_colors_dialog_event(zdialog* zd, ch *event); | |||
void * copy_colors_thread(void *); | void * copy_colors_thread(void *); | |||
cchar *title = "Copy Colors"; | ch *title = "Copy Colors"; | |||
F1_help_topic = "copy colors"; | F1_help_topic = "copy colors"; | |||
Plog(1,"m_copy_colors \n"); | Plog(1,"m_copy_colors \n"); | |||
EFcopy_colors.menuname = "Copy Colors"; | EFcopy_colors.menuname = "Copy Colors"; | |||
EFcopy_colors.menufunc = m_copy_colors; | EFcopy_colors.menufunc = m_copy_colors; | |||
EFcopy_colors.Farea = 2; // allow select area | EFcopy_colors.Farea = 2; // allow select area | |||
EFcopy_colors.Frestart = 1; // allow restart | EFcopy_colors.Frestart = 1; // allow restart | |||
EFcopy_colors.threadfunc = copy_colors_thread; | EFcopy_colors.threadfunc = copy_colors_thread; | |||
skipping to change at line 5996 | skipping to change at line 6004 | |||
Fred = Fgreen = Fblue = 1; | Fred = Fgreen = Fblue = 1; | |||
zdialog_run(zd,copy_colors_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,copy_colors_dialog_event,"save"); // run dialog - parallel | |||
return; | return; | |||
} | } | |||
// copy_colors dialog event and completion function | // copy_colors dialog event and completion function | |||
int copy_colors_dialog_event(zdialog *zd, const char *event) // copy_colors dialog event function | int copy_colors_dialog_event(zdialog *zd, ch *event) // copy_colors dialog event function | |||
{ | { | |||
using namespace copy_colors_names; | using namespace copy_colors_names; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"apply")) zd->zstat = 1; // from script file | if (strmatch(event,"apply")) zd->zstat = 1; // from script file | |||
if (strmatch(event,"done")) zd->zstat = 1; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 1; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 2; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 2; // from f_open() | |||
if (zd->zstat) | if (zd->zstat) | |||
{ | { | |||
skipping to change at line 6097 | skipping to change at line 6105 | |||
/******************************************************************************* */ | /******************************************************************************* */ | |||
// paste selected RGB color planes from selected image | // paste selected RGB color planes from selected image | |||
namespace paste_colors_names | namespace paste_colors_names | |||
{ | { | |||
editfunc EFpaste_colors; | editfunc EFpaste_colors; | |||
int E3ww, E3hh; | int E3ww, E3hh; | |||
int Fred, Fgreen, Fblue; | int Fred, Fgreen, Fblue; | |||
char *file9 = 0; | ch *file9 = 0; | |||
} | } | |||
// menu function | // menu function | |||
void m_paste_colors(GtkWidget *, const char *menu) | void m_paste_colors(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace paste_colors_names; | using namespace paste_colors_names; | |||
int paste_colors_dialog_event(zdialog* zd, const char *event); | int paste_colors_dialog_event(zdialog* zd, ch *event); | |||
void * paste_colors_thread(void *); | void * paste_colors_thread(void *); | |||
cchar *title = "Paste Colors"; | ch *title = "Paste Colors"; | |||
F1_help_topic = "paste colors"; | F1_help_topic = "paste colors"; | |||
Plog(1,"m_paste_colors \n"); | Plog(1,"m_paste_colors \n"); | |||
EFpaste_colors.menuname = "Paste Colors"; | EFpaste_colors.menuname = "Paste Colors"; | |||
EFpaste_colors.menufunc = m_paste_colors; | EFpaste_colors.menufunc = m_paste_colors; | |||
EFpaste_colors.Farea = 2; // allow select area | EFpaste_colors.Farea = 2; // allow select area | |||
EFpaste_colors.Frestart = 1; // allow restart | EFpaste_colors.Frestart = 1; // allow restart | |||
EFpaste_colors.threadfunc = paste_colors_thread; | EFpaste_colors.threadfunc = paste_colors_thread; | |||
skipping to change at line 6164 | skipping to change at line 6172 | |||
Fred = Fgreen = Fblue = 0; // no colors selected | Fred = Fgreen = Fblue = 0; // no colors selected | |||
E9pxm = 0; // no file selected | E9pxm = 0; // no file selected | |||
zdialog_run(zd,paste_colors_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,paste_colors_dialog_event,"save"); // run dialog - parallel | |||
return; | return; | |||
} | } | |||
// paste_colors dialog event and completion function | // paste_colors dialog event and completion function | |||
int paste_colors_dialog_event(zdialog *zd, const char *event) // paste_colors dialog event function | int paste_colors_dialog_event(zdialog *zd, ch *event) // paste_colors dialog event function | |||
{ | { | |||
using namespace paste_colors_names; | using namespace paste_colors_names; | |||
PXM *pxmtemp; | PXM *pxmtemp; | |||
int E9ww, E9hh, mww, mhh; | int E9ww, E9hh, mww, mhh; | |||
float R1, R2; | float R1, R2; | |||
char *pp; | ch *pp; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"apply")) zd->zstat = 1; // from script file | if (strmatch(event,"apply")) zd->zstat = 1; // from script file | |||
if (strmatch(event,"done")) zd->zstat = 1; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 1; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 2; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 2; // from f_open() | |||
if (zd->zstat) | if (zd->zstat) | |||
{ | { | |||
if (zd->zstat == 1) edit_done(0); // commit edit | if (zd->zstat == 1) edit_done(0); // commit edit | |||
else edit_cancel(0); // discard edit | else edit_cancel(0); // discard edit | |||
skipping to change at line 6322 | skipping to change at line 6330 | |||
namespace anykernel_names | namespace anykernel_names | |||
{ | { | |||
int Eww, Ehh; // image dimensions | int Eww, Ehh; // image dimensions | |||
int kernsize = 5; // kernel size, N x N | int kernsize = 5; // kernel size, N x N | |||
float fmpyer = 1.0; // multiplier | float fmpyer = 1.0; // multiplier | |||
int fadder = 0; // adder | int fadder = 0; // adder | |||
int kernel[15][15]; // up to 15 x 15 | int kernel[15][15]; // up to 15 x 15 | |||
editfunc EFanykernel; | editfunc EFanykernel; | |||
} | } | |||
void m_anykernel(GtkWidget *, cchar *menu) // menu function | void m_anykernel(GtkWidget *, ch *menu) // menu function | |||
{ | { | |||
using namespace anykernel_names; | using namespace anykernel_names; | |||
int anykernel_make_dialog(void); | int anykernel_make_dialog(void); | |||
void * anykernel_thread(void *); | void * anykernel_thread(void *); | |||
F1_help_topic = "custom kernel"; | F1_help_topic = "custom kernel"; | |||
Plog(1,"m_anykernel \n"); | Plog(1,"m_anykernel \n"); | |||
skipping to change at line 6355 | skipping to change at line 6363 | |||
anykernel_make_dialog(); | anykernel_make_dialog(); | |||
return; | return; | |||
} | } | |||
// build the input dialog with the requested array size | // build the input dialog with the requested array size | |||
int anykernel_make_dialog() | int anykernel_make_dialog() | |||
{ | { | |||
using namespace anykernel_names; | using namespace anykernel_names; | |||
int anykernel_dialog_event(zdialog *zd, cchar *event); | int anykernel_dialog_event(zdialog *zd, ch *event); | |||
zdialog *zd; | zdialog *zd; | |||
int row, col; | int row, col; | |||
char rowname[16], cellname[30]; | ch rowname[16], cellname[30]; | |||
/*** | /*** | |||
__________________________________________ | __________________________________________ | |||
| Custom Kernel | | | Custom Kernel | | |||
| | | | | | |||
| Kernel size [___] | | | Kernel size [___] | | |||
| | | | | | |||
| [____] [____] [____] [____] [____] ... | | | [____] [____] [____] [____] [____] ... | | |||
| [____] [____] [____] [____] [____] ... | | | [____] [____] [____] [____] [____] ... | | |||
| [____] [____] [____] [____] [____] ... | | | [____] [____] [____] [____] [____] ... | | |||
skipping to change at line 6422 | skipping to change at line 6430 | |||
zdialog_add_widget(zd,"label","labfile","hbfile","Data file","space=3"); | zdialog_add_widget(zd,"label","labfile","hbfile","Data file","space=3"); | |||
zdialog_add_widget(zd,"button","load","hbfile","Load","space=3"); | zdialog_add_widget(zd,"button","load","hbfile","Load","space=3"); | |||
zdialog_add_widget(zd,"button","save","hbfile","Save","space=3"); | zdialog_add_widget(zd,"button","save","hbfile","Save","space=3"); | |||
zdialog_run(zd,anykernel_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,anykernel_dialog_event,"save"); // run dialog - parallel | |||
return 1; | return 1; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int anykernel_dialog_event(zdialog *zd, cchar *event) | int anykernel_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace anykernel_names; | using namespace anykernel_names; | |||
int row, col, err, nn, kernsize2; | int row, col, err, nn, kernsize2; | |||
float value; | float value; | |||
char cellname[20]; | ch cellname[20]; | |||
char *filename, dirname[200]; | ch *filename, dirname[200]; | |||
FILE *fid; | FILE *fid; | |||
cchar *mess = "Load settings from file"; | ch *mess = "Load settings from file"; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"focus")) return 1; | if (strmatch(event,"focus")) return 1; | |||
if (strmatch(event,"apply")) zd->zstat = 2; // from script | if (strmatch(event,"apply")) zd->zstat = 2; // from script | |||
if (strmatch(event,"done")) zd->zstat = 3; // from edit_setup() or f_save() | if (strmatch(event,"done")) zd->zstat = 3; // from edit_setup() or f_save() | |||
if (strmatch(event,"cancel")) zd->zstat = 4; // from f_open() | if (strmatch(event,"cancel")) zd->zstat = 4; // from f_open() | |||
if (zd->zstat) | if (zd->zstat) | |||
{ | { | |||
if (zd->zstat == 1) // reset | if (zd->zstat == 1) // reset | |||
skipping to change at line 6565 | skipping to change at line 6573 | |||
int index = *((int *) arg); | int index = *((int *) arg); | |||
int px, py, qx, qy; | int px, py, qx, qy; | |||
int ii, rad, dist = 0; | int ii, rad, dist = 0; | |||
float kval, red, green, blue; | float kval, red, green, blue; | |||
float f1, f2; | float f1, f2; | |||
float *pix1, *pix3, *pixN; | float *pix1, *pix3, *pixN; | |||
float max$; | float max$; | |||
rad = kernsize / 2; // image margins, not processed | rad = kernsize / 2; // image margins, not processed | |||
for (py = index+rad; py < Ehh-rad; py += NWT) // loop all image pixels | for (py = index+rad; py < Ehh-rad; py += NWT) // loop all image pixels | |||
for (px = rad; px < Eww-rad; px++) | for (px = rad; px < Eww-rad; px++) | |||
{ | { | |||
if (sa_stat == 3) { // select area active | if (sa_stat == 3) { // select area active | |||
ii = py * Eww + px; | ii = py * Eww + px; | |||
dist = sa_pixmap[ii]; // distance from edge | dist = sa_pixmap[ii]; // distance from edge | |||
if (! dist) continue; // outside pixel | if (! dist) continue; // outside pixel | |||
} | } | |||
red = green = blue = 0; | red = green = blue = 0; | |||
End of changes. 109 change blocks. | ||||
113 lines changed or deleted | 122 lines changed or added |