Aabha
Aabha

Reputation: 314

What is the use of System.Drawing.Drawing2D.Matrix class?

If the Graphics class handle all the functionality as Matrix ?

Upvotes: 0

Views: 1487

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1500665

No, with the Graphics class you can perform specific transformations using methods such as ScaleTransform, but the Matrix class represents the transformation itself - which is why the Graphics.Transform property is of type Matrix.

Suppose you want to perform the same transformation on multiple Graphics objects, without the point at which the transformation is applied being code which should know what the transformation it. Or suppose you want to combine different transformations in different stages of a pipeline... how would you represent that transformation without Matrix? You could remember a bunch of delegates applied to a Graphics object, but that seems a bit longwinded compared with the natural matrix approach.

Upvotes: 3

Related Questions