f.warp.cc (fotoxx-23.0) | : | f.warp.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 63 | skipping to change at line 63 | |||
float ub_cur_horz, ub_cur_vert; | float ub_cur_horz, ub_cur_vert; | |||
float ub_x1, ub_x2, ub_y1, ub_y2; // unbend axes scaled 0 to 1 | float ub_x1, ub_x2, ub_y1, ub_y2; // unbend axes scaled 0 to 1 | |||
int ub_hx1, ub_hy1, ub_hx2, ub_hy2; | int ub_hx1, ub_hy1, ub_hx2, ub_hy2; | |||
int ub_vx1, ub_vy1, ub_vx2, ub_vy2; | int ub_vx1, ub_vy1, ub_vx2, ub_vy2; | |||
editfunc EFunbend; | editfunc EFunbend; | |||
} | } | |||
// menu function | // menu function | |||
void m_unbend(GtkWidget *, cchar *menu) | void m_unbend(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace unbend_names; | using namespace unbend_names; | |||
int unbend_dialog_event(zdialog* zd, cchar *event); | int unbend_dialog_event(zdialog* zd, ch *event); | |||
void * unbend_thread(void *); | void * unbend_thread(void *); | |||
void unbend_mousefunc(); | void unbend_mousefunc(); | |||
F1_help_topic = "unbend"; | F1_help_topic = "unbend"; | |||
Plog(1,"m_unbend \n"); | Plog(1,"m_unbend \n"); | |||
EFunbend.menuname = "Unbend"; | EFunbend.menuname = "Unbend"; | |||
EFunbend.FprevReq = 1; // use preview | EFunbend.FprevReq = 1; // use preview | |||
EFunbend.Frestart = 1; // restart allowed | EFunbend.Frestart = 1; // restart allowed | |||
skipping to change at line 136 | skipping to change at line 136 | |||
ub_cur_horz = ub_cur_vert = 0; | ub_cur_horz = ub_cur_vert = 0; | |||
takeMouse(unbend_mousefunc,dragcursor); // connect mouse function | takeMouse(unbend_mousefunc,dragcursor); // connect mouse function | |||
thread_signal(); | thread_signal(); | |||
zdialog_run(zd,unbend_dialog_event,"save"); // run dialog, parallel | zdialog_run(zd,unbend_dialog_event,"save"); // run dialog, parallel | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int unbend_dialog_event(zdialog *zd, cchar *event) | int unbend_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace unbend_names; | using namespace unbend_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 = 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) // dialog complete | if (zd->zstat) // dialog complete | |||
{ | { | |||
if (zd->zstat == 1) { // done | if (zd->zstat == 1) { // done | |||
skipping to change at line 195 | skipping to change at line 195 | |||
return 1; | return 1; | |||
} | } | |||
// unbend mouse function // adjustable axes | // unbend mouse function // adjustable axes | |||
void unbend_mousefunc() | void unbend_mousefunc() | |||
{ | { | |||
using namespace unbend_names; | using namespace unbend_names; | |||
cchar *close; | ch *close; | |||
float dist1, dist2; | float dist1, dist2; | |||
float mpx = 0, mpy = 0; | float mpx = 0, mpy = 0; | |||
if (LMclick) { // left mouse click | if (LMclick) { // left mouse click | |||
mpx = Mxclick; | mpx = Mxclick; | |||
mpy = Myclick; | mpy = Myclick; | |||
} | } | |||
if (Mxdrag || Mydrag) { // mouse dragged | if (Mxdrag || Mydrag) { // mouse dragged | |||
mpx = Mxdrag; | mpx = Mxdrag; | |||
skipping to change at line 357 | skipping to change at line 357 | |||
/******************************************************************************* */ | /******************************************************************************* */ | |||
// Convert a selected tetragon area into a rectangle, converting the | // Convert a selected tetragon area into a rectangle, converting the | |||
// rest of the image to match and keeping straight lines straight. | // rest of the image to match and keeping straight lines straight. | |||
namespace perspective | namespace perspective | |||
{ | { | |||
int PSP_pixel[4][2]; // last 0-4 pixels clicked | int PSP_pixel[4][2]; // last 0-4 pixels clicked | |||
int PSP_npix; // count of pixels | int PSP_npix; // count of pixels | |||
char PSP_pixlab[4][4] = { " A ", " B ", " C ", " D " }; | ch PSP_pixlab[4][4] = { " A ", " B ", " C ", " D " }; | |||
int PSP_corner = 0; | int PSP_corner = 0; | |||
editfunc EFperspective; | editfunc EFperspective; | |||
int dialog_event(zdialog *zd, cchar *event); | int dialog_event(zdialog *zd, ch *event); | |||
void mousefunc(void); | void mousefunc(void); | |||
void warpfunc(void); | void warpfunc(void); | |||
} | } | |||
// menu function | // menu function | |||
void m_perspective(GtkWidget *, cchar *menu) | void m_perspective(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace perspective; | using namespace perspective; | |||
cchar *PSP_message = | ch *PSP_message = | |||
" Click the four corners of a tetragon area. Press [apply]. \n" | " Click the four corners of a tetragon area. Press [apply]. \n" | |||
" The image is warped to make the tetragon into a rectangle."; | " The image is warped to make the tetragon into a rectangle."; | |||
F1_help_topic = "perspective"; | F1_help_topic = "perspective"; | |||
Plog(1,"m_perspective \n"); | Plog(1,"m_perspective \n"); | |||
EFperspective.menufunc = m_perspective; | EFperspective.menufunc = m_perspective; | |||
EFperspective.menuname = "Perspective"; | EFperspective.menuname = "Perspective"; | |||
EFperspective.Frestart = 1; // restart allowed | EFperspective.Frestart = 1; // restart allowed | |||
skipping to change at line 405 | skipping to change at line 405 | |||
EFperspective.zd = zd; | EFperspective.zd = zd; | |||
zdialog_run(zd,dialog_event,"save"); // run dialog, parallel | zdialog_run(zd,dialog_event,"save"); // run dialog, parallel | |||
takeMouse(mousefunc,dragcursor); // connect mouse function | takeMouse(mousefunc,dragcursor); // connect mouse function | |||
return; | return; | |||
} | } | |||
// dialog completion callback function | // dialog completion callback function | |||
int perspective::dialog_event(zdialog *zd, cchar *event) | int perspective::dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace perspective; | using namespace perspective; | |||
int ii, px, py; | int ii, px, py; | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
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 (strmatch(event,"focus")) // toggle mouse capture | if (strmatch(event,"focus")) // toggle mouse capture | |||
skipping to change at line 687 | skipping to change at line 687 | |||
void WarpA_init(); | void WarpA_init(); | |||
void WarpA_warpfunc(float mdx, float mdy, float mdw, float mdh, int acc); | void WarpA_warpfunc(float mdx, float mdy, float mdw, float mdh, int acc); | |||
void WarpA_warpfunc2(float mdx, float mdy, float mdw, float mdh, int acc); | void WarpA_warpfunc2(float mdx, float mdy, float mdw, float mdh, int acc); | |||
void WarpA_mousefunc(); | void WarpA_mousefunc(); | |||
void WarpA_expand(); | void WarpA_expand(); | |||
void WarpA_edgeblend(); | void WarpA_edgeblend(); | |||
// menu function | // menu function | |||
void m_warp_area(GtkWidget *, cchar *menu) | void m_warp_area(GtkWidget *, ch *menu) | |||
{ | { | |||
int WarpA_dialog_event(zdialog *zd, cchar *event); | int WarpA_dialog_event(zdialog *zd, ch *event); | |||
cchar *WarpA_message = | ch *WarpA_message = | |||
" Select an area to warp using select area function. \n" | " Select an area to warp using select area function. \n" | |||
" Press [start warp] and pull area with mouse. \n" | " Press [start warp] and pull area with mouse. \n" | |||
" Make multiple mouse pulls until satisfied. \n" | " Make multiple mouse pulls until satisfied. \n" | |||
" When finished, select another area or press [ OK ]."; | " When finished, select another area or press [ OK ]."; | |||
F1_help_topic = "warp area"; | F1_help_topic = "warp area"; | |||
Plog(1,"m_warp_area \n"); | Plog(1,"m_warp_area \n"); | |||
EFwarpA.menufunc = m_warp_area; | EFwarpA.menufunc = m_warp_area; | |||
skipping to change at line 729 | skipping to change at line 729 | |||
WarpA_started = 0; | WarpA_started = 0; | |||
WarpA_areanumber = 0; | WarpA_areanumber = 0; | |||
WarpAnew = 0; | WarpAnew = 0; | |||
zdialog_run(zd,WarpA_dialog_event,"save"); // run dialog, parallel | zdialog_run(zd,WarpA_dialog_event,"save"); // run dialog, parallel | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int WarpA_dialog_event(zdialog * zd, cchar *event) | int WarpA_dialog_event(zdialog * zd, ch *event) | |||
{ | { | |||
int init = 0; | int init = 0; | |||
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 (zd->zstat == 1) edit_done(0); // commit edit | if (zd->zstat == 1) edit_done(0); // commit edit | |||
skipping to change at line 1092 | skipping to change at line 1092 | |||
int NWarpC; // WarpCmem count | int NWarpC; // WarpCmem count | |||
int WarpCdrag; | int WarpCdrag; | |||
int E3ww, E3hh; | int E3ww, E3hh; | |||
float $mdx, $mdy, $mdw, $mdh; // warpC_warpfunc() and warpC_wthread() | float $mdx, $mdy, $mdw, $mdh; // warpC_warpfunc() and warpC_wthread() | |||
float $D, $span; // use these $ args | float $D, $span; // use these $ args | |||
int $acc; | int $acc; | |||
editfunc EFwarpC; | editfunc EFwarpC; | |||
int WarpC_dialog_event(zdialog *zd, cchar *event); | int WarpC_dialog_event(zdialog *zd, ch *event); | |||
void WarpC_warpfunc(); | void WarpC_warpfunc(); | |||
void WarpC_mousefunc(void); | void WarpC_mousefunc(void); | |||
void * WarpC_wthread(void *arg); | void * WarpC_wthread(void *arg); | |||
} | } | |||
// menu function | // menu function | |||
void m_warp_curved(GtkWidget *, cchar *menu) | void m_warp_curved(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace warpC_names; | using namespace warpC_names; | |||
cchar *WarpC_message = | ch *WarpC_message = | |||
" Pull an image position using the mouse. \n" | " Pull an image position using the mouse. \n" | |||
" Make multiple mouse pulls until satisfied. \n" | " Make multiple mouse pulls until satisfied. \n" | |||
" When finished, press [ OK ]."; | " When finished, press [ OK ]."; | |||
int px, py, ii; | int px, py, ii; | |||
F1_help_topic = "warp curved"; | F1_help_topic = "warp curved"; | |||
Plog(1,"m_warp_curved \n"); | Plog(1,"m_warp_curved \n"); | |||
skipping to change at line 1164 | skipping to change at line 1164 | |||
zdialog_restore_inputs(zd); // restore previous inputs | zdialog_restore_inputs(zd); // restore previous inputs | |||
zdialog_fetch(zd,"span",$span); // save span value | zdialog_fetch(zd,"span",$span); // save span value | |||
zdialog_run(zd,WarpC_dialog_event,"save"); // run dialog, parallel | zdialog_run(zd,WarpC_dialog_event,"save"); // run dialog, parallel | |||
takeMouse(WarpC_mousefunc,dragcursor); // connect mouse function | takeMouse(WarpC_mousefunc,dragcursor); // connect mouse function | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int warpC_names::WarpC_dialog_event(zdialog * zd, cchar *event) | int warpC_names::WarpC_dialog_event(zdialog * zd, ch *event) | |||
{ | { | |||
using namespace warpC_names; | using namespace warpC_names; | |||
int px, py, ii; | int px, py, ii; | |||
int fpx, fpy, epx, epy, vstat; | int fpx, fpy, epx, epy, vstat; | |||
float scale, dispx, dispy; | float scale, dispx, dispy; | |||
float vpix[4], *pix3; | float vpix[4], *pix3; | |||
int nc = E1pxm->nc, pcc = nc * sizeof(float); | int nc = E1pxm->nc, pcc = nc * sizeof(float); | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
skipping to change at line 1395 | skipping to change at line 1395 | |||
float *WarpLx, *WarpLy; // memory of all dragged pixels | float *WarpLx, *WarpLy; // memory of all dragged pixels | |||
float WarpLmem[4][100]; // undo memory, last 100 drags | float WarpLmem[4][100]; // undo memory, last 100 drags | |||
int NWarpL; // WarpLmem count | int NWarpL; // WarpLmem count | |||
int WarpLdrag; | int WarpLdrag; | |||
int E3ww, E3hh; | int E3ww, E3hh; | |||
float $mdx, $mdy, $mdw, $mdh; // warpL_warpfunc() and warpL_wthread() | float $mdx, $mdy, $mdw, $mdh; // warpL_warpfunc() and warpL_wthread() | |||
int $D, $Dx, $Dy, $acc; // use these $ args | int $D, $Dx, $Dy, $acc; // use these $ args | |||
editfunc EFwarpL; | editfunc EFwarpL; | |||
int WarpL_dialog_event(zdialog *zd, cchar *event); | int WarpL_dialog_event(zdialog *zd, ch *event); | |||
void WarpL_mousefunc(void); | void WarpL_mousefunc(void); | |||
void WarpL_warpfunc(); | void WarpL_warpfunc(); | |||
void * WarpL_wthread(void *arg); | void * WarpL_wthread(void *arg); | |||
} | } | |||
// menu function | // menu function | |||
void m_warp_linear(GtkWidget *, cchar *menu) | void m_warp_linear(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace warpL_names; | using namespace warpL_names; | |||
cchar *WarpL_message = | ch *WarpL_message = | |||
" Pull an image position using the mouse. \n" | " Pull an image position using the mouse. \n" | |||
" Make multiple mouse pulls until satisfied. \n" | " Make multiple mouse pulls until satisfied. \n" | |||
" When finished, press [ OK ]."; | " When finished, press [ OK ]."; | |||
int px, py, ii; | int px, py, ii; | |||
F1_help_topic = "warp linear"; | F1_help_topic = "warp linear"; | |||
Plog(1,"m_warp_linear \n"); | Plog(1,"m_warp_linear \n"); | |||
skipping to change at line 1463 | skipping to change at line 1463 | |||
E3hh = E3pxm->hh; | E3hh = E3pxm->hh; | |||
zdialog_run(zd,WarpL_dialog_event,"save"); // run dialog, parallel | zdialog_run(zd,WarpL_dialog_event,"save"); // run dialog, parallel | |||
takeMouse(WarpL_mousefunc,dragcursor); // connect mouse function | takeMouse(WarpL_mousefunc,dragcursor); // connect mouse function | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int warpL_names::WarpL_dialog_event(zdialog * zd, cchar *event) | int warpL_names::WarpL_dialog_event(zdialog * zd, ch *event) | |||
{ | { | |||
using namespace warpL_names; | using namespace warpL_names; | |||
int px, py, ii; | int px, py, ii; | |||
int fpx, fpy, epx, epy, vstat; | int fpx, fpy, epx, epy, vstat; | |||
float scale, dispx, dispy; | float scale, dispx, dispy; | |||
float vpix[4], *pix3; | float vpix[4], *pix3; | |||
int nc = E1pxm->nc, pcc = nc * sizeof(float); | int nc = E1pxm->nc, pcc = nc * sizeof(float); | |||
if (strmatch(event,"escape")) zd->zstat = -2; // escape key | if (strmatch(event,"escape")) zd->zstat = -2; // escape key | |||
skipping to change at line 1725 | skipping to change at line 1725 | |||
editfunc EFwarpF; | editfunc EFwarpF; | |||
void WarpF_warpfunc(); // image warp function | void WarpF_warpfunc(); // image warp function | |||
void WarpF_mousefunc(void); | void WarpF_mousefunc(void); | |||
void WarpF_affine(float po[3][2], float pn[3][2], float coeff[6]); // compute affine transform coefficients | void WarpF_affine(float po[3][2], float pn[3][2], float coeff[6]); // compute affine transform coefficients | |||
void WarpF_invert(float coeff[6], float Icoeff[6]); // compute reverse transform coefficients | void WarpF_invert(float coeff[6], float Icoeff[6]); // compute reverse transform coefficients | |||
// menu function | // menu function | |||
void m_warp_affine(GtkWidget *, cchar *menu) | void m_warp_affine(GtkWidget *, ch *menu) | |||
{ | { | |||
int WarpF_dialog_event(zdialog *zd, cchar *event); | int WarpF_dialog_event(zdialog *zd, ch *event); | |||
cchar *WarpF_message = | ch *WarpF_message = | |||
" Pull on an image corner using the mouse. \n" | " Pull on an image corner using the mouse. \n" | |||
" Make multiple mouse pulls until satisfied. \n" | " Make multiple mouse pulls until satisfied. \n" | |||
" When finished, press [ OK ]."; | " When finished, press [ OK ]."; | |||
F1_help_topic = "warp affine"; | F1_help_topic = "warp affine"; | |||
Plog(1,"m_warp_affine \n"); | Plog(1,"m_warp_affine \n"); | |||
EFwarpF.menufunc = m_warp_affine; | EFwarpF.menufunc = m_warp_affine; | |||
EFwarpF.menuname = "Warp Affine"; | EFwarpF.menuname = "Warp Affine"; | |||
skipping to change at line 1763 | skipping to change at line 1763 | |||
WarpF_ftf = 1; // 1st warp flag | WarpF_ftf = 1; // 1st warp flag | |||
zdialog_run(zd,WarpF_dialog_event,"save"); // run dialog, parallel | zdialog_run(zd,WarpF_dialog_event,"save"); // run dialog, parallel | |||
takeMouse(WarpF_mousefunc,dragcursor); // connect mouse function | takeMouse(WarpF_mousefunc,dragcursor); // connect mouse function | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int WarpF_dialog_event(zdialog *zd, cchar *event) | int WarpF_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
float scale; | float scale; | |||
int ww, hh; | int ww, hh; | |||
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) return 1; // wait for completion | if (! zd->zstat) return 1; // wait for completion | |||
skipping to change at line 2060 | skipping to change at line 2060 | |||
// Rescale an image while leaving selected areas unchanged. | // Rescale an image while leaving selected areas unchanged. | |||
namespace area_rescale_names | namespace area_rescale_names | |||
{ | { | |||
editfunc EFarea_rescale; | editfunc EFarea_rescale; | |||
int Fsetups = 0; | int Fsetups = 0; | |||
int dragx, dragy; | int dragx, dragy; | |||
int E3ww, E3hh; | int E3ww, E3hh; | |||
char *sqrow, *sqcol; | ch *sqrow, *sqcol; | |||
int Nsqrow, Nsqcol; | int Nsqrow, Nsqcol; | |||
int *npx, *npy; | int *npx, *npy; | |||
int dialog_event(zdialog *zd, cchar *event); | int dialog_event(zdialog *zd, ch *event); | |||
void setups(); | void setups(); | |||
void cleanups(); | void cleanups(); | |||
void mousefunc(); | void mousefunc(); | |||
void warpfunc(); | void warpfunc(); | |||
void *warpthread(void *); | void *warpthread(void *); | |||
} | } | |||
// menu function | // menu function | |||
void m_area_rescale(GtkWidget *, cchar *menu) | void m_area_rescale(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace area_rescale_names; | using namespace area_rescale_names; | |||
cchar *message = " Select areas to remain unchanged. \n" | ch *message = " Select areas to remain unchanged. \n" | |||
" Pull image from upper left corner. \n" | " Pull image from upper left corner. \n" | |||
" When finished, press [ OK ]."; | " When finished, press [ OK ]."; | |||
F1_help_topic = "area rescale"; | F1_help_topic = "area rescale"; | |||
Plog(1,"m_area_rescale \n"); | Plog(1,"m_area_rescale \n"); | |||
EFarea_rescale.menuname = "Area Rescale"; | EFarea_rescale.menuname = "Area Rescale"; | |||
EFarea_rescale.Farea = 2; // select area usable | EFarea_rescale.Farea = 2; // select area usable | |||
EFarea_rescale.mousefunc = mousefunc; // mouse function | EFarea_rescale.mousefunc = mousefunc; // mouse function | |||
skipping to change at line 2105 | skipping to change at line 2105 | |||
zdialog *zd = zdialog_new("Area Rescale",Mwin,"Proceed","OK","Cancel",null); | zdialog *zd = zdialog_new("Area Rescale",Mwin,"Proceed","OK","Cancel",null); | |||
EFarea_rescale.zd = zd; | EFarea_rescale.zd = zd; | |||
zdialog_add_widget(zd,"label","lab1","dialog",message,"space=3"); | zdialog_add_widget(zd,"label","lab1","dialog",message,"space=3"); | |||
zdialog_run(zd,dialog_event,"save"); // run dialog, parallel | zdialog_run(zd,dialog_event,"save"); // run dialog, parallel | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int area_rescale_names::dialog_event(zdialog * zd, cchar *event) | int area_rescale_names::dialog_event(zdialog * zd, ch *event) | |||
{ | { | |||
using namespace area_rescale_names; | using namespace area_rescale_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; // 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) return 1; // wait for completion | if (! zd->zstat) return 1; // wait for completion | |||
if (zd->zstat == 1) { // [proceed] | if (zd->zstat == 1) { // [proceed] | |||
skipping to change at line 2147 | skipping to change at line 2147 | |||
{ | { | |||
int ii, spx, spy, sum; | int ii, spx, spy, sum; | |||
cleanups(); // free prior if any | cleanups(); // free prior if any | |||
dragx = dragy = 0; // no drag data | dragx = dragy = 0; // no drag data | |||
E3ww = E3pxm->ww; // image dimensions | E3ww = E3pxm->ww; // image dimensions | |||
E3hh = E3pxm->hh; | E3hh = E3pxm->hh; | |||
sqrow = (char *) zmalloc(E3hh,"area rescale"); | sqrow = (ch *) zmalloc(E3hh,"area rescale"); | |||
// maps squishable rows/cols | // maps squishable rows/cols | |||
sqcol = (char *) zmalloc(E3ww,"area rescale"); | sqcol = (ch *) zmalloc(E3ww,"area rescale"); | |||
memset(sqrow,1,E3hh); // mark all rows/cols squishable | memset(sqrow,1,E3hh); // mark all rows/cols squishable | |||
memset(sqcol,1,E3ww); | memset(sqcol,1,E3ww); | |||
for (spy = 0; spy < E3hh; spy++) // loop all source pixels | for (spy = 0; spy < E3hh; spy++) // loop all source pixels | |||
for (spx = 0; spx < E3ww; spx++) | for (spx = 0; spx < E3ww; spx++) | |||
{ | { | |||
ii = spy * E3ww + spx; // pixel within area? | ii = spy * E3ww + spx; // pixel within area? | |||
if (sa_pixmap[ii]) sqrow[spy] = sqcol[spx] = 0; // mark row/col non-squishable | if (sa_pixmap[ii]) sqrow[spy] = sqcol[spx] = 0; // mark row/col non-squishable | |||
} | } | |||
skipping to change at line 2284 | skipping to change at line 2284 | |||
/******************************************************************************* */ | /******************************************************************************* */ | |||
// Unwarp closeup face photo - shrink magnified areas closest to camera | // Unwarp closeup face photo - shrink magnified areas closest to camera | |||
int unwarpCU_started; | int unwarpCU_started; | |||
int unwarpCU_areanumber; | int unwarpCU_areanumber; | |||
float unwarpCU_warpval; | float unwarpCU_warpval; | |||
int unwarpCU_cx, unwarpCU_cy; | int unwarpCU_cx, unwarpCU_cy; | |||
editfunc EFunwarpCU; | editfunc EFunwarpCU; | |||
int unwarpCU_dialog_event(zdialog *zd, cchar *event); | int unwarpCU_dialog_event(zdialog *zd, ch *event); | |||
void unwarpCU_warpfunc(); | void unwarpCU_warpfunc(); | |||
void unwarpCU_mousefunc(); | void unwarpCU_mousefunc(); | |||
// menu function | // menu function | |||
void m_unwarp_closeup(GtkWidget *, cchar *menu) | void m_unwarp_closeup(GtkWidget *, ch *menu) | |||
{ | { | |||
cchar *unwarpCU_message = | ch *unwarpCU_message = | |||
" Use Select Area to select a face. \n" | " Use Select Area to select a face. \n" | |||
" Click on the center of distortion. \n" | " Click on the center of distortion. \n" | |||
" Move the slider. \n"; | " Move the slider. \n"; | |||
F1_help_topic = "unwarp closeup"; | F1_help_topic = "unwarp closeup"; | |||
Plog(1,"m_unwarp_closeup \n"); | Plog(1,"m_unwarp_closeup \n"); | |||
EFunwarpCU.menufunc = m_unwarp_closeup; | EFunwarpCU.menufunc = m_unwarp_closeup; | |||
EFunwarpCU.menuname = "Unwarp Closeup"; | EFunwarpCU.menuname = "Unwarp Closeup"; | |||
skipping to change at line 2340 | skipping to change at line 2340 | |||
unwarpCU_started = 0; | unwarpCU_started = 0; | |||
unwarpCU_areanumber = 0; | unwarpCU_areanumber = 0; | |||
zdialog_run(zd,unwarpCU_dialog_event,"save"); // run dialog, parallel | zdialog_run(zd,unwarpCU_dialog_event,"save"); // run dialog, parallel | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int unwarpCU_dialog_event(zdialog * zd, cchar *event) | int unwarpCU_dialog_event(zdialog * zd, ch *event) | |||
{ | { | |||
int init = 0; | int init = 0; | |||
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 (zd->zstat == 1) edit_done(0); // commit edit | if (zd->zstat == 1) edit_done(0); // commit edit | |||
skipping to change at line 2487 | skipping to change at line 2487 | |||
editfunc EFwaves; | editfunc EFwaves; | |||
int ww, hh; // image dimensions | int ww, hh; // image dimensions | |||
int WLV, WLH; // vertical and horizontal wavelen gths | int WLV, WLH; // vertical and horizontal wavelen gths | |||
int AMPV, AMPH; // vertical and horizontal amplitu des | int AMPV, AMPH; // vertical and horizontal amplitu des | |||
int VARV, VARH; // vertical and horizontal varianc e | int VARV, VARH; // vertical and horizontal varianc e | |||
int PERSP; // perspective 0-100 | int PERSP; // perspective 0-100 | |||
} | } | |||
// menu function | // menu function | |||
void m_waves(GtkWidget *, const char *menu) | void m_waves(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace waves_names; | using namespace waves_names; | |||
int waves_dialog_event(zdialog* zd, const char *event); | int waves_dialog_event(zdialog* zd, ch *event); | |||
void * waves_thread(void *); | void * waves_thread(void *); | |||
F1_help_topic = "make waves"; | F1_help_topic = "make waves"; | |||
Plog(1,"m_waves \n"); | Plog(1,"m_waves \n"); | |||
EFwaves.menufunc = m_waves; | EFwaves.menufunc = m_waves; | |||
EFwaves.menuname = "Make Waves"; | EFwaves.menuname = "Make Waves"; | |||
EFwaves.Farea = 2; // select area usable | EFwaves.Farea = 2; // select area usable | |||
EFwaves.threadfunc = waves_thread; | EFwaves.threadfunc = waves_thread; | |||
skipping to change at line 2554 | skipping to change at line 2554 | |||
zdialog_add_widget(zd,"label","labp","hbp","perspective","space=3"); | zdialog_add_widget(zd,"label","labp","hbp","perspective","space=3"); | |||
zdialog_add_widget(zd,"zspin","persp","hbp","0|100|1|0","space=5"); | zdialog_add_widget(zd,"zspin","persp","hbp","0|100|1|0","space=5"); | |||
zdialog_restore_inputs(zd); // restore previous inputs | zdialog_restore_inputs(zd); // restore previous inputs | |||
zdialog_run(zd,waves_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,waves_dialog_event,"save"); // run dialog - parallel | |||
return; | return; | |||
} | } | |||
// waves dialog event and completion function | // waves dialog event and completion function | |||
int waves_dialog_event(zdialog *zd, const char *event) // waves dialog event function | int waves_dialog_event(zdialog *zd, ch *event) // waves dialog event function | |||
{ | { | |||
using namespace waves_names; | using namespace waves_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; // 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 2697 | skipping to change at line 2697 | |||
editfunc EFtwist; | editfunc EFtwist; | |||
int cx, cy; | int cx, cy; | |||
int ww, hh; | int ww, hh; | |||
float twist; | float twist; | |||
float center; | float center; | |||
float rotate; | float rotate; | |||
} | } | |||
// menu function | // menu function | |||
void m_twist(GtkWidget *, cchar *menu) | void m_twist(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace twist_names; | using namespace twist_names; | |||
int twist_dialog_event(zdialog *zd, cchar *event); | int twist_dialog_event(zdialog *zd, ch *event); | |||
void * twist_thread(void *); | void * twist_thread(void *); | |||
void twist_mousefunc(); | void twist_mousefunc(); | |||
cchar *title = "Twist"; | ch *title = "Twist"; | |||
F1_help_topic = "twist"; | F1_help_topic = "twist"; | |||
Plog(1,"m_twist \n"); | Plog(1,"m_twist \n"); | |||
m_zoom(0,"fit"); // zoom to fit window | m_zoom(0,"fit"); // zoom to fit window | |||
EFtwist.menufunc = m_twist; | EFtwist.menufunc = m_twist; | |||
EFtwist.menuname = "Twist"; | EFtwist.menuname = "Twist"; | |||
EFtwist.FprevReq = 1; // use preview image | EFtwist.FprevReq = 1; // use preview image | |||
skipping to change at line 2776 | skipping to change at line 2776 | |||
zdialog_resize(zd,300,0); | zdialog_resize(zd,300,0); | |||
zdialog_run(zd,twist_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,twist_dialog_event,"save"); // run dialog - parallel | |||
takeMouse(twist_mousefunc,dragcursor); // connect mouse function | takeMouse(twist_mousefunc,dragcursor); // connect mouse function | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int twist_dialog_event(zdialog *zd, cchar *event) | int twist_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace twist_names; | using namespace twist_names; | |||
void twist_mousefunc(); | void twist_mousefunc(); | |||
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 2966 | skipping to change at line 2966 | |||
{ | { | |||
int E3ww, E3hh; // image dimensions | int E3ww, E3hh; // image dimensions | |||
int Xcen, Ycen, D1; // center and diameter of sphere | int Xcen, Ycen, D1; // center and diameter of sphere | |||
float flatten; // flatten parameter | float flatten; // flatten parameter | |||
float magnify; // magnify parameter | float magnify; // magnify parameter | |||
editfunc EFsphere; // edit function data | editfunc EFsphere; // edit function data | |||
} | } | |||
// menu function | // menu function | |||
void m_sphere(GtkWidget *, const char *menu) | void m_sphere(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace sphere_names; | using namespace sphere_names; | |||
int sphere_dialog_event(zdialog* zd, const char *event); | int sphere_dialog_event(zdialog* zd, ch *event); | |||
void sphere_mousefunc(void); | void sphere_mousefunc(void); | |||
void * sphere_thread(void *); | void * sphere_thread(void *); | |||
cchar *title = "Spherical Projection"; | ch *title = "Spherical Projection"; | |||
F1_help_topic = "sphere"; | F1_help_topic = "sphere"; | |||
Plog(1,"m_sphere \n"); | Plog(1,"m_sphere \n"); | |||
m_zoom(0,"fit"); // zoom to fit window | m_zoom(0,"fit"); // zoom to fit window | |||
EFsphere.menufunc = m_sphere; | EFsphere.menufunc = m_sphere; | |||
EFsphere.menuname = "Sphere"; | EFsphere.menuname = "Sphere"; | |||
EFsphere.FprevReq = 1; // use preview edit mode | EFsphere.FprevReq = 1; // use preview edit mode | |||
skipping to change at line 3037 | skipping to change at line 3037 | |||
zdialog_resize(zd,250,0); | zdialog_resize(zd,250,0); | |||
zdialog_run(zd,sphere_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,sphere_dialog_event,"save"); // run dialog - parallel | |||
takeMouse(sphere_mousefunc,0); // connect mouse function | takeMouse(sphere_mousefunc,0); // connect mouse function | |||
thread_signal(); // trigger update thread | thread_signal(); // trigger update thread | |||
return; | return; | |||
} | } | |||
// sphere dialog event and completion function | // sphere dialog event and completion function | |||
int sphere_dialog_event(zdialog *zd, const char *event) | int sphere_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace sphere_names; | using namespace sphere_names; | |||
float scale; | float scale; | |||
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) | |||
skipping to change at line 3180 | skipping to change at line 3180 | |||
{ | { | |||
int E3ww, E3hh; // image dimensions | int E3ww, E3hh; // image dimensions | |||
int Xcen, Ycen; // image center (mouse select) | int Xcen, Ycen; // image center (mouse select) | |||
float R; // max. center - edge distance | float R; // max. center - edge distance | |||
float stretch; // stretch parameter | float stretch; // stretch parameter | |||
editfunc EFstretch; // edit function data | editfunc EFstretch; // edit function data | |||
} | } | |||
// menu function | // menu function | |||
void m_stretch(GtkWidget *, const char *menu) // overhauled 22.20 | void m_stretch(GtkWidget *, ch *menu) // overhauled 22.20 | |||
{ | { | |||
using namespace stretch_names; | using namespace stretch_names; | |||
int stretch_dialog_event(zdialog* zd, const char *event); | int stretch_dialog_event(zdialog* zd, ch *event); | |||
void stretch_mousefunc(void); | void stretch_mousefunc(void); | |||
void * stretch_thread(void *); | void * stretch_thread(void *); | |||
cchar *title = "Add/remove barrel/pincushion distortion"; | ch *title = "Add/remove barrel/pincushion distortion"; | |||
F1_help_topic = "stretch"; | F1_help_topic = "stretch"; | |||
Plog(1,"m_stretch \n"); | Plog(1,"m_stretch \n"); | |||
m_zoom(0,"fit"); // zoom to fit window | m_zoom(0,"fit"); // zoom to fit window | |||
EFstretch.menufunc = m_stretch; | EFstretch.menufunc = m_stretch; | |||
EFstretch.menuname = "Stretch"; | EFstretch.menuname = "Stretch"; | |||
EFstretch.FprevReq = 1; // use preview edit mode | EFstretch.FprevReq = 1; // use preview edit mode | |||
skipping to change at line 3250 | skipping to change at line 3250 | |||
zdialog_resize(zd,300,0); | zdialog_resize(zd,300,0); | |||
zdialog_run(zd,stretch_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,stretch_dialog_event,"save"); // run dialog - parallel | |||
takeMouse(stretch_mousefunc,0); // connect mouse function | takeMouse(stretch_mousefunc,0); // connect mouse function | |||
thread_signal(); // trigger update thread | thread_signal(); // trigger update thread | |||
return; | return; | |||
} | } | |||
// stretch dialog event and completion function | // stretch dialog event and completion function | |||
int stretch_dialog_event(zdialog *zd, const char *event) | int stretch_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace stretch_names; | using namespace stretch_names; | |||
float scale; | float scale; | |||
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) | |||
skipping to change at line 3376 | skipping to change at line 3376 | |||
namespace inside_out_names | namespace inside_out_names | |||
{ | { | |||
editfunc EFinsideout; | editfunc EFinsideout; | |||
int ww, hh, cx, cy, pixcc; | int ww, hh, cx, cy, pixcc; | |||
float R, T, hole; // radius, theta | float R, T, hole; // radius, theta | |||
} | } | |||
// menu function | // menu function | |||
void m_inside_out(GtkWidget *, cchar *menu) | void m_inside_out(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace inside_out_names; | using namespace inside_out_names; | |||
int inside_out_dialog_event(zdialog *zd, cchar *event); | int inside_out_dialog_event(zdialog *zd, ch *event); | |||
void * inside_out_thread(void *); | void * inside_out_thread(void *); | |||
void inside_out_mousefunc(); | void inside_out_mousefunc(); | |||
F1_help_topic = "inside-out"; | F1_help_topic = "inside-out"; | |||
Plog(1,"m_inside_out \n"); | Plog(1,"m_inside_out \n"); | |||
m_zoom(0,"fit"); // zoom to fit window | m_zoom(0,"fit"); // zoom to fit window | |||
EFinsideout.menuname = "Inside-out"; | EFinsideout.menuname = "Inside-out"; | |||
skipping to change at line 3443 | skipping to change at line 3443 | |||
zdialog_add_widget(zd,"hscale","hole","hbhole","0|1000|1|100","space=5|expand "); | zdialog_add_widget(zd,"hscale","hole","hbhole","0|1000|1|100","space=5|expand "); | |||
takeMouse(inside_out_mousefunc,dragcursor); | takeMouse(inside_out_mousefunc,dragcursor); | |||
zdialog_run(zd,inside_out_dialog_event,"save"); | zdialog_run(zd,inside_out_dialog_event,"save"); | |||
thread_signal(); | thread_signal(); | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int inside_out_dialog_event(zdialog *zd, cchar *event) | int inside_out_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace inside_out_names; | using namespace inside_out_names; | |||
void inside_out_mousefunc(); | void inside_out_mousefunc(); | |||
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,"focus")) // toggle mouse capture | if (strmatch(event,"focus")) // toggle mouse capture | |||
skipping to change at line 3602 | skipping to change at line 3602 | |||
int ww1, hh1, ww3, hh3, ww9, hh9; | int ww1, hh1, ww3, hh3, ww9, hh9; | |||
int cx9, cy9, cx3, cy3, pixcc; | int cx9, cy9, cx3, cy3, pixcc; | |||
int cuttop, cutbott, rotate; | int cuttop, cutbott, rotate; | |||
float hole, R1, R2; | float hole, R1, R2; | |||
int revR, revT; | int revR, revT; | |||
} | } | |||
// menu function | // menu function | |||
void m_tiny_planet(GtkWidget *, cchar *menu) | void m_tiny_planet(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace tiny_planet_names; | using namespace tiny_planet_names; | |||
int tiny_planet_dialog_event(zdialog *zd, cchar *event); | int tiny_planet_dialog_event(zdialog *zd, ch *event); | |||
void tiny_planet_process(); | void tiny_planet_process(); | |||
char texthole[20], texttop[20], textbott[20]; | ch texthole[20], texttop[20], textbott[20]; | |||
F1_help_topic = "tiny planet"; | F1_help_topic = "tiny planet"; | |||
Plog(1,"m_tiny_planet \n"); | Plog(1,"m_tiny_planet \n"); | |||
if (! curr_file) return; // no current image | if (! curr_file) return; // no current image | |||
if (Fpxb->ww < Fpxb->hh) { | if (Fpxb->ww < Fpxb->hh) { | |||
zmessageACK(Mwin,"image width must be greater than height"); | zmessageACK(Mwin,"image width must be greater than height"); | |||
return; | return; | |||
skipping to change at line 3697 | skipping to change at line 3697 | |||
cuttop = cutbott = 0; | cuttop = cutbott = 0; | |||
zdialog_run(zd,tiny_planet_dialog_event,"save"); | zdialog_run(zd,tiny_planet_dialog_event,"save"); | |||
tiny_planet_process(); // make initial image | tiny_planet_process(); // make initial image | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int tiny_planet_dialog_event(zdialog *zd, cchar *event) | int tiny_planet_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace tiny_planet_names; | using namespace tiny_planet_names; | |||
void tiny_planet_process(); | void tiny_planet_process(); | |||
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) | |||
skipping to change at line 3852 | skipping to change at line 3852 | |||
editfunc EFescher_spiral; | editfunc EFescher_spiral; | |||
int Eww, Ehh; | int Eww, Ehh; | |||
int cx, cy; | int cx, cy; | |||
int width; | int width; | |||
float rim; | float rim; | |||
float color[3]; | float color[3]; | |||
} | } | |||
// menu function | // menu function | |||
void m_escher_spiral(GtkWidget *, cchar *menu) | void m_escher_spiral(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace escher_spiral_names; | using namespace escher_spiral_names; | |||
int escher_spiral_dialog_event(zdialog *zd, cchar *event); | int escher_spiral_dialog_event(zdialog *zd, ch *event); | |||
void * escher_spiral_thread(void *); | void * escher_spiral_thread(void *); | |||
void escher_spiral_mousefunc(); | void escher_spiral_mousefunc(); | |||
F1_help_topic = "escher spiral"; | F1_help_topic = "escher spiral"; | |||
Plog(1,"m_escher_spiral \n"); | Plog(1,"m_escher_spiral \n"); | |||
m_zoom(0,"fit"); // zoom to fit window | m_zoom(0,"fit"); // zoom to fit window | |||
EFescher_spiral.menuname = "Escher Spiral"; | EFescher_spiral.menuname = "Escher Spiral"; | |||
skipping to change at line 3920 | skipping to change at line 3920 | |||
zdialog_restore_inputs(zd); // restore previous inputs | zdialog_restore_inputs(zd); // restore previous inputs | |||
zdialog_run(zd,escher_spiral_dialog_event,"save"); | zdialog_run(zd,escher_spiral_dialog_event,"save"); | |||
takeMouse(escher_spiral_mousefunc,dragcursor); | takeMouse(escher_spiral_mousefunc,dragcursor); | |||
return; | return; | |||
} | } | |||
// dialog event and completion callback function | // dialog event and completion callback function | |||
int escher_spiral_dialog_event(zdialog *zd, cchar *event) | int escher_spiral_dialog_event(zdialog *zd, ch *event) | |||
{ | { | |||
using namespace escher_spiral_names; | using namespace escher_spiral_names; | |||
void escher_spiral_mousefunc(); | void escher_spiral_mousefunc(); | |||
char text[20]; | ch text[20]; | |||
cchar *pp; | ch *pp; | |||
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,"focus")) // toggle mouse capture | if (strmatch(event,"focus")) // toggle mouse capture | |||
takeMouse(escher_spiral_mousefunc,dragcursor); // connect mouse function | takeMouse(escher_spiral_mousefunc,dragcursor); // connect mouse function | |||
if (zd->zstat) | if (zd->zstat) | |||
{ | { | |||
skipping to change at line 4125 | skipping to change at line 4125 | |||
int Ml, Mr; // left and right crop margins | int Ml, Mr; // left and right crop margins | |||
int Fcrop, Fwarp; // flags, E3 already cropped, warped | int Fcrop, Fwarp; // flags, E3 already cropped, warped | |||
double *Tfy, *Bfy; // derived top/bottom y-shifts [ww] | double *Tfy, *Bfy; // derived top/bottom y-shifts [ww] | |||
double *Tfx, *Bfx; // derived top/bottom x-shifts [ww] | double *Tfx, *Bfx; // derived top/bottom x-shifts [ww] | |||
double stretch; // text stretch factor | double stretch; // text stretch factor | |||
double widen; // image widen factor | double widen; // image widen factor | |||
} | } | |||
// menu function | // menu function | |||
void m_flatphoto(GtkWidget *, const char *menu) | void m_flatphoto(GtkWidget *, ch *menu) | |||
{ | { | |||
using namespace flatphoto; | using namespace flatphoto; | |||
int flatphoto_dialog_event(zdialog* zd, const char *event); | int flatphoto_dialog_event(zdialog* zd, ch *event); | |||
void flatphoto_mousefunc(); | void flatphoto_mousefunc(); | |||
void flatphoto_drawlines(); | void flatphoto_drawlines(); | |||
cchar *title = "Flatten photo of a curved surface."; | ch *title = "Flatten photo of a curved surface."; | |||
cchar *guide = "Trace the top and bottom edges with \n" | ch *guide = "Trace the top and bottom edges with \n" | |||
" mouse clicks, then [flatten]."; | " mouse clicks, then [flatten]."; | |||
zdialog *zd; | zdialog *zd; | |||
F1_help_topic = "flatten photo"; | F1_help_topic = "flatten photo"; | |||
Plog(1,"m_flatphoto \n"); | Plog(1,"m_flatphoto \n"); | |||
EFflatphoto.menufunc = m_flatphoto; | EFflatphoto.menufunc = m_flatphoto; | |||
EFflatphoto.menuname = "Flatten Photo"; | EFflatphoto.menuname = "Flatten Photo"; | |||
EFflatphoto.mousefunc = flatphoto_mousefunc; | EFflatphoto.mousefunc = flatphoto_mousefunc; | |||
skipping to change at line 4212 | skipping to change at line 4212 | |||
zdialog_run(zd,flatphoto_dialog_event,"save"); // run dialog - parallel | zdialog_run(zd,flatphoto_dialog_event,"save"); // run dialog - parallel | |||
if (Tnm || Bnm) flatphoto_drawlines(); // draw lines if points available | if (Tnm || Bnm) flatphoto_drawlines(); // draw lines if points available | |||
takeMouse(flatphoto_mousefunc,dragcursor); // connect mouse function | takeMouse(flatphoto_mousefunc,dragcursor); // connect mouse function | |||
return; | return; | |||
} | } | |||
// flatphoto dialog event and completion function | // flatphoto dialog event and completion function | |||
int flatphoto_dialog_event(zdialog *zd, const char *event) // flatphoto dialog event function | int flatphoto_dialog_event(zdialog *zd, ch *event) // flatphoto dialog event function | |||
{ | { | |||
using namespace flatphoto; | using namespace flatphoto; | |||
void flatphoto_drawlines(); | void flatphoto_drawlines(); | |||
void flatphoto_crop(); | void flatphoto_crop(); | |||
void flatphoto_warp(); | void flatphoto_warp(); | |||
cchar *need4mess = "Need at least 4 points at top and bottom"; | ch *need4mess = "Need at least 4 points at top and bottom"; | |||
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) { | |||
zfree(Tfy); // free memory | zfree(Tfy); // free memory | |||
zfree(Bfy); | zfree(Bfy); | |||
zfree(Tfx); | zfree(Tfx); | |||
zfree(Bfx); | zfree(Bfx); | |||
End of changes. 67 change blocks. | ||||
71 lines changed or deleted | 71 lines changed or added |