Example #1
0
        public override void Draw(TreeNodeAdv node, DrawContext context)
        {
            if (context.CurrentEditorOwner == this && node == Parent.CurrentNode)
                return;

            var label = GetLabel(node);
            var textBounds = GetBounds(node, context);
            var focusRect = new Rectangle(textBounds.X, context.Bounds.Y,
                textBounds.Width - 1, context.Bounds.Height - 1);

            Brush backgroundBrush;
            Color textColor;
            Font font;
            CreateBrushes(node, context, label, out backgroundBrush, out textColor, out font, ref label);

            //if (backgroundBrush != null)
            //    context.Graphics.FillRectangle(backgroundBrush, focusRect);

            var focusPen = new Pen(SystemColors.Highlight);
            focusPen.Color = context.DrawSelection == DrawSelectionMode.None ? 
                SystemColors.ControlText : SystemColors.InactiveCaption;

            //focusPen.Color = SystemColors.Highlight;
            //context.Graphics.DrawRectangle(focusPen, focusRect);
            
            if (UseCompatibleTextRendering)
                TextRenderer.DrawText(context.Graphics, label, font, textBounds, textColor, _formatFlags);
            else
                context.Graphics.DrawString(label, font, GetBrush(textColor), textBounds, _format);
        }
Example #2
0
		public override void Draw(TreeNodeAdv node, DrawContext context)
		{
			if (node.CanExpand)
			{
				Rectangle r = context.Bounds;
				int dy = (int)Math.Round((float)(r.Height - ImageSize) / 2);

                if (_useVisualStyles)
                {
                    VisualStyleRenderer renderer;

                    if (node.IsExpanded)
                        renderer = _openedRenderer;
                    else
                        renderer = _closedRenderer;

                    renderer.DrawBackground(context.Graphics, new Rectangle(r.X, r.Y + dy, ImageSize, ImageSize));
                }
                else
                {
                    Image img;

                    if (node.IsExpanded)
                        img = this.Minus;
                    else
                        img = this.Plus;

                    context.Graphics.DrawImageUnscaled(img, new Point(r.X, r.Y + dy));
                }
			}
		}
Example #3
0
        public void CommentHitTestError()
        {
            string test="<p><!--OddPage--></p>";
            XmlDocument doc=new XmlDocument();
            doc.LoadXml(test);

            Stylesheet s=new Stylesheet();
            s.BindStyles(doc.NameTable);

            Rectangle rc=new Rectangle(0, 0, 500, int.MaxValue);

            using ( IGraphics gr=new DummyGraphics() )
            {
                DrawContext ctx=new DrawContext(gr, Point.Empty, rc, rc, null, new DocumentType(), null);
                LayoutEngine layoutEngine=new LayoutEngine(s);

                layoutEngine.Reflow(ctx, doc.DocumentElement);

                Console.WriteLine("Bounds {0}", layoutEngine.BoundingRect);
                for (int x=0; x< layoutEngine.BoundingRect.Width; x+=10)
                {
                    HitTestInfo hti=layoutEngine.GetHitTestInfo(gr, new Point(x,8));
                    SelectionPoint sp=hti.SelectionPoint;
                    Console.WriteLine("Hit test at {0} = {1}", x, sp);
                }
            }
        }
Example #4
0
        public override void Draw(DrawContext context, PxRect pxrect, PxRect? pxsampleRect = null, DrawColor? color = null)
        {
            context.Set();
            Rectangle rect = pxrect.Rectangle();
            Rectangle sampleRect;
            if (pxsampleRect == null) sampleRect = texture.Bounds;
            else sampleRect = pxsampleRect.Value.Rectangle();

            // top left
            DrawBatch.Draw(texture, rect.MarginTop(fh).MarginLeft(fw).PxRect(), sampleRect.MarginTop(fh).MarginLeft(fw).PxRect(), color);
            // top
            DrawBatch.Draw(texture, rect.MarginTop(fh).Inflated(-fw, 0).PxRect(), sampleRect.MarginTop(fh).Inflated(-fw, 0).PxRect(), color);
            // top right
            DrawBatch.Draw(texture, rect.MarginTop(fh).MarginRight(fw).PxRect(), sampleRect.MarginTop(fh).MarginRight(fw).PxRect(), color);
            // left
            DrawBatch.Draw(texture, rect.Inflated(0, -fh).MarginLeft(fw).PxRect(), sampleRect.Inflated(0, -fh).MarginLeft(fw).PxRect(), color);
            // center
            DrawBatch.Draw(texture, rect.Inflated(-fw, -fh).PxRect(), sampleRect.Inflated(-fw, -fh).PxRect(), color);
            // right
            DrawBatch.Draw(texture, rect.Inflated(0, -fh).MarginRight(fw).PxRect(), sampleRect.Inflated(0, -fh).MarginRight(fw).PxRect(), color);
            // bottom left
            DrawBatch.Draw(texture, rect.MarginBottom(fh).MarginLeft(fw).PxRect(), sampleRect.MarginBottom(fh).MarginLeft(fw).PxRect(), color);
            // bottom
            DrawBatch.Draw(texture, rect.MarginBottom(fh).Inflated(-fw, 0).PxRect(), sampleRect.MarginBottom(fh).Inflated(-fw, 0).PxRect(), color);
            // bottom right
            DrawBatch.Draw(texture, rect.MarginBottom(fh).MarginRight(fw).PxRect(), sampleRect.MarginBottom(fh).MarginRight(fw).PxRect(), color);
        }
Example #5
0
 public DrawEventArgs(TreeNodeAdv node, EditableControl control, DrawContext context, string text)
     : base(node)
 {
     _control = control;
     _context = context;
     _text = text;
 }
Example #6
0
 public override void Draw(TreeNodeAdv node, DrawContext context)
 {
     if (node.CanExpand)
     {
         Rectangle r = context.Bounds;
         int dy = (int)Math.Round((float)(r.Height - ImageSize) / 2);
         if (Application.RenderWithVisualStyles)
         {
             VisualStyleRenderer renderer;
             if (node.IsExpanded)
                 renderer = new VisualStyleRenderer(VisualStyleElement.TreeView.Glyph.Opened);
             else
                 renderer = new VisualStyleRenderer(VisualStyleElement.TreeView.Glyph.Closed);
             renderer.DrawBackground(context.Graphics, new Rectangle(r.X, r.Y + dy, ImageSize, ImageSize));
         }
         else
         {
             Image img;
             if (node.IsExpanded)
                 img = _minus;
             else
                 img = _plus;
             context.Graphics.DrawImageUnscaled(img, new Point(r.X, r.Y + dy));
         }
     }
 }
