示例#1
0
 // Get the toolkit version of this brush for a specific toolkit.
 internal IToolkitBrush GetBrush(IToolkit toolkit)
 {
     lock (this)
     {
         if (this.toolkitBrush == null)
         {
             // We don't yet have a toolkit brush yet.
             this.toolkitBrush = CreateBrush(toolkit);
             this.toolkit      = toolkit;
             return(this.toolkitBrush);
         }
         else if (this.toolkit == toolkit)
         {
             // Same toolkit - return the cached brush information.
             return(this.toolkitBrush);
         }
         else
         {
             // We have a brush for another toolkit,
             // so dispose it and create for this toolkit.
             // We null out "toolkitBrush" before calling
             // "CreateBrush()" just in case an exception
             // is thrown while creating the toolkit brush.
             this.toolkitBrush.Dispose();
             this.toolkitBrush = null;
             this.toolkitBrush = CreateBrush(toolkit);
             this.toolkit      = toolkit;
             return(this.toolkitBrush);
         }
     }
 }
示例#2
0
 public DrawingXorBrush(IToolkit toolkit, IToolkitBrush innerBrush)
     : base(toolkit, System.Drawing.Color.Black)
 {
     // TODO: create the XOR brush.
     this.innerBrush = innerBrush;
     hBrush          = IntPtr.Zero;
 }
	public DrawingXorBrush(IToolkit toolkit, IToolkitBrush innerBrush)
		: base(toolkit, System.Drawing.Color.Black)
	{
		// TODO: create the XOR brush.
		this.innerBrush = innerBrush;
		hBrush = IntPtr.Zero;
	}
示例#4
0
        // Select a brush-based pen into a graphics object.
        public override void Select(IToolkitGraphics graphics, IToolkitBrush brush)
        {
            // Set the basic line information first.
            Select(graphics);

            // Select the brush details into the graphics context.
            brush.Select(graphics);
        }
示例#5
0
	protected virtual void Dispose(bool disposing)
			{
				lock(this)
				{
					if(toolkitBrush != null)
					{
						toolkitBrush.Dispose();
						toolkitBrush = null;
					}
				}
			}
示例#6
0
 protected virtual void Dispose(bool disposing)
 {
     lock (this)
     {
         if (toolkitBrush != null)
         {
             toolkitBrush.Dispose();
             toolkitBrush = null;
         }
     }
 }
示例#7
0
	// Mark this brush as modified, and flush all previous brush information.
	// Used when a subclass modifies a brush's properties.
	internal void Modified()
			{
				lock(this)
				{
					if(toolkitBrush != null)
					{
						toolkitBrush.Dispose();
						toolkitBrush = null;
					}
					toolkit = null;
				}
			}
示例#8
0
 // Mark this brush as modified, and flush all previous brush information.
 // Used when a subclass modifies a brush's properties.
 internal void Modified()
 {
     lock (this)
     {
         if (toolkitBrush != null)
         {
             toolkitBrush.Dispose();
             toolkitBrush = null;
         }
         toolkit = null;
     }
 }
	// Select a brush-based pen into a graphics object.
	public override void Select(IToolkitGraphics graphics, IToolkitBrush brush)
			{
				Select(graphics);
			}
示例#10
0
	// Constructor.
	internal Brush()
			{
				toolkit = null;
				toolkitBrush = null;
			}
示例#11
0
 // Constructor.
 public DrawingXorBrush(IToolkitBrush innerBrush)
     : base(System.Drawing.Color.Black)
 {
     this.innerBrush = innerBrush;
 }
	// Constructor.
	public DrawingXorBrush(IToolkitBrush innerBrush)
			: base(System.Drawing.Color.Black)
			{
				this.innerBrush = innerBrush;
			}
示例#13
0
 // Select a brush-based pen into a graphics object.
 public override void Select(IToolkitGraphics graphics, IToolkitBrush brush)
 {
     Select(graphics);
 }
		public abstract void Select(IToolkitGraphics graphics, IToolkitBrush brush);
示例#15
0
文件: XorBrush.cs 项目: ForNeVeR/pnet
        // Create this brush for a specific toolkit.  Inner part of "GetBrush()".
        internal override IToolkitBrush CreateBrush(IToolkit toolkit)
        {
            IToolkitBrush innerBrush = brush.GetBrush(toolkit);

            return(toolkit.CreateXorBrush(innerBrush));
        }
示例#16
0
 // Select a brush-based pen into a graphics object.
 public void Select(IToolkitGraphics graphics, IToolkitBrush brush)
 {
     Select(graphics);
     // TODO: select the brush information
 }
示例#17
0
 public IToolkitBrush CreateXorBrush(IToolkitBrush innerBrush)
 {
     throw new NotImplementedException();
 }
	// Create an XOR brush.
	public virtual IToolkitBrush CreateXorBrush(IToolkitBrush innerBrush)
			{
				return null;
			}
示例#19
0
 public abstract void Select(IToolkitGraphics graphics, IToolkitBrush brush);
	// Select a brush-based pen into a graphics object.
	public void Select(IToolkitGraphics graphics, IToolkitBrush brush)
			{
				Select(graphics);
				// TODO: select the brush information
			}
示例#21
0
 // Constructor.
 internal Brush()
 {
     toolkit      = null;
     toolkitBrush = null;
 }
示例#22
0
	// Get the toolkit version of this brush for a specific toolkit.
	internal IToolkitBrush GetBrush(IToolkit toolkit)
			{
				lock(this)
				{
					if(this.toolkitBrush == null)
					{
						// We don't yet have a toolkit brush yet.
						this.toolkitBrush = CreateBrush(toolkit);
						this.toolkit = toolkit;
						return this.toolkitBrush;
					}
					else if(this.toolkit == toolkit)
					{
						// Same toolkit - return the cached brush information.
						return this.toolkitBrush;
					}
					else
					{
						// We have a brush for another toolkit,
						// so dispose it and create for this toolkit.
						// We null out "toolkitBrush" before calling
						// "CreateBrush()" just in case an exception
						// is thrown while creating the toolkit brush.
						this.toolkitBrush.Dispose();
						this.toolkitBrush = null;
						this.toolkitBrush = CreateBrush(toolkit);
						this.toolkit = toolkit;
						return this.toolkitBrush;
					}
				}
			}
示例#23
0
 // Create an XOR brush.
 public virtual IToolkitBrush CreateXorBrush(IToolkitBrush innerBrush)
 {
     return(null);
 }
示例#24
0
	// Select a brush-based pen into a graphics object.
	public override void Select(IToolkitGraphics graphics, IToolkitBrush brush)
			{
				// Set the basic line information first.
				Select(graphics);

				// Select the brush details into the graphics context.
				brush.Select(graphics);
			}
	// Create an XOR brush.
	public IToolkitBrush CreateXorBrush(IToolkitBrush innerBrush)
			{
				return new DrawingXorBrush(innerBrush);
			}
示例#26
0
 public void Select(IToolkitGraphics graphics, IToolkitBrush brush)
 {
     graphics.Pen = this;
 }
示例#27
0
 // Create an XOR brush.
 public IToolkitBrush CreateXorBrush(IToolkitBrush innerBrush)
 {
     return(new DrawingXorBrush(innerBrush));
 }