Gfx: Add GDI+ specific temporary solution for transformations

This commit is contained in:
Birunthan Mohanathas 2013-03-29 13:33:11 +02:00
parent 6f81e31f10
commit 349988e5dd
5 changed files with 37 additions and 12 deletions

View File

@ -57,6 +57,12 @@ public:
virtual bool IsTransparentPixel(int x, int y) = 0;
// TODO: Implement proper solution.
virtual void SetTransform(const Gdiplus::Matrix& matrix) {}
virtual void ResetTransform() {}
virtual void RotateTransform(float angle) {}
virtual void TranslateTransform(float dx, float dy) {}
virtual void SetAntiAliasing(bool enable) = 0;
virtual void SetTextAntiAliasing(bool enable) = 0;

View File

@ -128,6 +128,26 @@ bool CanvasGDIP::IsTransparentPixel(int x, int y)
return false;
}
void CanvasGDIP::SetTransform(const Gdiplus::Matrix& matrix)
{
m_Graphics->SetTransform(&matrix);
}
void CanvasGDIP::ResetTransform()
{
m_Graphics->ResetTransform();
}
void CanvasGDIP::RotateTransform(float angle)
{
m_Graphics->RotateTransform(angle);
}
void CanvasGDIP::TranslateTransform(float dx, float dy)
{
m_Graphics->TranslateTransform(dx, dy);
}
void CanvasGDIP::SetAntiAliasing(bool enable)
{
m_Graphics->SetSmoothingMode(

View File

@ -48,6 +48,11 @@ public:
virtual bool IsTransparentPixel(int x, int y) override;
virtual void SetTransform(const Gdiplus::Matrix& matrix) override;
virtual void ResetTransform() override;
virtual void RotateTransform(float angle) override;
virtual void TranslateTransform(float dx, float dy) override;
virtual void SetAntiAliasing(bool enable) override;
virtual void SetTextAntiAliasing(bool enable) override;

View File

@ -542,10 +542,9 @@ bool CMeterString::DrawString(Gfx::Canvas& canvas, RectF* rect)
if (m_Angle != 0.0f)
{
// TODO FIXME
//graphics.TranslateTransform((Gdiplus::REAL)CMeter::GetX(), y);
//graphics.RotateTransform(CONVERT_TO_DEGREES(m_Angle));
//graphics.TranslateTransform(-(Gdiplus::REAL)CMeter::GetX(), -y);
canvas.TranslateTransform((Gdiplus::REAL)CMeter::GetX(), y);
canvas.RotateTransform(CONVERT_TO_DEGREES(m_Angle));
canvas.TranslateTransform(-(Gdiplus::REAL)CMeter::GetX(), -y);
}
if (m_Effect != EFFECT_NONE)
@ -576,8 +575,7 @@ bool CMeterString::DrawString(Gfx::Canvas& canvas, RectF* rect)
if (m_Angle != 0.0f)
{
// TODO FIXME
//graphics.ResetTransform();
canvas.ResetTransform();
}
}

View File

@ -2527,13 +2527,9 @@ void CMeterWindow::Redraw()
const Matrix* matrix = (*j)->GetTransformationMatrix();
if (matrix && !matrix->IsIdentity())
{
// TODO FIXME: Change the world matrix
//m_Canvas->GetGraphics().SetTransform(matrix);
m_Canvas->SetTransform(*matrix);
(*j)->Draw(*m_Canvas);
// TODO FIXME: Set back to identity matrix
//m_Canvas->GetGraphics().ResetTransform();
m_Canvas->ResetTransform();
}
else
{