ImageRotate option now gets better quality than r342.

This commit is contained in:
spx 2010-02-26 02:54:13 +00:00
parent 8c87dd66b7
commit 234250f59f

View File

@ -323,18 +323,14 @@ void CMeterImage::ApplyTransform()
REAL transformW = fabs(originalW * cos_f) + fabs(originalH * sin_f); REAL transformW = fabs(originalW * cos_f) + fabs(originalH * sin_f);
REAL transformH = fabs(originalW * sin_f) + fabs(originalH * cos_f); REAL transformH = fabs(originalW * sin_f) + fabs(originalH * cos_f);
REAL cx = transformW / 2.0f;
REAL cy = transformH / 2.0f;
Bitmap* transform = new Bitmap((int)(transformW + 0.5f), (int)(transformH + 0.5f), PixelFormat32bppARGB); Bitmap* transform = new Bitmap((int)(transformW + 0.5f), (int)(transformH + 0.5f), PixelFormat32bppARGB);
Graphics graphics(transform); Graphics graphics(transform);
graphics.SetPixelOffsetMode(PixelOffsetModeHighQuality); graphics.SetPixelOffsetMode(PixelOffsetModeHighQuality);
if (m_AntiAlias) REAL cx = transformW / 2.0f;
{ REAL cy = transformH / 2.0f;
graphics.SetInterpolationMode(InterpolationModeHighQuality);
}
Matrix rotateMatrix; Matrix rotateMatrix;
rotateMatrix.RotateAt(m_Rotate, PointF(cx, cy)); rotateMatrix.RotateAt(m_Rotate, PointF(cx, cy));
@ -347,7 +343,7 @@ void CMeterImage::ApplyTransform()
} }
RectF r(cx - originalW / 2.0f, cy - originalH / 2.0f, originalW, originalH); RectF r(cx - originalW / 2.0f, cy - originalH / 2.0f, originalW, originalH);
graphics.DrawImage(original, r, 0.0f, 0.0f, r.Width, r.Height, UnitPixel); graphics.DrawImage(original, r, -0.5f, -0.5f, originalW + 1.0f, originalH + 1.0f, UnitPixel); // Makes the anti-aliased edge
if (m_Flip != RotateNoneFlipNone) if (m_Flip != RotateNoneFlipNone)
{ {