|
|
|
@ -360,8 +360,8 @@ void DistortionFX::twirl(Digikam::DImg *orgImage, Digikam::DImg *destImage, int
|
|
|
|
|
* Width => Width of image.
|
|
|
|
|
* Height => Height of image.
|
|
|
|
|
* Coeff => Cilindrical value.
|
|
|
|
|
*Qt::Horizontal => Apply horizontally.
|
|
|
|
|
*Qt::Vertical => Apply vertically.
|
|
|
|
|
* Horizontal => Apply horizontally.
|
|
|
|
|
* Vertical => Apply vertically.
|
|
|
|
|
* Antialias => Smart bluring result.
|
|
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
int Width = orgImage->width();
|
|
|
|
@ -392,9 +392,9 @@ void DistortionFX::cilindrical(Digikam::DImg *orgImage, Digikam::DImg *destImage
|
|
|
|
|
int nHalfW = Width / 2, nHalfH = Height / 2;
|
|
|
|
|
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);
|
|
|
|
|
if Qt::Vertical)
|
|
|
|
|
if (Vertical)
|
|
|
|
|
lfCoeffY = (double)nHalfH / log (fabs (lfCoeffStep) * nHalfH + 1.0);
|
|
|
|
|
|
|
|
|
|
// initial copy
|
|
|
|
@ -410,7 +410,7 @@ void DistortionFX::cilindrical(Digikam::DImg *orgImage, Digikam::DImg *destImage
|
|
|
|
|
nh = fabs ((double)(h - nHalfH));
|
|
|
|
|
nw = fabs ((double)(w - nHalfW));
|
|
|
|
|
|
|
|
|
|
if Qt::Horizontal)
|
|
|
|
|
if (Horizontal)
|
|
|
|
|
{
|
|
|
|
|
if (Coeff > 0.0)
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if Qt::Vertical)
|
|
|
|
|
if (Vertical)
|
|
|
|
|
{
|
|
|
|
|
if (Coeff > 0.0)
|
|
|
|
|
nh = (exp (nh / lfCoeffY) - 1.0) / lfCoeffStep;
|
|
|
|
@ -657,7 +657,7 @@ void DistortionFX::circularWaves(Digikam::DImg *orgImage, Digikam::DImg *destIma
|
|
|
|
|
* Amplitude => Sinoidal maximum height.
|
|
|
|
|
* Frequency => Frequency value.
|
|
|
|
|
* 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
|
|
|
|
|
* 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 h, w;
|
|
|
|
|
|
|
|
|
|
if (Direction) //Qt::Horizontal
|
|
|
|
|
if (Direction) // Horizontal
|
|
|
|
|
{
|
|
|
|
|
int tx;
|
|
|
|
|
|
|
|
|
|