Example #7
0
 public override Size MeasureSize(TreeNodeAdv node, DrawContext context)
 {
     if (GetValue(node).ToString() == "")
         return new Size(0, 0);
     else
         return new Size(_normal.Width,_normal.Height);
 }
Example #8
0
 public override void Draw(TreeNodeAdv node, DrawContext context)
 {
     Rectangle bounds = GetBounds(node, context);
     CheckState state = GetCheckState(node);
     if (Application.RenderWithVisualStyles)
     {
         VisualStyleRenderer renderer;
         if (state == CheckState.Indeterminate)
             renderer = new VisualStyleRenderer(VisualStyleElement.Button.CheckBox.MixedNormal);
         else if (state == CheckState.Checked)
             renderer = new VisualStyleRenderer(VisualStyleElement.Button.CheckBox.CheckedNormal);
         else
             renderer = new VisualStyleRenderer(VisualStyleElement.Button.CheckBox.UncheckedNormal);
         renderer.DrawBackground(context.Graphics, new Rectangle(bounds.X, bounds.Y, ImageSize, ImageSize));
     }
     else
     {
         Image img;
         if (state == CheckState.Indeterminate)
             img = _unknown;
         else if (state == CheckState.Checked)
             img = _check;
         else
             img = _uncheck;
         context.Graphics.DrawImage(img, bounds.Location);
     }
 }
Example #9
0
 public override void Draw(TreeNodeAdv node, DrawContext context)
 {
     Rectangle r = context.Bounds;
     int dy = (int)Math.Round((float)(r.Height - ImageSize) / 2);
     CheckState state = GetCheckState(node);
     if (Application.RenderWithVisualStyles)
     {
         VisualStyleRenderer renderer;
         if (state == CheckState.Indeterminate)
             renderer = new VisualStyleRenderer(VisualStyleElement.Button.CheckBox.MixedNormal);
         else if (state == CheckState.Checked)
             renderer = new VisualStyleRenderer(VisualStyleElement.Button.CheckBox.CheckedNormal);
         else
             renderer = new VisualStyleRenderer(VisualStyleElement.Button.CheckBox.UncheckedNormal);
         renderer.DrawBackground(context.Graphics, new Rectangle(r.X, r.Y + dy, ImageSize, ImageSize));
     }
     else
     {
         Image img;
         if (state == CheckState.Indeterminate)
             img = _unknown;
         else if (state == CheckState.Checked)
             img = _check;
         else
             img = _uncheck;
         context.Graphics.DrawImage(img, new Point(r.X, r.Y + dy));
         //ControlPaint.DrawCheckBox(context.Graphics, r, state2);
     }
 }
		public override Size MeasureSize(TreeNodeAdv node, DrawContext context, int rightBoundLastControl)
		{
			Image image=GetIcon(node);
			if(image!=null)
				return image.Size;
			else
				return Size.Empty;
		}
Example #11
0
 public override void Draw(TreeNodeAdv node, DrawContext context)
 {
     Image image = GetIcon(node);
     if (image != null)
     {
         Rectangle r = GetBounds(node, context);
         context.Graphics.DrawImage(image, r.Location);
     }
 }
Example #12
0
		public override Size MeasureSize(TreeNodeAdv node, DrawContext context)
		{
			Image image = GetIcon(node);
			
            if (image != null)
				return image.Size;
			
            return Size.Empty;
		}
Example #13
0
 public override void Draw(TreeNodeAdv node, DrawContext context)
 {
     Image image = GetIcon(node);
     if (image != null)
     {
         Point point = new Point(context.Bounds.X,
             context.Bounds.Y + (context.Bounds.Height - image.Height) / 2);
         context.Graphics.DrawImage(image, point);
     }
 }
		public override void Draw(TreeNodeAdv node, DrawContext context)
		{
			Image image=GetIcon(node);
			if(image!=null)
			{
				Rectangle r=GetBounds(node, context);
				if(image.Width>0&&image.Height>0)
				{
					switch(_scaleMode)
					{
						case ImageScaleMode.Fit:
							context.Graphics.DrawImage(image, r);
							break;
						case ImageScaleMode.ScaleDown:
							{
								float factor=Math.Min((float)r.Width/(float)image.Width, (float)r.Height/(float)image.Height);
								if(factor<1)
									context.Graphics.DrawImage(image, r.X, r.Y, image.Width*factor, image.Height*factor);
								else
									context.Graphics.DrawImage(image, r.X, r.Y, image.Width, image.Height);
							} break;
						case ImageScaleMode.ScaleUp:
							{
								float factor=Math.Max((float)r.Width/(float)image.Width, (float)r.Height/(float)image.Height);
								if(factor>1)
									context.Graphics.DrawImage(image, r.X, r.Y, image.Width*factor, image.Height*factor);
								else
									context.Graphics.DrawImage(image, r.X, r.Y, image.Width, image.Height);
							} break;
						case ImageScaleMode.AlwaysScale:
							{
								float fx=(float)r.Width/(float)image.Width;
								float fy=(float)r.Height/(float)image.Height;
								if(Math.Min(fx, fy)<1)
								{ //scale down
									float factor=Math.Min(fx, fy);
									context.Graphics.DrawImage(image, r.X, r.Y, image.Width*factor, image.Height*factor);
								}
								else if(Math.Max(fx, fy)>1)
								{
									float factor=Math.Max(fx, fy);
									context.Graphics.DrawImage(image, r.X, r.Y, image.Width*factor, image.Height*factor);
								}
								else
									context.Graphics.DrawImage(image, r.X, r.Y, image.Width, image.Height);
							} break;
						case ImageScaleMode.Clip:
						default:
							context.Graphics.DrawImage(image, r.X, r.Y, image.Width, image.Height);
							break;
					}
				}

			}
		}
Example #15
0
 public override void Draw(TreeNodeAdv node, DrawContext context)
 {
     Image image = GetIcon(node);
     if (image != null)
     {
         Rectangle r = GetBounds(node, context);
     // ml: center icon vertically.
     r.Y += (context.Bounds.Height - r.Height) / 2;
         context.Graphics.DrawImage(image, r.Location);
     }
 }
Example #16
0
        public override Size MeasureSize(TreeNodeAdv node, DrawContext context)
        {
            if (!(node.Tag is Node)) return new Size(0, 0);

            var properNode = (Node) node.Tag;

            if (!_nodeTypesThatShouldBeSized.Contains(properNode.GetType())) return new Size(0, 0);

            if (node.Row == 0 && _firstRowSize != default(Size)) return _firstRowSize;

            return _fixedSize;
        }
