/// <summary>Sets every field of this MetaState to the values of the fields of the specified MetaState.</summary> /// <param name="state">state to copy</param> public virtual void SetMetaState(iText.Kernel.Pdf.Canvas.Wmf.MetaState state) { savedStates = state.savedStates; MetaObjects = state.MetaObjects; currentPoint = state.currentPoint; currentPen = state.currentPen; currentBrush = state.currentBrush; currentFont = state.currentFont; currentBackgroundColor = state.currentBackgroundColor; currentTextColor = state.currentTextColor; backgroundMode = state.backgroundMode; polyFillMode = state.polyFillMode; textAlign = state.textAlign; lineJoin = state.lineJoin; offsetWx = state.offsetWx; offsetWy = state.offsetWy; extentWx = state.extentWx; extentWy = state.extentWy; scalingX = state.scalingX; scalingY = state.scalingY; }
/// <summary>Restores the state to the next state on the saved states stack.</summary> /// <param name="index">index of the state to be restored</param> /// <param name="cb">PdfCanvas object on which restoreState() will be called</param> public virtual void RestoreState(int index, PdfCanvas cb) { int pops; if (index < 0) { pops = Math.Min(-index, savedStates.Count); } else { pops = Math.Max(savedStates.Count - index, 0); } if (pops == 0) { return; } iText.Kernel.Pdf.Canvas.Wmf.MetaState state = null; while (pops-- != 0) { cb.RestoreState(); state = savedStates.Pop(); } SetMetaState(state); }
/// <summary>Saves the state of this MetaState object.</summary> /// <param name="cb">PdfCanvas object on which saveState() will be called</param> public virtual void SaveState(PdfCanvas cb) { cb.SaveState(); iText.Kernel.Pdf.Canvas.Wmf.MetaState state = new iText.Kernel.Pdf.Canvas.Wmf.MetaState(this); savedStates.Push(state); }
/// <summary>Clones a new MetaState from the specified MetaState.</summary> /// <param name="state">the state to clone</param> public MetaState(iText.Kernel.Pdf.Canvas.Wmf.MetaState state) { SetMetaState(state); }