/// <summary> /// Create a new transformation matrix and make it active /// </summary> public void PushMatrix() { if (currentTransform == null) { currentTransform = new Matrix3x3(); } else { //store current transform to stack if (matrixStack == null) matrixStack = new Matrix3x3Stack(); matrixStack.Push(currentTransform); //create a new matrix currentTransform = currentTransform.Clone(); } transformRequired = true; }
/// <summary> /// Restore the state of this drawer /// </summary> public void Load(object state) { if (state is DrawerState) { DrawerState ds = (DrawerState)state; currentTransform = ds.CurrentTransform; matrixStack = ds.MatrixStack; transformRequired = currentTransform != null; } else Cross.Drawing.IncompatibleTypeException.Publish(state, typeof(DrawerState)); }