|
|
@ -360,8 +360,8 @@ void DistortionFX::twirl(Digikam::DImg *orgImage, Digikam::DImg *destImage, int
|
|
|
|
* Width => Width of image.
|
|
|
|
* Width => Width of image.
|
|
|
|
* Height => Height of image.
|
|
|
|
* Height => Height of image.
|
|
|
|
* Coeff => Cilindrical value.
|
|
|
|
* Coeff => Cilindrical value.
|
|
|
|
*Qt::Horizontal => Apply horizontally.
|
|
|
|
* Horizontal => Apply horizontally.
|
|
|
|
*Qt::Vertical => Apply vertically.
|
|
|
|
* Vertical => Apply vertically.
|
|
|
|
* Antialias => Smart bluring result.
|
|
|
|
* Antialias => Smart bluring result.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Theory => This is a great effect, similar to Spherize (Photoshop).
|
|
|
|
* Theory => This is a great effect, similar to Spherize (Photoshop).
|
|
|
@ -371,10 +371,10 @@ void DistortionFX::twirl(Digikam::DImg *orgImage, Digikam::DImg *destImage, int
|
|
|
|
* environment.
|
|
|
|
* environment.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void DistortionFX::cilindrical(Digikam::DImg *orgImage, Digikam::DImg *destImage, double Coeff,
|
|
|
|
void DistortionFX::cilindrical(Digikam::DImg *orgImage, Digikam::DImg *destImage, double Coeff,
|
|
|
|
boolQt::Horizontal, boolQt::Vertical, bool AntiAlias)
|
|
|
|
bool Horizontal, bool Vertical, bool AntiAlias)
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ((Coeff == 0.0) || (! Qt::Horizontal ||Qt::Vertical)))
|
|
|
|
if ((Coeff == 0.0) || (! (Horizontal || Vertical)))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
int Width = orgImage->width();
|
|
|
|
int Width = orgImage->width();
|
|
|
@ -392,9 +392,9 @@ void DistortionFX::cilindrical(Digikam::DImg *orgImage, Digikam::DImg *destImage
|
|
|
|
int nHalfW = Width / 2, nHalfH = Height / 2;
|
|
|
|
int nHalfW = Width / 2, nHalfH = Height / 2;
|
|
|
|
double lfCoeffX = 1.0, lfCoeffY = 1.0, lfCoeffStep = Coeff / 1000.0;
|
|
|
|
double lfCoeffX = 1.0, lfCoeffY = 1.0, lfCoeffStep = Coeff / 1000.0;
|
|
|
|
|
|
|
|
|
|
|
|
if Qt::Horizontal)
|
|
|
|
if (Horizontal)
|
|
|
|
lfCoeffX = (double)nHalfW / log (fabs (lfCoeffStep) * nHalfW + 1.0);
|
|
|
|
lfCoeffX = (double)nHalfW / log (fabs (lfCoeffStep) * nHalfW + 1.0);
|
|
|
|
if Qt::Vertical)
|
|
|
|
if (Vertical)
|
|
|
|
lfCoeffY = (double)nHalfH / log (fabs (lfCoeffStep) * nHalfH + 1.0);
|
|
|
|
lfCoeffY = (double)nHalfH / log (fabs (lfCoeffStep) * nHalfH + 1.0);
|
|
|
|
|
|
|
|
|
|
|
|
// initial copy
|
|
|
|
// initial copy
|
|
|
@ -410,7 +410,7 @@ void DistortionFX::cilindrical(Digikam::DImg *orgImage, Digikam::DImg *destImage
|
|
|
|
nh = fabs ((double)(h - nHalfH));
|
|
|
|
nh = fabs ((double)(h - nHalfH));
|
|
|
|
nw = fabs ((double)(w - nHalfW));
|
|
|
|
nw = fabs ((double)(w - nHalfW));
|
|
|
|
|
|
|
|
|
|
|
|
if Qt::Horizontal)
|
|
|
|
if (Horizontal)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (Coeff > 0.0)
|
|
|
|
if (Coeff > 0.0)
|
|
|
|
nw = (exp (nw / lfCoeffX) - 1.0) / lfCoeffStep;
|
|
|
|
nw = (exp (nw / lfCoeffX) - 1.0) / lfCoeffStep;
|
|
|
@ -418,7 +418,7 @@ void DistortionFX::cilindrical(Digikam::DImg *orgImage, Digikam::DImg *destImage
|
|
|
|
nw = lfCoeffX * log (1.0 + (-1.0 * lfCoeffStep) * nw);
|
|
|
|
nw = lfCoeffX * log (1.0 + (-1.0 * lfCoeffStep) * nw);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if Qt::Vertical)
|
|
|
|
if (Vertical)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (Coeff > 0.0)
|
|
|
|
if (Coeff > 0.0)
|
|
|
|
nh = (exp (nh / lfCoeffY) - 1.0) / lfCoeffStep;
|
|
|
|
nh = (exp (nh / lfCoeffY) - 1.0) / lfCoeffStep;
|
|
|
@ -657,7 +657,7 @@ void DistortionFX::circularWaves(Digikam::DImg *orgImage, Digikam::DImg *destIma
|
|
|
|
* Amplitude => Sinoidal maximum height.
|
|
|
|
* Amplitude => Sinoidal maximum height.
|
|
|
|
* Frequency => Frequency value.
|
|
|
|
* Frequency => Frequency value.
|
|
|
|
* FillSides => Like a boolean variable.
|
|
|
|
* FillSides => Like a boolean variable.
|
|
|
|
* Direction =>Qt::Vertical or horizontal flag.
|
|
|
|
* Direction => Vertical or horizontal flag.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Theory => This is an amazing effect, very funny, and very simple to
|
|
|
|
* Theory => This is an amazing effect, very funny, and very simple to
|
|
|
|
* understand. You just need understand how sin and cos works.
|
|
|
|
* understand. You just need understand how sin and cos works.
|
|
|
@ -675,7 +675,7 @@ void DistortionFX::waves(Digikam::DImg *orgImage, Digikam::DImg *destImage,
|
|
|
|
int progress;
|
|
|
|
int progress;
|
|
|
|
int h, w;
|
|
|
|
int h, w;
|
|
|
|
|
|
|
|
|
|
|
|
if (Direction) //Qt::Horizontal
|
|
|
|
if (Direction) // Horizontal
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int tx;
|
|
|
|
int tx;
|
|
|
|
|
|
|
|
|
|
|
|