Example #17
0
        public override void Draw(DrawContext context, PxRect rect, PxRect? sampleRect = null, DrawColor? color = null)
        {
            if (dirty) { BuildTexture(); dirty = false; }
            context.Set();

            int hoff = 0;
            int voff = (rect.H / 2) - (texture.Bounds.Height / 2);
            if (align == TextAlign.Right) hoff = rect.W - texture.Bounds.Width;
            else if (align == TextAlign.Center) hoff = (rect.W / 2) - (texture.Bounds.Width / 2);

            DrawBatch.Draw(texture, new PxRect(rect.Position + new PxVector(hoff, voff), texture.Bounds.Size.PxVector()), sampleRect, color);
            //DrawBatch.Draw(texture, rect, sampleRect, color);
        }
Example #18
0
 public override void Draw(TreeNodeAdv node, DrawContext context)
 {
     if (GetValue(node).ToString() != "")
     {
         Image img;
         if (_pstate)
             img = _pressed;
         else
             img = _normal;
         Rectangle bounds = GetBounds(node, context);
         context.Graphics.DrawImage(img, bounds.Location);
     }
 }
Example #19
0
        /// <summary>
        /// ć‚¤ćƒ³ć‚¹ć‚æćƒ³ć‚¹ć‚’ē”Ÿęˆć—ć¾ć™ć€‚
        /// </summary>
        /// <param name="game">Game怂</param>
        public UIManager(Game game)
            : base(game)
        {
            // ć‚µćƒ¼ćƒ“ć‚¹ćØ恗恦ē™»éŒ²ć—ć¾ć™ć€‚
            Game.Services.AddService(typeof(IUIService), this);

            scissorTestRasterizerState = new RasterizerState()
            {
                ScissorTestEnable = true
            };

            drawContext = new DrawContext(this);
        }
		public override void Draw(TreeNodeAdv node, DrawContext context)
		{
			Rectangle bounds=GetBounds(node, context);
			CheckState state=GetCheckState(node);

			//Bild zeichnen
			Image img;

			if(state==CheckState.Indeterminate) img=_unknown;
			else if(state==CheckState.Checked) img=_check;
			else img=_uncheck;

			context.Graphics.DrawImage(img, bounds.Location);
		}
Example #21
0
 protected override Rectangle GetBounds(TreeNodeAdv node, DrawContext context)
 {
     var r = context.Bounds;
     var s = GetActualSize(node, context);
     var bs = new Size(r.Width - LeftMargin, Math.Min(r.Height, s.Height));
     switch (IsFirstRow(node) ? FirstRowVerticalAlign : VerticalAlign)
     {
         case VerticalAlignment.Top:
             return new Rectangle(new Point(r.X + LeftMargin, r.Y + 4), bs);
         case VerticalAlignment.Bottom:
             return new Rectangle(new Point(r.X + LeftMargin, r.Bottom - s.Height), bs);
         default:
             return new Rectangle(new Point(r.X + LeftMargin, (r.Y + (r.Height - s.Height) / 2) + 4), bs);
     }
 }
Example #22
0
		protected virtual Rectangle GetBounds(TreeNodeAdv node, DrawContext context)
		{
			Rectangle r = context.Bounds;
			Size s = GetActualSize(node, context);
			Size bs = new Size(r.Width - LeftMargin, Math.Min(r.Height, s.Height));
			switch (VerticalAlign)
			{
				case VerticalAlignment.Top:
					return new Rectangle(new Point(r.X + LeftMargin, r.Y), bs);
				case VerticalAlignment.Bottom:
					return new Rectangle(new Point(r.X + LeftMargin, r.Bottom - s.Height), bs);
				default:
					return new Rectangle(new Point(r.X + LeftMargin, r.Y + (r.Height - s.Height) / 2), bs);
			}
		}
Example #23
0
        public override void Draw(TreeNodeAdv node, DrawContext context)
        {
            if (context.CurrentEditorOwner == this && node == Parent.CurrentNode)
                return;

            Rectangle clipRect = context.Bounds;
            Brush text = SystemBrushes.ControlText;

            string label = GetLabel(node);
            Size s = GetLabelSize(label);
            Rectangle focusRect = new Rectangle(clipRect.X, clipRect.Y, s.Width, clipRect.Height);

            if (context.DrawSelection == DrawSelectionMode.Active)
            {
                text = SystemBrushes.HighlightText;
                context.Graphics.FillRectangle(SystemBrushes.Highlight, focusRect);
            }
            else if (context.DrawSelection == DrawSelectionMode.Inactive)
            {
                text = SystemBrushes.ControlText;
                context.Graphics.FillRectangle(SystemBrushes.InactiveBorder, focusRect);
            }
            else if (context.DrawSelection == DrawSelectionMode.FullRowSelect)
            {
                text = SystemBrushes.HighlightText;
            }

            if (!context.Enabled)
                text = SystemBrushes.GrayText;

            if (context.DrawFocus)
            {
                focusRect.Width--;
                focusRect.Height--;
                context.Graphics.DrawRectangle(Pens.Gray, focusRect);
                context.Graphics.DrawRectangle(_focusPen, focusRect);
            }
            _format.Alignment = TextHelper.TranslateAligment(TextAlign);
            _format.Trimming = Trimming;
            context.Graphics.DrawString(label, context.Font, text, clipRect, _format);
        }
        int IScreen.Draw(DrawContext drawContext)
        {
            drawContext.Camera = this.Camera;
            var transform = Transform.Identity;

            // PreDraw
            foreach (var preDrawable in this.GetPreDrawables(this.Scene))
                preDrawable.PreDraw(drawContext);

            // Init draw
            if (((IScreen)this).UseLinearSampler)
                drawContext.UseLinearSampler();
            else
                drawContext.UsePointSampler();

            // Draw scene
            var total = this.Scene.Draw(drawContext, transform);

            // Finally draw this Screen
            return total + this.Draw(drawContext, transform);
        }
Example #25
0
		public override void Draw(TreeNodeAdv node, DrawContext context)
		{
			if (node.CanExpand)
			{
				Rectangle r = context.Bounds;
				int dy = (int)Math.Round((float)(r.Height - ImageSize) / 2);

                if (_useVisualStyles)
                {
                    VisualStyleRenderer renderer;

                    if (node.IsExpanded)
                        renderer = _openedRenderer;
                    else
                        renderer = _closedRenderer;

                    try
                    {
                        renderer.DrawBackground(context.Graphics, new Rectangle(r.X, r.Y + dy, ImageSize, ImageSize));
                    }
                    catch (InvalidOperationException)
                    {
                        // F*****g retarded VisualStyleRenderer throws exceptions.
                        _useVisualStyles = false;
                    }
                }

                if (!_useVisualStyles)
                {
                    Image img;

                    if (node.IsExpanded)
                        img = this.Minus;
                    else
                        img = this.Plus;

                    context.Graphics.DrawImageUnscaled(img, new Point(r.X, r.Y + dy));
                }
			}
		}
