f.refine.cc (fotoxx-23.0) | : | f.refine.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 51 | skipping to change at line 51 | |||
/******************************************************************************* */ | /******************************************************************************* */ | |||
// automatic image enhancement without user guidance | // automatic image enhancement without user guidance | |||
float voodoo1_brdist[256]; // pixel count per brightness level | float voodoo1_brdist[256]; // pixel count per brightness level | |||
int voodoo_01, voodoo_99; // 1% and 99% brightness levels (0 - 255) | int voodoo_01, voodoo_99; // 1% and 99% brightness levels (0 - 255) | |||
void * voodoo1_thread(void *); | void * voodoo1_thread(void *); | |||
editfunc EFvoodoo1; | editfunc EFvoodoo1; | |||
void m_voodoo1(GtkWidget *, cchar *menu) | void m_voodoo1(GtkWidget *, ch *menu) | |||
{ | { | |||
F1_help_topic = "voodoo 1"; | F1_help_topic = "voodoo 1"; | |||
Plog(1,"m_voodoo1 \n"); | Plog(1,"m_voodoo1 \n"); | |||
EFvoodoo1.menuname = "Voodoo 1"; | EFvoodoo1.menuname = "Voodoo 1"; | |||
EFvoodoo1.menufunc = m_voodoo1; | EFvoodoo1.menufunc = m_voodoo1; | |||
EFvoodoo1.Farea = 1; // select area ignored | EFvoodoo1.Farea = 1; // select area ignored | |||
EFvoodoo1.Fscript = 1; // scripting supported | EFvoodoo1.Fscript = 1; // scripting supported | |||
EFvoodoo1.threadfunc = voodoo1_thread; | EFvoodoo1.threadfunc = voodoo1_thread; | |||
skipping to change at line 174 | skipping to change at line 174 | |||
pix3[2] = B3; | pix3[2] = B3; | |||
} | } | |||
return 0; | return 0; | |||
} | } | |||
/******************************************************************************* */ | /******************************************************************************* */ | |||
// 1-button enhancement via zonal flatten brightness distribution | // 1-button enhancement via zonal flatten brightness distribution | |||
void m_voodoo2(GtkWidget *, cchar *menu) | void m_voodoo2(GtkWidget *, ch *menu) | |||
{ | { | |||
void flatten_dist_func(int NZ, int flatten, int deband1, int deband2); | void flatten_dist_func(int NZ, int flatten, int deband1, int deband2); | |||
F1_help_topic = "voodoo 2"; | F1_help_topic = "voodoo 2"; | |||
flatten_dist_func(60,40,50,70); | flatten_dist_func(60,40,50,70); | |||
return; | return; | |||
} | } | |||
/******************************************************************************* */ | /******************************************************************************* */ | |||
// edit brightness distribution | // edit brightness distribution | |||
namespace edit_dist_names | namespace edit_dist_names | |||
{ | { | |||
int ww, hh; | int ww, hh; | |||
float LC, HC; // low, high cutoff levels | float LC, HC; // low, high cutoff levels | |||
float LF, MF, HF; // low, mid, high flatten parms | float LF, MF, HF; // low, mid, high flatten parms | |||
float LS, MS, HS; // low, mid, high stretch parms | float LS, MS, HS; // low, mid, high stretch parms | |||
float BB[1000]; // adjusted B for input B 0-999 | float BB[1000]; // adjusted B for input B 0-999 | |||
int dialog_event(zdialog* zd, cchar *event); | int dialog_event(zdialog* zd, ch *event); | |||
void compute_BB(); | void compute_BB(); | |||
void * thread(void *); | void * thread(void *); | |||
void * wthread(void *); | void * wthread(void *); | |||
editfunc EFedit_dist; | editfunc EFedit_dist; | |||
} | } | |||
// menu function | // menu function | |||
void m_edit_dist(GtkWidget *, cchar *menu) | void m_edit_dist(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace edit_dist_names; | using namespace edit_dist_names; | |||
cchar *title = "Edit Brightness Distribution"; | ch *title = "Edit Brightness Distribution"; | |||
F1_help_topic = "edit dist"; | F1_help_topic = "edit dist"; | |||
Plog(1,"m_edit_dist \n"); | Plog(1,"m_edit_dist \n"); | |||
EFedit_dist.menuname = "Edit Dist"; | EFedit_dist.menuname = "Edit Dist"; | |||
EFedit_dist.menufunc = m_edit_dist; | EFedit_dist.menufunc = m_edit_dist; | |||
EFedit_dist.FprevReq = 1; // preview | EFedit_dist.FprevReq = 1; // preview | |||
EFedit_dist.Farea = 2; // select area usable | EFedit_dist.Farea = 2; // select area usable | |||
EFedit_dist.Frestart = 1; // restart allowed | EFedit_dist.Frestart = 1; // restart allowed | |||
skipping to change at line 278 | skipping to change at line 278 | |||
zdialog_run(zd,dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,dialog_event,"save"); // run dialog - parallel | |||
LC = HC = LF = MF = HF = LS = MS = HS = 0.0; | LC = HC = LF = MF = HF = LS = MS = HS = 0.0; | |||
compute_BB(); | compute_BB(); | |||
return; | return; | |||
} | } | |||
// dialog event and completion function | // dialog event and completion function | |||
int edit_dist_names::dialog_event(zdialog *zd, cchar *event) | int edit_dist_names::dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace edit_dist_names; | using namespace edit_dist_names; | |||
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; // apply and quit | if (strmatch(event,"done")) zd->zstat = 2; // apply and quit | |||
if (strmatch(event,"cancel")) zd->zstat = 3; // cancel | if (strmatch(event,"cancel")) zd->zstat = 3; // cancel | |||
if (strmatch(event,"fullsize")) { // from select area | if (strmatch(event,"fullsize")) { // from select area | |||
edit_fullsize(); // get full size image | edit_fullsize(); // get full size image | |||
compute_BB(); | compute_BB(); | |||
skipping to change at line 549 | skipping to change at line 549 | |||
int Zsize, Zrows, Zcols; // zone parameters | int Zsize, Zrows, Zcols; // zone parameters | |||
float *Br; // Br[py][px] pixel brightn ess | float *Br; // Br[py][px] pixel brightn ess | |||
int *Zxlo, *Zylo, *Zxhi, *Zyhi; // Zxlo[ii] etc. zone ii pi xel range | int *Zxlo, *Zylo, *Zxhi, *Zyhi; // Zxlo[ii] etc. zone ii pi xel range | |||
int *Zcen; // Zcen[ii][2] zone ii cent er (py,px) | int *Zcen; // Zcen[ii][2] zone ii cent er (py,px) | |||
int16 *Zn; // Zn[py][px][9] 9 nearest zones for pixel: 0-999 (-1 = none) | int16 *Zn; // Zn[py][px][9] 9 nearest zones for pixel: 0-999 (-1 = none) | |||
uint8 *Zw; // Zw[py][px][9] zone weigh ts for pixel: 0-100 = 1.0 | uint8 *Zw; // Zw[py][px][9] zone weigh ts for pixel: 0-100 = 1.0 | |||
float *Zff; // Zff[ii][1000] zone ii fl atten factors | float *Zff; // Zff[ii][1000] zone ii fl atten factors | |||
editfunc EFflatten_dist; | editfunc EFflatten_dist; | |||
int dialog_event(zdialog* zd, cchar *event); | int dialog_event(zdialog* zd, ch *event); | |||
void doflatten(); | void doflatten(); | |||
void calczones(); | void calczones(); | |||
void initzones(); | void initzones(); | |||
void * thread(void *); | void * thread(void *); | |||
void * wthread(void *); | void * wthread(void *); | |||
} | } | |||
// menu function | // menu function | |||
void m_flatten_dist(GtkWidget *, cchar *menu) | void m_flatten_dist(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace flatten_dist_names; | using namespace flatten_dist_names; | |||
cchar *title = "Flatten Brightness Distribution"; | ch *title = "Flatten Brightness Distribution"; | |||
F1_help_topic = "flatten dist"; | F1_help_topic = "flatten dist"; | |||
Plog(1,"m_flatten_dist \n"); | Plog(1,"m_flatten_dist \n"); | |||
if (! curr_file) return; | if (! curr_file) return; | |||
Eww = Fpxb->ww; | Eww = Fpxb->ww; | |||
Ehh = Fpxb->hh; | Ehh = Fpxb->hh; | |||
skipping to change at line 631 | skipping to change at line 631 | |||
NZ = pNZ = 40; // default zone count | NZ = pNZ = 40; // default zone count | |||
calczones(); // adjust to fit image | calczones(); // adjust to fit image | |||
flatten = deband1 = deband2 = 0; // dialog controls = neutral | flatten = deband1 = deband2 = 0; // dialog controls = neutral | |||
Zinit = 1; // zone initialization needed | Zinit = 1; // zone initialization needed | |||
Br = 0; // no memory allocated | Br = 0; // no memory allocated | |||
return; | return; | |||
} | } | |||
// dialog event and completion function | // dialog event and completion function | |||
int flatten_dist_names::dialog_event(zdialog *zd, cchar *event) | int flatten_dist_names::dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace flatten_dist_names; | using namespace flatten_dist_names; | |||
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; // apply and quit | if (strmatch(event,"done")) zd->zstat = 2; // apply and quit | |||
if (strmatch(event,"cancel")) zd->zstat = 3; // cancel | if (strmatch(event,"cancel")) zd->zstat = 3; // cancel | |||
if (strmatch(event,"fullsize")) { // from select area | if (strmatch(event,"fullsize")) { // from select area | |||
edit_fullsize(); | edit_fullsize(); | |||
Zinit = 1; | Zinit = 1; | |||
skipping to change at line 1111 | skipping to change at line 1111 | |||
float Fpower; // function power, 0-1 | float Fpower; // function power, 0-1 | |||
float Fbrite; // brightness increase, 0-1 | float Fbrite; // brightness increase, 0-1 | |||
float Fcolor; // color increase, 0-1 | float Fcolor; // color increase, 0-1 | |||
int Fnewrad, Fnewpower, Fnewbrite, Fnewcolor; // flags, new inputs available | int Fnewrad, Fnewpower, Fnewbrite, Fnewcolor; // flags, new inputs available | |||
int Eww, Ehh; // E1/E3 image size | int Eww, Ehh; // E1/E3 image size | |||
editfunc EFlocalcon; // edit function struct | editfunc EFlocalcon; // edit function struct | |||
} | } | |||
// menu function | // menu function | |||
void m_localcon(GtkWidget *, cchar *menu) // reduce halo effects | void m_localcon(GtkWidget *, ch *menu) // reduce halo effects | |||
{ | { | |||
using namespace localcon_names; | using namespace localcon_names; | |||
int localcon_dialog_event(zdialog *zd, cchar *event); | int localcon_dialog_event(zdialog *zd, ch *event); | |||
void * localcon_thread(void *); | void * localcon_thread(void *); | |||
F1_help_topic = "local contrast"; | F1_help_topic = "local contrast"; | |||
Plog(1,"m_localcon \n"); | Plog(1,"m_localcon \n"); | |||
cchar *title = "Local Contrast"; | ch *title = "Local Contrast"; | |||
EFlocalcon.menuname = "Local Contrast"; | EFlocalcon.menuname = "Local Contrast"; | |||
EFlocalcon.menufunc = m_localcon; | EFlocalcon.menufunc = m_localcon; | |||
EFlocalcon.Farea = 2; // select area usable | EFlocalcon.Farea = 2; // select area usable | |||
EFlocalcon.Frestart = 1; // allow restart | EFlocalcon.Frestart = 1; // allow restart | |||
EFlocalcon.Fscript = 1; // scripting supported | EFlocalcon.Fscript = 1; // scripting supported | |||
EFlocalcon.Fpaintedits = 1; // use with paint edits OK | EFlocalcon.Fpaintedits = 1; // use with paint edits OK | |||
EFlocalcon.threadfunc = localcon_thread; // thread function | EFlocalcon.threadfunc = localcon_thread; // thread function | |||
if (! edit_setup(EFlocalcon)) return; // setup edit | if (! edit_setup(EFlocalcon)) return; // setup edit | |||
skipping to change at line 1190 | skipping to change at line 1190 | |||
zdialog_resize(zd,200,0); | zdialog_resize(zd,200,0); | |||
zdialog_run(zd,localcon_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,localcon_dialog_event,"save"); // run dialog - parallel | |||
thread_signal(); | thread_signal(); | |||
return; | return; | |||
} | } | |||
// dialog event and completion function | // dialog event and completion function | |||
int localcon_dialog_event(zdialog *zd, cchar *event) | int localcon_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace localcon_names; | using namespace localcon_names; | |||
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; // apply and quit | if (strmatch(event,"done")) zd->zstat = 2; // apply and quit | |||
if (strmatch(event,"cancel")) zd->zstat = 3; // cancel | if (strmatch(event,"cancel")) zd->zstat = 3; // cancel | |||
if (strmatch(event,"apply")) event = "power"; // from script | if (strmatch(event,"apply")) event = "power"; // from script | |||
if (zd->zstat) | if (zd->zstat) | |||
skipping to change at line 1599 | skipping to change at line 1599 | |||
{ | { | |||
float *brmap1, *brmap2; | float *brmap1, *brmap2; | |||
float *brmap4[4]; | float *brmap4[4]; | |||
int Fnewmap; | int Fnewmap; | |||
int contrast99; | int contrast99; | |||
float amplify; | float amplify; | |||
int Eww, Ehh; | int Eww, Ehh; | |||
editfunc EFgradients; | editfunc EFgradients; | |||
void gradients_initz(zdialog *zd); | void gradients_initz(zdialog *zd); | |||
int gradients_dialog_event(zdialog *zd, cchar *event); | int gradients_dialog_event(zdialog *zd, ch *event); | |||
void gradients_curvedit(int); | void gradients_curvedit(int); | |||
void * gradients_thread(void *); | void * gradients_thread(void *); | |||
void * gradients_wthread1(void *arg); | void * gradients_wthread1(void *arg); | |||
void * gradients_wthread2(void *arg); | void * gradients_wthread2(void *arg); | |||
} | } | |||
// menu function | // menu function | |||
void m_gradients(GtkWidget *, cchar *menu) | void m_gradients(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace gradients_names; | using namespace gradients_names; | |||
cchar *title = "Magnify Gradients"; | ch *title = "Magnify Gradients"; | |||
F1_help_topic = "gradients"; | F1_help_topic = "gradients"; | |||
Plog(1,"m_gradients \n"); | Plog(1,"m_gradients \n"); | |||
EFgradients.menuname = "Gradients"; | EFgradients.menuname = "Gradients"; | |||
EFgradients.menufunc = m_gradients; | EFgradients.menufunc = m_gradients; | |||
EFgradients.Farea = 2; // select area usable | EFgradients.Farea = 2; // select area usable | |||
EFgradients.Frestart = 1; // restart allowed | EFgradients.Frestart = 1; // restart allowed | |||
EFgradients.Fpaintedits = 1; // use with paint edits OK | EFgradients.Fpaintedits = 1; // use with paint edits OK | |||
skipping to change at line 1756 | skipping to change at line 1756 | |||
} | } | |||
contrast99 = 255.0 * ii / 100.0; // 0 to 255 | contrast99 = 255.0 * ii / 100.0; // 0 to 255 | |||
if (contrast99 < 4) contrast99 = 4; // rescale low-contrast image | if (contrast99 < 4) contrast99 = 4; // rescale low-contrast image | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int gradients_names::gradients_dialog_event(zdialog *zd, cchar *event) | int gradients_names::gradients_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace gradients_names; | using namespace gradients_names; | |||
spldat *sd = EFgradients.sd; | spldat *sd = EFgradients.sd; | |||
char text[8]; | ch text[8]; | |||
char *file, *pp; | ch *file, *pp; | |||
FILE *fid; | FILE *fid; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
if (strmatch(event,"done")) zd->zstat = 1; // apply and quit | if (strmatch(event,"done")) zd->zstat = 1; // apply and quit | |||
if (strmatch(event,"cancel")) zd->zstat = 2; // cancel | if (strmatch(event,"cancel")) zd->zstat = 2; // cancel | |||
if (zd->zstat) { // dialog complete | if (zd->zstat) { // dialog complete | |||
if (zd->zstat == 1) edit_done(0); | if (zd->zstat == 1) edit_done(0); | |||
else edit_cancel(0); | else edit_cancel(0); | |||
zfree(brmap1); // free memory | zfree(brmap1); // free memory | |||
skipping to change at line 2047 | skipping to change at line 2047 | |||
/******************************************************************************* */ | /******************************************************************************* */ | |||
// Global Retinex function | // Global Retinex function | |||
// Rescale RGB values based on entire image - eliminate color caste and reduce fog/haze. | // Rescale RGB values based on entire image - eliminate color caste and reduce fog/haze. | |||
namespace gretinex_names | namespace gretinex_names | |||
{ | { | |||
editfunc EFgretinex; // edit function data | editfunc EFgretinex; // edit function data | |||
int E3ww, E3hh; | int E3ww, E3hh; | |||
cchar *thread_command; | ch *thread_command; | |||
VOL int Fcancel; | VOL int Fcancel; | |||
float Rdark, Gdark, Bdark; | float Rdark, Gdark, Bdark; | |||
float Rbrite, Gbrite, Bbrite; | float Rbrite, Gbrite, Bbrite; | |||
float Rmpy, Gmpy, Bmpy; | float Rmpy, Gmpy, Bmpy; | |||
float pRdark, pGdark, pBdark; // prior values | float pRdark, pGdark, pBdark; // prior values | |||
float pRbrite, pGbrite, pBbrite; | float pRbrite, pGbrite, pBbrite; | |||
float pRmpy, pGmpy, pBmpy; | float pRmpy, pGmpy, pBmpy; | |||
float blend, reducebright; | float blend, reducebright; | |||
int Fbrightpoint, Fdarkpoint; | int Fbrightpoint, Fdarkpoint; | |||
} | } | |||
// menu function | // menu function | |||
void m_gretinex(GtkWidget *, cchar *menu) | void m_gretinex(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace gretinex_names; | using namespace gretinex_names; | |||
int gretinex_dialog_event(zdialog *zd, cchar *event); | int gretinex_dialog_event(zdialog *zd, ch *event); | |||
void gretinex_mousefunc(); | void gretinex_mousefunc(); | |||
void * gretinex_thread(void *); | void * gretinex_thread(void *); | |||
F1_help_topic = "global retinex"; | F1_help_topic = "global retinex"; | |||
Plog(1,"m_gretinex \n"); | Plog(1,"m_gretinex \n"); | |||
EFgretinex.menuname = "Global Retinex"; | EFgretinex.menuname = "Global Retinex"; | |||
EFgretinex.menufunc = m_gretinex; | EFgretinex.menufunc = m_gretinex; | |||
EFgretinex.Farea = 2; // select area usable | EFgretinex.Farea = 2; // select area usable | |||
skipping to change at line 2169 | skipping to change at line 2169 | |||
zdialog_add_widget(zd,"label","labrd","hbrd","reduce bright","space=5"); | zdialog_add_widget(zd,"label","labrd","hbrd","reduce bright","space=5"); | |||
zdialog_add_widget(zd,"hscale","reduce bright","hbrd","0|1.0|0.01|0.0","expan d"); | zdialog_add_widget(zd,"hscale","reduce bright","hbrd","0|1.0|0.01|0.0","expan d"); | |||
zdialog_run(zd,gretinex_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,gretinex_dialog_event,"save"); // run dialog - parallel | |||
zdialog_send_event(zd,"reset"); | zdialog_send_event(zd,"reset"); | |||
return; | return; | |||
} | } | |||
// dialog event and completion function | // dialog event and completion function | |||
int gretinex_dialog_event(zdialog *zd, cchar *event) | int gretinex_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace gretinex_names; | using namespace gretinex_names; | |||
void gretinex_mousefunc(); | void gretinex_mousefunc(); | |||
int adddark, addbrite, addmpy; | int adddark, addbrite, addmpy; | |||
int Fchange = 0; | int Fchange = 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; // stop loss of button event (?) | if (strmatch(event,"focus")) return 1; // stop loss of button event (?) | |||
skipping to change at line 2411 | skipping to change at line 2411 | |||
// get dark point or bright point from mouse click position | // get dark point or bright point from mouse click position | |||
void gretinex_mousefunc() | void gretinex_mousefunc() | |||
{ | { | |||
using namespace gretinex_names; | using namespace gretinex_names; | |||
int px, py, dx, dy; | int px, py, dx, dy; | |||
float red, green, blue; | float red, green, blue; | |||
float *ppix; | float *ppix; | |||
char mousetext[60]; | ch mousetext[60]; | |||
zdialog *zd = EFgretinex.zd; | zdialog *zd = EFgretinex.zd; | |||
if (! zd) { | if (! zd) { | |||
freeMouse(); | freeMouse(); | |||
return; | return; | |||
} | } | |||
if (! Fbrightpoint && ! Fdarkpoint) { | if (! Fbrightpoint && ! Fdarkpoint) { | |||
freeMouse(); | freeMouse(); | |||
return; | return; | |||
skipping to change at line 2706 | skipping to change at line 2706 | |||
} | } | |||
/******************************************************************************* */ | /******************************************************************************* */ | |||
// Local Retinex function | // Local Retinex function | |||
// Rescale RGB values within local areas: increase local contrast and color. | // Rescale RGB values within local areas: increase local contrast and color. | |||
namespace lretinex_names | namespace lretinex_names | |||
{ | { | |||
editfunc EFlretinex; // edit function data | editfunc EFlretinex; // edit function data | |||
cchar *thread_command; | ch *thread_command; | |||
int E1ww, E1hh; | int E1ww, E1hh; | |||
float imageblend, reducedark, reducebright; | float imageblend, reducedark, reducebright; | |||
int maxzones = 2000; | int maxzones = 2000; | |||
int Nzones = 100, Pzones = 0; // zone count, 1-2000 | int Nzones = 100, Pzones = 0; // zone count, 1-2000 | |||
int zsize, zrows, zcols, zww, zhh; // zone data | int zsize, zrows, zcols, zww, zhh; // zone data | |||
typedef struct { // zone structure | typedef struct { // zone structure | |||
int cx, cy; // zone center in image | int cx, cy; // zone center in image | |||
float minR, minG, minB; // RGB minimum values in zone | float minR, minG, minB; // RGB minimum values in zone | |||
float maxR, maxG, maxB; // RGB mazimum values in zone | float maxR, maxG, maxB; // RGB mazimum values in zone | |||
} zone_t; | } zone_t; | |||
zone_t *zones = 0; // up to 2000 zones | zone_t *zones = 0; // up to 2000 zones | |||
int16 *zoneindex = 0; // zoneindex[ii][z] pixel ii, 9 zones | int16 *zoneindex = 0; // zoneindex[ii][z] pixel ii, 9 zones | |||
int16 *zoneweight = 0; // zoneweight[ii][z] zone weights | int16 *zoneweight = 0; // zoneweight[ii][z] zone weights | |||
} | } | |||
// menu function | // menu function | |||
void m_lretinex(GtkWidget *, cchar *menu) | void m_lretinex(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace lretinex_names; | using namespace lretinex_names; | |||
int lretinex_dialog_event(zdialog *zd, cchar *event); | int lretinex_dialog_event(zdialog *zd, ch *event); | |||
void * lretinex_thread(void *); | void * lretinex_thread(void *); | |||
F1_help_topic = "local retinex"; | F1_help_topic = "local retinex"; | |||
Plog(1,"m_lretinex \n"); | Plog(1,"m_lretinex \n"); | |||
EFlretinex.menuname = "Local Retinex"; | EFlretinex.menuname = "Local Retinex"; | |||
EFlretinex.menufunc = m_lretinex; | EFlretinex.menufunc = m_lretinex; | |||
EFlretinex.Farea = 2; // select area usable | EFlretinex.Farea = 2; // select area usable | |||
EFlretinex.Frestart = 1; // allow restart | EFlretinex.Frestart = 1; // allow restart | |||
skipping to change at line 2792 | skipping to change at line 2792 | |||
zdialog_add_widget(zd,"hscale2","reduce bright","hbrl","0|1.0|0.01|0.0","expa nd"); | zdialog_add_widget(zd,"hscale2","reduce bright","hbrl","0|1.0|0.01|0.0","expa nd"); | |||
zdialog_run(zd,lretinex_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,lretinex_dialog_event,"save"); // run dialog - parallel | |||
zdialog_send_event(zd,"reset"); | zdialog_send_event(zd,"reset"); | |||
zdialog_send_event(zd,"apply"); | zdialog_send_event(zd,"apply"); | |||
return; | return; | |||
} | } | |||
// dialog event and completion function | // dialog event and completion function | |||
int lretinex_dialog_event(zdialog *zd, cchar *event) | int lretinex_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace lretinex_names; | using namespace lretinex_names; | |||
int lretinex_zonesetup(zdialog *zd); | int lretinex_zonesetup(zdialog *zd); | |||
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,"reset")) zd->zstat = 1; // initz. | if (strmatch(event,"reset")) zd->zstat = 1; // initz. | |||
skipping to change at line 3266 | skipping to change at line 3266 | |||
// or set saturation based on pixel brightness (curve). | // or set saturation based on pixel brightness (curve). | |||
namespace saturation_names | namespace saturation_names | |||
{ | { | |||
editfunc EFsaturation; | editfunc EFsaturation; | |||
float colorsat; // saturation input, -1 ... +1 | float colorsat; // saturation input, -1 ... +1 | |||
} | } | |||
// menu function | // menu function | |||
void m_saturation(GtkWidget *, cchar *menu) | void m_saturation(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace saturation_names; | using namespace saturation_names; | |||
int saturation_dialog_event(zdialog* zd, cchar *event); | int saturation_dialog_event(zdialog* zd, ch *event); | |||
void saturation_curvedit(int spc); | void saturation_curvedit(int spc); | |||
void * saturation_thread(void *); | void * saturation_thread(void *); | |||
GtkWidget *drawwin_scale; | GtkWidget *drawwin_scale; | |||
F1_help_topic = "saturation"; | F1_help_topic = "saturation"; | |||
Plog(1,"m_saturation \n"); | Plog(1,"m_saturation \n"); | |||
EFsaturation.menuname = "Saturation"; | EFsaturation.menuname = "Saturation"; | |||
skipping to change at line 3363 | skipping to change at line 3363 | |||
colorsat = 0; // neutral saturation | colorsat = 0; // neutral saturation | |||
zdialog_resize(zd,350,300); | zdialog_resize(zd,350,300); | |||
zdialog_run(zd,saturation_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,saturation_dialog_event,"save"); // run dialog - parallel | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int saturation_dialog_event(zdialog *zd, cchar *event) | int saturation_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace saturation_names; | using namespace saturation_names; | |||
spldat *sd = EFsaturation.sd; | spldat *sd = EFsaturation.sd; | |||
float sat0, dsat, dy; | float sat0, dsat, dy; | |||
float Fapply = 0; | float Fapply = 0; | |||
int ii; | int ii; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // cancel | if (strmatch(event,"escape")) zd->zstat = -2; // cancel | |||
if (strmatch(event,"done")) zd->zstat = 2; // apply and quit | if (strmatch(event,"done")) zd->zstat = 2; // apply and quit | |||
skipping to change at line 3574 | skipping to change at line 3574 | |||
namespace soft_focus_names | namespace soft_focus_names | |||
{ | { | |||
editfunc EFsoft_focus; | editfunc EFsoft_focus; | |||
float Brad, Bmix; | float Brad, Bmix; | |||
int Eww, Ehh; | int Eww, Ehh; | |||
float Bweight[101]; // for max. radius 100 | float Bweight[101]; // for max. radius 100 | |||
} | } | |||
// menu function | // menu function | |||
void m_soft_focus(GtkWidget *, cchar *menu) // 22.11 | void m_soft_focus(GtkWidget *, ch *menu) // 22.11 | |||
{ | { | |||
using namespace soft_focus_names; | using namespace soft_focus_names; | |||
int soft_focus_dialog_event(zdialog* zd, cchar *event); | int soft_focus_dialog_event(zdialog* zd, ch *event); | |||
void * soft_focus_thread(void *); | void * soft_focus_thread(void *); | |||
F1_help_topic = "soft focus"; | F1_help_topic = "soft focus"; | |||
Plog(1,"m_soft_focus \n"); | Plog(1,"m_soft_focus \n"); | |||
EFsoft_focus.menuname = "Soft Focus"; | EFsoft_focus.menuname = "Soft Focus"; | |||
EFsoft_focus.menufunc = m_soft_focus; | EFsoft_focus.menufunc = m_soft_focus; | |||
EFsoft_focus.Farea = 2; // select area usable | EFsoft_focus.Farea = 2; // select area usable | |||
EFsoft_focus.Frestart = 1; // restart allowed | EFsoft_focus.Frestart = 1; // restart allowed | |||
skipping to change at line 3628 | skipping to change at line 3628 | |||
zdialog_restore_inputs(zd); | zdialog_restore_inputs(zd); | |||
zdialog_resize(zd,350,0); | zdialog_resize(zd,350,0); | |||
zdialog_run(zd,soft_focus_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,soft_focus_dialog_event,"save"); // run dialog - parallel | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int soft_focus_dialog_event(zdialog *zd, cchar *event) | int soft_focus_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace soft_focus_names; | using namespace soft_focus_names; | |||
if (strmatch(event,"focus")) return 1; | if (strmatch(event,"focus")) return 1; | |||
zdialog_fetch(zd,"Brad",Brad); | zdialog_fetch(zd,"Brad",Brad); | |||
zdialog_fetch(zd,"Bmix",Bmix); | zdialog_fetch(zd,"Bmix",Bmix); | |||
if (strmatch(event,"escape")) zd->zstat = -2; // cancel | if (strmatch(event,"escape")) zd->zstat = -2; // cancel | |||
if (strmatch(event,"done")) zd->zstat = 2; // done | if (strmatch(event,"done")) zd->zstat = 2; // done | |||
skipping to change at line 3803 | skipping to change at line 3803 | |||
float match_colors_RGB2[3]; // image 2 target colors to match | float match_colors_RGB2[3]; // image 2 target colors to match | |||
int match_colors_radius = 10; // mouse radius | int match_colors_radius = 10; // mouse radius | |||
int match_colors_mode = 0; | int match_colors_mode = 0; | |||
int Eww, Ehh; | int Eww, Ehh; | |||
editfunc EFmatchcolors; | editfunc EFmatchcolors; | |||
} | } | |||
// menu function | // menu function | |||
void m_match_colors(GtkWidget *, const char *menu) | void m_match_colors(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace match_colors_names; | using namespace match_colors_names; | |||
int match_colors_dialog_event(zdialog* zd, const char *event); | int match_colors_dialog_event(zdialog* zd, ch *event); | |||
void * match_colors_thread(void *); | void * match_colors_thread(void *); | |||
void match_colors_mousefunc(); | void match_colors_mousefunc(); | |||
cchar *title = "Color Match Images"; | ch *title = "Color Match Images"; | |||
F1_help_topic = "match colors"; | F1_help_topic = "match colors"; | |||
Plog(1,"m_match_colors \n"); | Plog(1,"m_match_colors \n"); | |||
if (Fblock(0,"blocked edits")) return; // check nothing pending | if (Fblock(0,"blocked edits")) return; // check nothing pending | |||
// (edit_setup() follows) | // (edit_setup() follows) | |||
/*** | /*** | |||
____________________________________________ | ____________________________________________ | |||
| Color Match Images | | | Color Match Images | | |||
skipping to change at line 3877 | skipping to change at line 3877 | |||
match_colors_mode = 1; // image 1 ready to click | match_colors_mode = 1; // image 1 ready to click | |||
takeMouse(match_colors_mousefunc,0); // connect mouse function | takeMouse(match_colors_mousefunc,0); // connect mouse function | |||
} | } | |||
zdialog_run(zd,match_colors_dialog_event,"parent"); // run dialog - parallel | zdialog_run(zd,match_colors_dialog_event,"parent"); // run dialog - parallel | |||
return; | return; | |||
} | } | |||
// match_colors dialog event and completion function | // match_colors dialog event and completion function | |||
int match_colors_dialog_event(zdialog *zd, const char *event) | int match_colors_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace match_colors_names; | using namespace match_colors_names; | |||
void match_colors_mousefunc(); | void match_colors_mousefunc(); | |||
int err; | int err; | |||
char *file; | ch *file; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
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 (match_colors_mode == 4) { // edit was started | if (match_colors_mode == 4) { // edit was started | |||
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 4090 | skipping to change at line 4090 | |||
{ | { | |||
editfunc EFbrite_ramp; | editfunc EFbrite_ramp; | |||
int Fline, linex1, liney1, linex2, liney2; | int Fline, linex1, liney1, linex2, liney2; | |||
float A, B, C; | float A, B, C; | |||
float ex1, ey1, ex2, ey2; | float ex1, ey1, ex2, ey2; | |||
int Eww, Ehh; | int Eww, Ehh; | |||
} | } | |||
// menu function | // menu function | |||
void m_brite_ramp(GtkWidget *, cchar *menu) | void m_brite_ramp(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace brite_ramp_names; | using namespace brite_ramp_names; | |||
void brite_ramp_curvedit(int spc); | void brite_ramp_curvedit(int spc); | |||
int brite_ramp_dialog_event(zdialog* zd, cchar *event); | int brite_ramp_dialog_event(zdialog* zd, ch *event); | |||
void * brite_ramp_thread(void *); | void * brite_ramp_thread(void *); | |||
void brite_ramp_mousefunc(); | void brite_ramp_mousefunc(); | |||
cchar *mess = "Draw a line across the image in \n" | ch *mess = "Draw a line across the image in \n" | |||
"direction of brightness change."; | "direction of brightness change."; | |||
F1_help_topic = "brite ramp"; | F1_help_topic = "brite ramp"; | |||
Plog(1,"m_brite_ramp \n"); | Plog(1,"m_brite_ramp \n"); | |||
EFbrite_ramp.menuname = "Brite Ramp"; | EFbrite_ramp.menuname = "Brite Ramp"; | |||
EFbrite_ramp.menufunc = m_brite_ramp; | EFbrite_ramp.menufunc = m_brite_ramp; | |||
EFbrite_ramp.FprevReq = 1; // use preview | EFbrite_ramp.FprevReq = 1; // use preview | |||
EFbrite_ramp.Fscript = 1; // scripting supported | EFbrite_ramp.Fscript = 1; // scripting supported | |||
skipping to change at line 4190 | skipping to change at line 4190 | |||
zdialog_resize(zd,200,200); | zdialog_resize(zd,200,200); | |||
zdialog_run(zd,brite_ramp_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,brite_ramp_dialog_event,"save"); // run dialog - parallel | |||
takeMouse(brite_ramp_mousefunc,dragcursor); // connect mouse | takeMouse(brite_ramp_mousefunc,dragcursor); // connect mouse | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int brite_ramp_dialog_event(zdialog *zd, cchar *event) | int brite_ramp_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace brite_ramp_names; | using namespace brite_ramp_names; | |||
void brite_ramp_mousefunc(); | void brite_ramp_mousefunc(); | |||
int ii, Fupdate = 0; | int ii, Fupdate = 0; | |||
spldat *sd = EFbrite_ramp.sd; | spldat *sd = EFbrite_ramp.sd; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
skipping to change at line 4586 | skipping to change at line 4586 | |||
******************************************************************************** */ | ******************************************************************************** */ | |||
void vign_mousefunc(); | void vign_mousefunc(); | |||
editfunc EFvignette; | editfunc EFvignette; | |||
uint8 vignette_RGB[3] = { 0, 0, 255 }; | uint8 vignette_RGB[3] = { 0, 0, 255 }; | |||
int vignette_spc; | int vignette_spc; | |||
float vign_cx, vign_cy; | float vign_cx, vign_cy; | |||
float vign_rad; | float vign_rad; | |||
void m_vignette(GtkWidget *, cchar *menu) | void m_vignette(GtkWidget *, ch *menu) | |||
{ | { | |||
int Vign_dialog_event(zdialog *zd, cchar *event); | int Vign_dialog_event(zdialog *zd, ch *event); | |||
void Vign_curvedit(int); | void Vign_curvedit(int); | |||
void * Vign_thread(void *); | void * Vign_thread(void *); | |||
cchar *title = "Vignette"; | ch *title = "Vignette"; | |||
F1_help_topic = "vignette"; | F1_help_topic = "vignette"; | |||
Plog(1,"m_vignette \n"); | Plog(1,"m_vignette \n"); | |||
EFvignette.menuname = "Vignette"; | EFvignette.menuname = "Vignette"; | |||
EFvignette.Farea = 2; // select area usable | EFvignette.Farea = 2; // select area usable | |||
EFvignette.FprevReq = 1; // use preview image | EFvignette.FprevReq = 1; // use preview image | |||
EFvignette.threadfunc = Vign_thread; // thread function | EFvignette.threadfunc = Vign_thread; // thread function | |||
EFvignette.mousefunc = vign_mousefunc; // mouse function | EFvignette.mousefunc = vign_mousefunc; // mouse function | |||
skipping to change at line 4688 | skipping to change at line 4688 | |||
sd->fact[1] = 0; | sd->fact[1] = 0; | |||
zdialog_run(zd,Vign_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,Vign_dialog_event,"save"); // run dialog - parallel | |||
takeMouse(vign_mousefunc,dragcursor); // connect mouse function | takeMouse(vign_mousefunc,dragcursor); // connect mouse function | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int Vign_dialog_event(zdialog *zd, cchar *event) | int Vign_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
void Vign_curvedit(int); | void Vign_curvedit(int); | |||
spldat *sd = EFvignette.sd; | spldat *sd = EFvignette.sd; | |||
int ii; | int ii; | |||
char color[20]; | ch color[20]; | |||
char *file, *pp; | ch *file, *pp; | |||
cchar *ppc; | ch *ppc; | |||
FILE *fid; | FILE *fid; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
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 | |||
edit_fullsize(); | edit_fullsize(); | |||
thread_signal(); | thread_signal(); | |||
return 1; | return 1; | |||
End of changes. 49 change blocks. | ||||
52 lines changed or deleted | 52 lines changed or added |