DockySurface ResetBuffer (DockySurface buffer)
		{
			if (buffer != null)
				buffer.Dispose ();
			
			return null;
		}
Exemple #2
0
		static DockySurface[] GetSlices (DockySurface model)
		{
			if (menu_slices != null)
				return menu_slices;
			
			DockySurface main = new DockySurface (TotalWidth, TotalHeight, model);
			
			using (Gdk.Pixbuf pixbuf = DockServices.Drawing.LoadIcon (DockServices.Theme.MenuSvg)) {
				Gdk.CairoHelper.SetSourcePixbuf (main.Context, pixbuf, ShadowSize, ShadowSize);
				main.Context.Paint ();
			}
			
			Gdk.Rectangle extents;
			if (ShadowSize > 0)
				using (DockySurface shadow = main.CreateMask (0, out extents)) {
					shadow.GaussianBlur (ShadowSize);
					shadow.Context.Operator = Operator.DestOut;
					for (int i = 0; i < 4; i++) {
						shadow.Context.SetSource (main.Internal);
						shadow.Context.Paint ();
					}
					
					main.Context.Operator = Operator.DestOver;
					main.Context.SetSource (shadow.Internal);
					main.Context.PaintWithAlpha (1);
					main.Context.Operator = Operator.Over;
				}
			
			int middleWidth = TotalWidth - 2 * SliceSize;
			int middleHeight = TotalHeight - 2 * SliceSize - TailHeight;
			int tailSliceSize = TailHeight + SliceSize;
			int tailSideSize = (middleWidth - TailWidth) / 2;
			
			DockySurface[] results = new DockySurface[11];
			results[(int) Slice.TopLeft] = main.CreateSlice (new Gdk.Rectangle (
					0, 
					0, 
					SliceSize, 
					SliceSize));
			
			results[(int) Slice.Top] = main.CreateSlice (new Gdk.Rectangle (
					SliceSize, 
					0, 
					middleWidth, 
					SliceSize));
			
			results[(int) Slice.TopRight] = main.CreateSlice (new Gdk.Rectangle (
					TotalWidth - SliceSize, 
					0, 
					SliceSize, 
					SliceSize));
			
			results[(int) Slice.Left] = main.CreateSlice (new Gdk.Rectangle (
					0, 
					SliceSize, 
					SliceSize, 
					middleHeight));
			
			results[(int) Slice.Center] = main.CreateSlice (new Gdk.Rectangle (
					SliceSize, 
					SliceSize, 
					middleWidth, 
					middleHeight));
			
			results[(int) Slice.Right] = main.CreateSlice (new Gdk.Rectangle (
					TotalWidth - SliceSize, 
					SliceSize, 
					SliceSize, 
					middleHeight));
			
			results[(int) Slice.BottomLeft] = main.CreateSlice (new Gdk.Rectangle (
					0, 
					TotalHeight - tailSliceSize, 
					SliceSize, 
					tailSliceSize));
			
			results[(int) Slice.TailLeft] = main.CreateSlice (new Gdk.Rectangle (
					SliceSize, 
					TotalHeight - tailSliceSize, 
					tailSideSize, 
					tailSliceSize));
			
			results[(int) Slice.Tail] = main.CreateSlice (new Gdk.Rectangle (
					SliceSize + tailSideSize,
					TotalHeight - tailSliceSize,
					TailWidth,
					tailSliceSize));
				
			results[(int) Slice.TailRight] = main.CreateSlice (new Gdk.Rectangle (
					SliceSize + middleWidth - tailSideSize,
					TotalHeight - tailSliceSize,
					tailSideSize,
					tailSliceSize));
			
			results[(int) Slice.BottomRight] = main.CreateSlice (new Gdk.Rectangle (
					SliceSize + middleWidth,
					TotalHeight - tailSliceSize,
					SliceSize,
					tailSliceSize));
			
			menu_slices = results;
			
			main.Dispose ();
			
			return menu_slices;
		}
		static DockySurface[] GetSlices (DockySurface model)
		{
			if (slices != null)
				return slices;
			
			DockySurface main = new DockySurface (3 * AbstractDockItem.HoverTextHeight / 2, AbstractDockItem.HoverTextHeight, model);
			
			using (Gdk.Pixbuf pixbuf = DockServices.Drawing.LoadIcon (DockServices.Theme.TooltipSvg)) {
				Gdk.CairoHelper.SetSourcePixbuf (main.Context, pixbuf, 0, 0);
				main.Context.Paint ();
			}
			
			DockySurface[] results = new DockySurface[3];
			
			results[0] = main.CreateSlice (new Gdk.Rectangle (0, 0, AbstractDockItem.HoverTextHeight / 2, AbstractDockItem.HoverTextHeight));
			results[1] = main.CreateSlice (new Gdk.Rectangle (AbstractDockItem.HoverTextHeight / 2, 0, AbstractDockItem.HoverTextHeight / 2, AbstractDockItem.HoverTextHeight));
			results[2] = main.CreateSlice (new Gdk.Rectangle (AbstractDockItem.HoverTextHeight, 0, AbstractDockItem.HoverTextHeight / 2, AbstractDockItem.HoverTextHeight));
			
			slices = results;
			
			main.Dispose ();
			
			return slices;
		}