GDI Matrix transformations

InertiaM

Well-known member
Joined
Nov 3, 2007
Messages
663
Location
Kent, UK
Programming Experience
10+
I am drawing on the screen with Y direction as up the screen, rather than down, using the following code :-


VB.NET:
    Private mYFlip As New Matrix(1, 0, 0, -1, 0, 0)

    With e.Graphics
      .PageUnit = GraphicsUnit.Millimeter
      .Transform = mYFlip

      'drawing happens here
    End With

I now need to translate the origin, scale the transformation, move the origin slightly - and then change the Y direction to be down the screen. It's the last part I am stuck on - I can read the current matrix, but how do I now create a new matrix, with Y down, based on the current matrix and associated origin and scale?


VB.NET:
    With e.Graphics
      .PageUnit = GraphicsUnit.Millimeter
      .Transform = mYFlip

      .TranslateTransform(whatX, whatY)
      .ScaleTransform(2.5, 2.5)
      .TranslateTransform(-125, -150)

      Dim mCurrentMatrix As Matrix = eg.Transform
      'what to do now, to keep origin and scale the same, but make Y down the screen?

      'drawing happens here
    End With
 
Back
Top