/// <summary> /// Copies the properties of another instance to this instance. /// </summary> /// <param name="pen">the PenHolder object to copy</param> public void CopyFrom(PenX pen) { if (object.ReferenceEquals(this, pen)) return; _SetPenVariable(null); this._configuredProperties = pen._configuredProperties; this._penType = pen.PenType; this._alignment = pen.Alignment; if (0 != (this._configuredProperties & Configured.Brush)) this._brush = new BrushX(pen._brush); this._color = pen.Color; if (null != pen._compoundArray) this._compoundArray = (float[])pen.CompoundArray.Clone(); else this._compoundArray = null; this._dashPattern = pen._dashPattern; // immutable this._dashCap = pen._dashCap; this._cachedDashStyle = pen._cachedDashStyle; if (null != pen._cachedDashPattern) this._cachedDashPattern = (float[])pen._cachedDashPattern.Clone(); else this._cachedDashPattern = null; this._cachedDashOffset = pen._cachedDashOffset; this._endCap = pen.EndCap; this._lineJoin = pen.LineJoin; this._miterLimit = pen.MiterLimit; this._startCap = pen.StartCap; if (null != pen._transformation) this._transformation = pen.Transform.Clone(); else this._transformation = null; this._width = pen.Width; // note: there is an problem with Pen.Clone() : if the Color of the pen // was set to a known color, the color of the cloned pen is the same, but no longer a known color // therefore we avoid the cloning of the pen here // if(m_CachedMode && null!=pen.m_Pen) // _SetPenVariable( (Pen)pen.m_Pen.Clone() ); // else // _SetPenVariable(null); }
protected override void Dispose(bool isDisposing) { _configuredProperties = 0; if (null != _cachedPen) { _cachedPen.Dispose(); _cachedPen = null; } if (null != _transformation) { _transformation.Dispose(); _transformation = null; } if (null != _compoundArray) { _compoundArray = null; } if (null != this._cachedDashPattern) { _cachedDashPattern = null; } base.Dispose(isDisposing); }
/// <summary> /// Copies the properties of another instance to this instance. /// </summary> /// <param name="pen">the PenHolder object to copy</param> public void CopyFrom(PenX pen) { _SetPenVariable(null); this.m_ConfiguredProperties = pen.m_ConfiguredProperties; this.m_PenType = pen.PenType; this.m_Alignment = pen.Alignment; if (0 != (this.m_ConfiguredProperties & Configured.Brush)) this.m_Brush = new BrushX(pen.m_Brush); this.m_Color = pen.Color; if (null != pen.m_CompoundArray) this.m_CompoundArray = (float[])pen.CompoundArray.Clone(); else this.m_CompoundArray = null; this.m_DashCap = pen.DashCap; this.m_DashOffset = pen.DashOffset; if (null != pen.m_DashPattern) this.m_DashPattern = (float[])pen.DashPattern.Clone(); else this.m_DashPattern = null; this.m_DashStyle = pen.DashStyle; this.m_EndCap = pen.EndCap; this.m_LineJoin = pen.LineJoin; this.m_MiterLimit = pen.MiterLimit; this.m_StartCap = pen.StartCap; if (null != pen.m_Transform) this.m_Transform = pen.Transform.Clone(); else this.m_Transform = null; this.m_Width = pen.Width; // note: there is an problem with Pen.Clone() : if the Color of the pen // was set to a known color, the color of the cloned pen is the same, but no longer a known color // therefore we avoid the cloning of the pen here // if(m_CachedMode && null!=pen.m_Pen) // _SetPenVariable( (Pen)pen.m_Pen.Clone() ); // else // _SetPenVariable(null); }
private void _SetProp(Configured prop, bool bSet) { this._configuredProperties &= (Configured.All ^ prop); if (bSet) this._configuredProperties |= prop; }
public void Dispose() { m_ConfiguredProperties = 0; if (null != m_Pen) { m_Pen.Dispose(); m_Pen = null; } if (null != m_Transform) { m_Transform.Dispose(); m_Transform = null; } if (null != m_CompoundArray) { m_CompoundArray = null; } if (null != this.m_DashPattern) { m_DashPattern = null; } }