Example #26
0
        public void HitTestHandling()
        {
            string test="<p><b>xxxxxxxxxxxxx</b></p>";
            XmlDocument doc=new XmlDocument();
            doc.LoadXml(test);

            Stylesheet s=//Stylesheet.Load("c:/tmp/website/site.style", doc.NameTable);
            new Stylesheet();
            s.BindStyles(doc.NameTable);

            Rectangle rc=new Rectangle(0, 0, 500, int.MaxValue);

            using ( IGraphics gr=new DummyGraphics() )
            {
                DrawContext ctx=new DrawContext(gr, Point.Empty, rc, rc, null, new DocumentType(), null);
                LayoutEngine layoutEngine=new LayoutEngine(s);

                layoutEngine.Reflow(ctx, doc.DocumentElement);

                layoutEngine.GetHitTestInfo(gr, new Point(141,16));
            }
        }
		public override void Draw(TreeNodeAdv node, DrawContext context)
		{
		    if (!node.CanExpand)
		        return;

		    Rectangle r = context.Bounds;

            if (ExplorerVisualStyle.VisualStylesEnabled)
		    {
		        VisualStyleRenderer renderer;

		        if (node.IsExpanded)
		            renderer = this._openedRenderer;
		        else
		            renderer = this._closedRenderer;

		        try
		        {
                    renderer.DrawBackground(context.Graphics, new Rectangle(r.X, r.Y, Width, Width));
		        }
		        catch (InvalidOperationException)
		        {
		            
		        }
		    }
            else
		    {
		        Image img;

		        if (node.IsExpanded)
		            img = this.Minus;
		        else
		            img = this.Plus;

                int dy = (int)Math.Round((float)(r.Height - ImageSize) / 2);

		        context.Graphics.DrawImageUnscaled(img, new Point(r.X, r.Y + dy));
		    }
		}
Example #28
0
        public override void Reflow(DrawContext dc, BoundingContext bounds, bool incremental)
        {
            ReflowStart(dc);

            if ( incremental )
                bounds=bounds.Narrow(style.Left, style.Right);

            MarkupItem tag=new StartTag(CurrentLine, ElementNode);
            ReflowMarkup(tag, dc, style, bounds);

            ImageStyle s=style as ImageStyle;
            if ( s == null )
                throw new InvalidOperationException("Expected style for image to be Custom");

            string imgPath=ElementNode.GetAttribute(s.SourceAttribute);
            if ( imgPath == null )
                throw new InvalidOperationException("SourceAttribute for image is missing");

            // think about relative to doc
            Bitmap bm;

            Uri docUri=new Uri(elementNode.BaseURI);
            Uri uri=new Uri(docUri, imgPath);
            if ( uri.IsFile && File.Exists(uri.AbsolutePath) )
                bm=new Bitmap(uri.AbsolutePath);
            else
                bm=ErrorBitmap;

            ImageLineItem ili=new ImageLineItem(CurrentLine, ElementNode, bm);
            ReflowMarkup(ili, dc, style, bounds);

            tag=new EndTag(CurrentLine, ElementNode);
            ReflowMarkup(tag, dc, style, bounds);

            ReflowEnd(dc);
        }
Example #29
0
        public override Size MeasureSize(TreeNodeAdv node, DrawContext context)
        {
            var size = DrawOrMeasure(node, context, draw: false);

            return(new Size((int)Math.Ceiling(size.Width), (int)Math.Ceiling(size.Height)));
        }
Example #30
0
 public void drawAfter(DrawContext display, Point pt)
 {
     contrib.sprites[index, 1].draw(display.surface, pt);
 }
Example #31
0
 protected Size GetLabelSize(TreeNodeAdv node, DrawContext context)
 {
     return(GetLabelSize(node, context, GetLabel(node)));
 }
Example #32
0
 /**
  * Indicates whether this entry has expired.
  *
  * @param dc the current draw context.
  *
  * @return true if the entry has expired, otherwise false.
  */
 public bool isExpired(DrawContext dc)
 {
     return(dc != null?timer.isExpired(dc) : timer.isExpired(System.currentTimeMillis()));
 }
Example #33
0
 /**
  * Resets the timer to the current time.
  *
  * @param dc the current draw context.
  *
  * @throws ArgumentException if the draw context is null.
  */
 public void restartTimer(DrawContext dc)
 {
     this.timer.restart(dc);
 }
 public override Size MeasureSize(TreeNodeAdv node, DrawContext context)
 {
     return(new Size(ImageSize, ImageSize));
 }
