rendered paste bodyvoid MythImage::Reflect(ReflectAxis axis, int shear, int scale, int length)
{
QImage mirrorImage;
if (axis == ReflectHorizontal)
{
mirrorImage = mirrored(true,false);
if (length < 100)
{
int height = (int)((float)mirrorImage.height() * (float)length/100);
mirrorImage = mirrorImage.copy(0,0,mirrorImage.width(),height);
}
}
else if (axis == ReflectHorizontal)
{
mirrorImage = mirrored(false,true);
if (length < 100)
{
int width = (int)((float)mirrorImage.width() * (float)length/100);
mirrorImage = mirrorImage.copy(0,0,width,mirrorImage.height());
}
}
QImage alphaChannel(mirrorImage.size(), QImage::Format_RGB32);
MakeGradient(alphaChannel, QColor("#AAAAAA"), QColor("#000000"), 255);
mirrorImage.setAlphaChannel(alphaChannel);
QMatrix shearMatrix;
if (axis == ReflectHorizontal)
{
shearMatrix.scale(scale/100,1);
shearMatrix.shear(0,shear/100);
}
else if (axis == ReflectHorizontal)
{
shearMatrix.scale(1,scale/100);
shearMatrix.shear(shear/100,0);
}
mirrorImage = mirrorImage.transformed(shearMatrix);
QSize newsize(mirrorImage.width(), height()+mirrorImage.height());
QImage temp(newsize, QImage::Format_ARGB32);
temp.fill(Qt::transparent);
QPainter newpainter(&temp);
newpainter.setCompositionMode(QPainter::CompositionMode_SourceOver);
newpainter.drawImage(0, 0, copy(0,0,width(),height()));
newpainter.drawImage(0, height(), mirrorImage);
newpainter.end();
Assign(temp);
}