Example #35
0
        private void drawGround(DrawContext display, Point pt, int heightCutDiff)
        {
            Point basePt = pt;
            World world  = World.world;

            if (heightCutDiff == 0)
            {
                ResourceUtil.emptyChip.drawShape(display.surface, pt,
                                                 isUnderWater ? waterColors[3] : currentMountainColors[3]);
                return;
            }

            if (isFlattened)
            {
                if (ground != null)
                {
                    ground.draw(display.surface, pt);
                }
                return;
            }

            pt.Y -= getHeight(0) * 4;           // apply offset

            // compute target colors
            Color[] dstColors = new Color[] {
                selectColor(),
                mapColor(isUnderWater?Color.Navy:currentMountainColors[0])
            };

            int tdiff = (getHeight(0) - getHeight(2) + 4);
            int umax  = Math.Min(tdiff + 2, 6);

            Size sz = new Size(16, tdiff * 4 + 2 * 4 + 1);

            // draw left half
            int  ldiff = (getHeight(0) - getHeight(3) + 2);
            bool vflip;

            if (ldiff < tdiff - ldiff)
            {
                vflip = true;
                ldiff = tdiff - ldiff;
            }
            else
            {
                vflip = false;
            }
            int lidx = (umax - ldiff);

            display.surface.bltColorTransform(new Point(pt.X, pt.Y - (vflip?2 * 4:0)),
                                              images[tdiff], new Point(lidx * 32, 0), sz,
                                              srcColors, dstColors, vflip);

            {
                // left cliff
                Location neighbor = location + Direction.WEST;
                if (!(world[neighbor] is MountainVoxel) &&
                    getHeight(2) + getHeight(3) > 0 &&
                    world.getGroundLevel(neighbor) <= world.getGroundLevel(location))
                {
                    cliff[0, getHeight(3), getHeight(2)].draw(display.surface, basePt);
                }
            }


            // right half
            int rdiff = (getHeight(0) - getHeight(1) + 2);

            if (rdiff < tdiff - rdiff)
            {
                vflip = true;
                rdiff = tdiff - rdiff;
            }
            else
            {
                vflip = false;
            }
            int ridx = (umax - rdiff);

            pt.X += 16;
            display.surface.bltColorTransform(new Point(pt.X, pt.Y - (vflip?2 * 4:0)),
                                              images[tdiff], new Point(ridx * 32 + 16, 0), sz,
                                              srcColors, dstColors, vflip);

            {
                basePt.X += 16;
                // right cliff
                Location neighbor = location + Direction.SOUTH;
                if (!(world[neighbor] is MountainVoxel) &&
                    getHeight(2) + getHeight(1) > 0 &&
                    world.getGroundLevel(neighbor) <= world.getGroundLevel(location))
                {
                    cliff[1, getHeight(2), getHeight(1)].draw(display.surface, basePt);
                }
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="view"></param>
 /// <param name="surface"></param>
 public void DrawBefore(QuarterViewDrawer view, DrawContext surface)
 {
 }
Example #37
0
 protected override int CalculateValuesHeight(DrawContext context)
 {
     return(3 * context.Font.Height);
 }
Example #38
0
 public override Size Draw(DrawContext context, int x, int y) => throw new NotImplementedException();
Example #39
0
 public override int CalculateDrawnHeight(DrawContext context) => throw new NotImplementedException();
Example #40
0
 public override int CalculateDrawnHeight(DrawContext context)
 {
     return(IsHidden && !IsWrapped ? HiddenHeight : context.Font.Height);
 }
Example #41
0
 public override void Draw(TreeNodeAdv node, DrawContext context)
 {
     DrawSelection(node, context);
     DrawOrMeasure(node, context, draw: true);
 }
Example #42
0
		public override Size MeasureSize(TreeNodeAdv node, DrawContext context)
		{
			return new Size(Width, Width);
		}
        public override void Draw(DrawContext dc)
        {
            if (Design == null)
            {
                return;
            }
            Matrix matrix;

            if (Mode == ViewMode.Perspective)
            {
                Viewport viewport = Display.Viewport;
                Vector3  vector   = new Vector3(0.5f, 0.5f, 0.5f);
                Matrix   m        = Matrix.CreateLookAt(2.65f * m_direction + vector, vector, Vector3.UnitY);
                Matrix   m2       = Matrix.CreatePerspectiveFieldOfView(1.2f, base.ActualSize.X / base.ActualSize.Y, 0.4f, 4f);
                Matrix   m3       = MatrixUtils.CreateScaleTranslation(base.ActualSize.X, 0f - base.ActualSize.Y, base.ActualSize.X / 2f, base.ActualSize.Y / 2f) * base.GlobalTransform * MatrixUtils.CreateScaleTranslation(2f / (float)viewport.Width, -2f / (float)viewport.Height, -1f, 1f);
                matrix = m * m2 * m3;
                FlatBatch3D flatBatch3D = m_primitivesRenderer3d.FlatBatch(1, DepthStencilState.DepthRead);
                for (int i = 0; i <= Design.Resolution; i++)
                {
                    float num   = (float)i / (float)Design.Resolution;
                    Color color = (i % 2 == 0) ? new Color(56, 56, 56, 56) : new Color(28, 28, 28, 28);
                    color *= base.GlobalColorTransform;
                    flatBatch3D.QueueLine(new Vector3(num, 0f, 0f), new Vector3(num, 0f, 1f), color);
                    flatBatch3D.QueueLine(new Vector3(0f, 0f, num), new Vector3(1f, 0f, num), color);
                    flatBatch3D.QueueLine(new Vector3(0f, num, 0f), new Vector3(0f, num, 1f), color);
                    flatBatch3D.QueueLine(new Vector3(0f, 0f, num), new Vector3(0f, 1f, num), color);
                    flatBatch3D.QueueLine(new Vector3(0f, num, 1f), new Vector3(1f, num, 1f), color);
                    flatBatch3D.QueueLine(new Vector3(num, 0f, 1f), new Vector3(num, 1f, 1f), color);
                }
                Color       color2      = new Color(64, 64, 64, 255) * base.GlobalColorTransform;
                FontBatch3D fontBatch3D = m_primitivesRenderer3d.FontBatch(ContentManager.Get <BitmapFont>("Fonts/Pericles"), 1);
                fontBatch3D.QueueText("Front", new Vector3(0.5f, 0f, 0f), 0.004f * new Vector3(-1f, 0f, 0f), 0.004f * new Vector3(0f, 0f, -1f), color2, TextAnchor.HorizontalCenter);
                fontBatch3D.QueueText("Side", new Vector3(1f, 0f, 0.5f), 0.004f * new Vector3(0f, 0f, -1f), 0.004f * new Vector3(1f, 0f, 0f), color2, TextAnchor.HorizontalCenter);
                if (DrawDebugFurniture)
                {
                    DebugDraw();
                }
            }
            else
            {
                Vector3 position;
                Vector3 up;
                if (Mode == ViewMode.Side)
                {
                    position = new Vector3(1f, 0f, 0f);
                    up       = new Vector3(0f, 1f, 0f);
                }
                else if (Mode != ViewMode.Top)
                {
                    position = new Vector3(0f, 0f, -1f);
                    up       = new Vector3(0f, 1f, 0f);
                }
                else
                {
                    position = new Vector3(0f, 1f, 0f);
                    up       = new Vector3(0f, 0f, 1f);
                }
                Viewport viewport2 = Display.Viewport;
                float    num2      = MathUtils.Min(base.ActualSize.X, base.ActualSize.Y);
                Matrix   m4        = Matrix.CreateLookAt(position, new Vector3(0f, 0f, 0f), up);
                Matrix   m5        = Matrix.CreateOrthographic(2f, 2f, -10f, 10f);
                Matrix   m6        = MatrixUtils.CreateScaleTranslation(num2, 0f - num2, base.ActualSize.X / 2f, base.ActualSize.Y / 2f) * base.GlobalTransform * MatrixUtils.CreateScaleTranslation(2f / (float)viewport2.Width, -2f / (float)viewport2.Height, -1f, 1f);
                matrix = Matrix.CreateTranslation(-0.5f, -0.5f, -0.5f) * m4 * m5 * m6;
                FlatBatch2D flatBatch2D = m_primitivesRenderer2d.FlatBatch();
                Matrix      m7          = base.GlobalTransform;
                for (int j = 1; j < Design.Resolution; j++)
                {
                    float   num3 = (float)j / (float)Design.Resolution;
                    Vector2 v    = new Vector2(base.ActualSize.X * num3, 0f);
                    Vector2 v2   = new Vector2(base.ActualSize.X * num3, base.ActualSize.Y);
                    Vector2 v3   = new Vector2(0f, base.ActualSize.Y * num3);
                    Vector2 v4   = new Vector2(base.ActualSize.X, base.ActualSize.Y * num3);
                    Vector2.Transform(ref v, ref m7, out v);
                    Vector2.Transform(ref v2, ref m7, out v2);
                    Vector2.Transform(ref v3, ref m7, out v3);
                    Vector2.Transform(ref v4, ref m7, out v4);
                    Color color3 = (j % 2 == 0) ? new Color(0, 0, 0, 56) : new Color(0, 0, 0, 28);
                    Color color4 = (j % 2 == 0) ? new Color(56, 56, 56, 56) : new Color(28, 28, 28, 28);
                    color3 *= base.GlobalColorTransform;
                    color4 *= base.GlobalColorTransform;
                    flatBatch2D.QueueLine(v, v2, 0f, (j % 2 == 0) ? color3 : (color3 * 0.75f));
                    flatBatch2D.QueueLine(v + new Vector2(1f, 0f), v2 + new Vector2(1f, 0f), 0f, color4);
                    flatBatch2D.QueueLine(v3, v4, 0f, color3);
                    flatBatch2D.QueueLine(v3 + new Vector2(0f, 1f), v4 + new Vector2(0f, 1f), 0f, color4);
                }
            }
            Matrix            matrix2  = Matrix.Identity;
            FurnitureGeometry geometry = Design.Geometry;

            for (int k = 0; k < 6; k++)
            {
                Color globalColorTransform = base.GlobalColorTransform;
                if (Mode == ViewMode.Perspective)
                {
                    float num4 = LightingManager.LightIntensityByLightValueAndFace[15 + 16 * CellFace.OppositeFace(k)];
                    globalColorTransform *= new Color(num4, num4, num4);
                }
                if (geometry.SubsetOpaqueByFace[k] != null)
                {
                    BlocksManager.DrawMeshBlock(m_primitivesRenderer3d, geometry.SubsetOpaqueByFace[k], globalColorTransform, 1f, ref matrix2, null);
                }
                if (geometry.SubsetAlphaTestByFace[k] != null)
                {
                    BlocksManager.DrawMeshBlock(m_primitivesRenderer3d, geometry.SubsetAlphaTestByFace[k], globalColorTransform, 1f, ref matrix2, null);
                }
            }
            m_primitivesRenderer3d.Flush(matrix);
            m_primitivesRenderer2d.Flush();
        }
Example #44
0
 public override Size Draw(DrawContext context, int x, int y)
 {
     return(Draw(context, x, y, $"({Offset / IntPtr.Size})", MethodName));
 }
Example #45
0
 public override Size MeasureSize(TreeNodeAdv node, DrawContext context)
 {
     return(ResourceHelper.LoadingIcon.FrameSize);
 }
 public Context(DrawContext dc, double sectorSize, List <Sector> sectors)
 {
     this.dc         = dc;
     this.sectorSize = sectorSize;
     this.sectors    = sectors;
 }
Example #47
0
 public override Size Draw(DrawContext context, int x2, int y2)
 {
     return(DrawMatrixType(context, x2, y2, "Matrix (3x3)", 3, 3));
 }
Example #48
0
 public void Draw(DrawContext drawContext, int tag, IDrawSmoothProvider sp)
 {
     AnimationSet.DefaultAnimation.Frames[0].Draw(drawContext, Position, FacingLeft);
 }
Example #49
0
 public override Size Draw(DrawContext context, int x, int y)
 {
     return(Draw(context, x, y, context.Settings.ShowNodeText ? context.Memory.ReadString(context.Settings.RawDataEncoding, Offset, 4) + "     " : null, 4));
 }
        public override void Draw(TreeNodeAdv node, DrawContext context)
        {
            Graphics  g          = context.Graphics;
            Rectangle targetRect = new Rectangle(
                context.Bounds.X + this.LeftMargin,
                context.Bounds.Y,
                context.Bounds.Width - this.LeftMargin,
                context.Bounds.Height);

            // Retrieve item information
            PackageItem          item                = node.Tag as PackageItem;
            Version              itemVersion         = null;
            Version              newVersion          = null;
            PackageCompatibility updateCompatibility = PackageCompatibility.None;
            bool highlightItemVersion                = item is LocalPackageItem;
            bool isInstalled = false;
            bool isUpToDate  = false;

            if (item != null)
            {
                isInstalled         = item.InstalledPackageInfo != null;
                updateCompatibility = item.UpdateCompatibility;

                if (item.InstalledPackageInfo != null)
                {
                    itemVersion = item.InstalledPackageInfo.Version;
                }
                else if (item.ItemPackageInfo != null)
                {
                    itemVersion = item.ItemPackageInfo.Version;
                }

                if (item.NewestPackageInfo != null)
                {
                    newVersion = item.NewestPackageInfo.Version;
                }

                if (itemVersion != null && newVersion != null)
                {
                    isUpToDate = itemVersion >= newVersion;
                }
            }
            string itemVersionText = PackageManager.GetDisplayedVersion(itemVersion);
            string newVersionText  = isInstalled && !isUpToDate?PackageManager.GetDisplayedVersion(newVersion) : string.Empty;

            // Determine background color and icon based on versioning
            Brush backgroundBrush = null;
            Image icon            = null;

            if (isInstalled)
            {
                backgroundBrush = new SolidBrush(Color.FromArgb(32, 128, 128, 128));
            }
            if (isInstalled && newVersion != null && itemVersion != null)
            {
                if (newVersion <= itemVersion)
                {
                    icon = Properties.PackageManagerFrontendResCache.IconUpToDate;
                }
                else if (updateCompatibility == PackageCompatibility.Definite)
                {
                    icon = Properties.PackageManagerFrontendResCache.IconSafeUpdate;
                }
                else if (updateCompatibility == PackageCompatibility.Likely)
                {
                    icon = Properties.PackageManagerFrontendResCache.IconLikelySafeUpdate;
                }
                else if (updateCompatibility == PackageCompatibility.Unlikely)
                {
                    icon = Properties.PackageManagerFrontendResCache.IconLikelyUnsafeUpdate;
                }
                else
                {
                    icon = Properties.PackageManagerFrontendResCache.IconIncompatibleUpdate;
                }
            }

            // Calculate drawing layout and data
            StringFormat stringFormat = new StringFormat {
                Trimming = StringTrimming.EllipsisCharacter, Alignment = StringAlignment.Near, FormatFlags = StringFormatFlags.NoWrap
            };
            Rectangle currentVersionRect;
            Rectangle newestVersionRect;
            Rectangle iconRect;

            {
                SizeF currentVersionSize;
                SizeF newestVersionSize;
                Size  iconSize;
                // Base info
                {
                    newestVersionSize  = g.MeasureString(newVersionText, context.Font, targetRect.Width, stringFormat);
                    currentVersionSize = g.MeasureString(itemVersionText, context.Font, targetRect.Width, stringFormat);
                    iconSize           = icon != null ? icon.Size : Size.Empty;
                }
                // Alignment info
                {
                    Size totalTextSize = new Size(
                        (int)Math.Max(currentVersionSize.Width, newestVersionSize.Width),
                        (int)(currentVersionSize.Height + newestVersionSize.Height));
                    int leftSpacing = (targetRect.Width - totalTextSize.Width - iconSize.Width - 4) / 2;
                    int iconIndent  = iconSize.Width + 4 + leftSpacing;

                    iconRect = new Rectangle(
                        targetRect.X + leftSpacing,
                        targetRect.Y + targetRect.Height / 2 - iconSize.Height / 2,
                        iconSize.Width,
                        iconSize.Height);
                    newestVersionRect = new Rectangle(
                        targetRect.X + iconIndent,
                        targetRect.Y + Math.Max((targetRect.Height - totalTextSize.Height) / 2, 0),
                        targetRect.Width - iconIndent,
                        (int)newestVersionSize.Height);
                    currentVersionRect = new Rectangle(
                        targetRect.X + iconIndent,
                        targetRect.Y + (int)newestVersionSize.Height + Math.Max((targetRect.Height - totalTextSize.Height) / 2, 0),
                        targetRect.Width - iconIndent,
                        targetRect.Height - (int)newestVersionSize.Height);
                }
            }

            // Draw background and version texts
            if (backgroundBrush != null)
            {
                g.FillRectangle(backgroundBrush, targetRect);
            }
            if (icon != null)
            {
                g.DrawImageUnscaledAndClipped(icon, iconRect);
            }
            {
                bool bothVisible = !string.IsNullOrWhiteSpace(itemVersionText) && !string.IsNullOrWhiteSpace(newVersionText);
                highlightItemVersion = highlightItemVersion || !bothVisible;
                g.DrawString(newVersionText, context.Font, new SolidBrush(Color.FromArgb((highlightItemVersion ? 128 : 255) / (context.Enabled ? 1 : 2), this.Parent.ForeColor)), newestVersionRect, stringFormat);
                g.DrawString(itemVersionText, context.Font, new SolidBrush(Color.FromArgb((highlightItemVersion ? 255 : 128) / (context.Enabled ? 1 : 2), this.Parent.ForeColor)), currentVersionRect, stringFormat);
            }
        }
Example #51
0
        void IChartCustomDrawer.Draw(DrawContext context, EDrawPhases phase)
        {
            if (phase != EDrawPhases.Final)
            {
                return;
            }

            RectangleF _dr     = context.FullRect;
            ChartPoint DrPleft = context.Environment.Point2ChartPoint(new PointF {
                X = _dr.X, Y = _dr.Y
            });
            ChartPoint DrPRight = context.Environment.Point2ChartPoint(new PointF {
                X = _dr.Width, Y = _dr.Height
            });

            if (DrPleft.Time.Ticks > DrPRight.Time.Ticks)
            {
                return;
            }

            Bar[] BarsToRedraw = null;

            context.Environment.Bars.Get(DrPleft.Time, DrPRight.Time, out BarsToRedraw);
            if (!object.Equals(BarsToRedraw, null))
            {
                int countBars = BarsToRedraw.Length;
                if (countBars > 0)
                {
                    AreaPainter p    = new AreaPainter(fillcolor, (byte)(255 - m_intensity));
                    PointF[]    pf   = new PointF[countBars * 2];
                    int         full = countBars * 2 - 1;
                    for (int i = 0, idx = 0; i < countBars; i++)
                    {
                        double high0 = m_IndicatorArea.GetValue("UpperBand", BarsToRedraw[i].Time.ToBinary());
                        double low0  = m_IndicatorArea.GetValue("LowerBand", BarsToRedraw[i].Time.ToBinary());

                        if (high0 < 0 || low0 < 0)
                        {
                            idx   = 0;
                            full -= 2;
                            pf    = new PointF[full + 1];
                            continue;
                        }

                        Bar b = BarsToRedraw[i];
                        pf[idx] = context.Environment.ChartPoint2Point(new ChartPoint
                        {
                            Price = high0,
                            Time  = b.Time
                        });

                        pf[full - idx] = context.Environment.ChartPoint2Point(new ChartPoint
                        {
                            Price = low0,
                            Time  = b.Time
                        });
                        idx++;
                    }
                    p.PaintArea(context.graphics, pf);
                }
            }
            context.DirtyRect = _dr;
        }
 public override Size MeasureSize(TreeNodeAdv node, DrawContext context)
 {
     return(new Size(60, 48));
 }
Example #53
0
 /**
  * Indicates whether this shape data's globe state and vertical exaggeration are the same as that in the current
  * draw context.
  *
  * @param dc the current draw context.
  *
  * @return true if the shape is valid, otherwise false.
  */
 public bool isValid(DrawContext dc)
 {
     return(this.verticalExaggeration == dc.getVerticalExaggeration() &&
            (this.globeStateKey != null && globeStateKey.Equals(dc.getGlobe().getGlobeStateKey(dc))));
 }
Example #54
0
        public override void Draw(TreeNodeAdv node, DrawContext context)
        {
            Image image = GetIcon(node);

            if (image != null)
            {
                Rectangle r = GetBounds(node, context);
                if (image.Width > 0 && image.Height > 0)
                {
                    switch (_scaleMode)
                    {
                    case ImageScaleMode.Fit:
                        context.Graphics.DrawImage(image, r);
                        break;

                    case ImageScaleMode.ScaleDown:
                    {
                        float factor = Math.Min((float)r.Width / (float)image.Width, (float)r.Height / (float)image.Height);
                        if (factor < 1)
                        {
                            context.Graphics.DrawImage(image, r.X, r.Y, image.Width * factor, image.Height * factor);
                        }
                        else
                        {
                            context.Graphics.DrawImage(image, r.X, r.Y, image.Width, image.Height);
                        }
                    } break;

                    case ImageScaleMode.ScaleUp:
                    {
                        float factor = Math.Max((float)r.Width / (float)image.Width, (float)r.Height / (float)image.Height);
                        if (factor > 1)
                        {
                            context.Graphics.DrawImage(image, r.X, r.Y, image.Width * factor, image.Height * factor);
                        }
                        else
                        {
                            context.Graphics.DrawImage(image, r.X, r.Y, image.Width, image.Height);
                        }
                    } break;

                    case ImageScaleMode.AlwaysScale:
                    {
                        float fx = (float)r.Width / (float)image.Width;
                        float fy = (float)r.Height / (float)image.Height;
                        if (Math.Min(fx, fy) < 1)
                        {                                         //scale down
                            float factor = Math.Min(fx, fy);
                            context.Graphics.DrawImage(image, r.X, r.Y, image.Width * factor, image.Height * factor);
                        }
                        else if (Math.Max(fx, fy) > 1)
                        {
                            float factor = Math.Max(fx, fy);
                            context.Graphics.DrawImage(image, r.X, r.Y, image.Width * factor, image.Height * factor);
                        }
                        else
                        {
                            context.Graphics.DrawImage(image, r.X, r.Y, image.Width, image.Height);
                        }
                    } break;

                    case ImageScaleMode.Clip:
                    default:
                        context.Graphics.DrawImage(image, r.X, r.Y, image.Width, image.Height);
                        break;
                    }
                }
            }
        }
Example #55
0
        public unsafe void Draw(Surface dst, Matrix transform, ResamplingAlgorithm sampling)
        {
            if (this.disposed)
            {
                throw new ObjectDisposedException("MaskedSurface");
            }

            if (this.surface == null || !transform.IsInvertible)
            {
                return;
            }

            PdnRegion theRegion;
            Rectangle regionBounds;

            if (this.path == null)
            {
                theRegion    = this.region.Clone();
                regionBounds = this.region.GetBoundsInt();
                theRegion.Transform(transform);
            }
            else
            {
                using (PdnGraphicsPath mPath = this.shadowPath.Clone())
                {
                    regionBounds = Rectangle.Truncate(mPath.GetBounds());
                    mPath.Transform(transform);
                    theRegion = new PdnRegion(mPath);
                }
            }

            DrawContext dc = new DrawContext();

            dc.boundsX = regionBounds.X;
            dc.boundsY = regionBounds.Y;

            Matrix inverse = transform.Clone();

            inverse.Invert();

            dc.inverses = new Matrix[Processor.LogicalCpuCount];
            for (int i = 0; i < dc.inverses.Length; ++i)
            {
                dc.inverses[i] = inverse.Clone();
            }

            // change in source-[X|Y] w.r.t. destination-[X|Y]
            PointF[] pts = new PointF[] {
                new PointF(1, 0),
                new PointF(0, 1)
            };

            inverse.TransformVectors(pts);
            inverse.Dispose();
            inverse = null;

            dc.dsxddx = pts[0].X;

            if (Math.Abs(dc.dsxddx) > fp_MaxValue)
            {
                dc.dsxddx = 0.0f;
            }

            dc.dsyddx = pts[0].Y;

            if (Math.Abs(dc.dsyddx) > fp_MaxValue)
            {
                dc.dsyddx = 0.0f;
            }

            dc.dsxddy = pts[1].X;

            if (Math.Abs(dc.dsxddy) > fp_MaxValue)
            {
                dc.dsxddy = 0.0f;
            }

            dc.dsyddy = pts[1].Y;

            if (Math.Abs(dc.dsyddy) > fp_MaxValue)
            {
                dc.dsyddy = 0.0f;
            }

            dc.fp_dsxddx = (int)(dc.dsxddx * fp_MultFactor);
            dc.fp_dsyddx = (int)(dc.dsyddx * fp_MultFactor);
            dc.fp_dsxddy = (int)(dc.dsxddy * fp_MultFactor);
            dc.fp_dsyddy = (int)(dc.dsyddy * fp_MultFactor);

            dc.dst = dst;
            dc.src = this.surface;
            Rectangle[] scans = theRegion.GetRegionScansReadOnlyInt();

            if (scans.Length == 1)
            {
                dc.dstScans = new Rectangle[Processor.LogicalCpuCount];
                Utility.SplitRectangle(scans[0], dc.dstScans);
            }
            else
            {
                dc.dstScans = scans;
            }

            WaitCallback wc;

            switch (sampling)
            {
            case ResamplingAlgorithm.NearestNeighbor:
                wc = new WaitCallback(dc.DrawScansNearestNeighbor);
                break;

            case ResamplingAlgorithm.Bilinear:
                wc = new WaitCallback(dc.DrawScansBilinear);
                break;

            default:
                throw new System.ComponentModel.InvalidEnumArgumentException();
            }

            for (int i = 0; i < Processor.LogicalCpuCount; ++i)
            {
                if (i == Processor.LogicalCpuCount - 1)
                {
                    // Don't queue the last work item into a separate thread
                    wc(BoxedConstants.GetInt32(i));
                }
                else
                {
                    threadPool.QueueUserWorkItem(wc, BoxedConstants.GetInt32(i));
                }
            }

            threadPool.Drain();

            for (int i = 0; i < Processor.LogicalCpuCount; ++i)
            {
                dc.inverses[i].Dispose();
                dc.inverses[i] = null;
            }

            dc.src = null;

            theRegion.Dispose();
            theRegion = null;
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="view"></param>
 /// <param name="canvas"></param>
 /// <param name="loc"></param>
 /// <param name="pt"></param>
 public void DrawVoxel(QuarterViewDrawer view, DrawContext canvas, Location loc, Point pt)
 {
 }
		private void CreateBrushes(TreeNodeAdv node, DrawContext context, string text, out Brush backgroundBrush, out Color textColor, out Font font, ref string label)
		{
			textColor = SystemColors.ControlText;
			backgroundBrush = null;
			font = context.Font;
			if (context.DrawSelection == DrawSelectionMode.Active)
			{
				textColor = SystemColors.HighlightText;
                backgroundBrush = SystemBrushes.Highlight;
			}
			else if (context.DrawSelection == DrawSelectionMode.Inactive)
			{
				textColor = SystemColors.ControlText;
                backgroundBrush = SystemBrushes.InactiveBorder;
			}
			else if (context.DrawSelection == DrawSelectionMode.FullRowSelect)
				textColor = SystemColors.ControlText;

			if (!context.Enabled)
				textColor = SystemColors.GrayText;

			if (DrawTextMustBeFired(node))
			{
				DrawEventArgs args = new DrawEventArgs(node, this, context, text);
				args.Text = label;
				args.TextColor = textColor;
				args.BackgroundBrush = backgroundBrush;
				args.Font = font;

				OnDrawText(args);

				textColor = args.TextColor;
				backgroundBrush = args.BackgroundBrush;
				font = args.Font;
				label = args.Text;
			}
		}
Example #58
0
 public override Size MeasureSize(TreeNodeAdv node, DrawContext context)
 {
     return(GetLabelSize(node, context));
 }
Example #59
0
 public abstract Size MeasureSize(TreeNodeAdv node, DrawContext context);
Example #60
0
 public abstract void Draw(TreeNodeAdv node, DrawContext context);