private void RecurseHighlightExtensions(Rgba32Color *bitmap, FileItemBase parent, Rgba32Color color, string extension)
        {
            List <FileItemBase> children = parent.Children;
            int count = children.Count;

            for (int i = 0; i < count; i++)
            {
                FileItemBase child = children[i];
                Rectangle2S  rc    = child.Rectangle;
                if (rc.Width > 0 && rc.Height > 0)
                {
                    if (child.IsLeaf)
                    {
                        if (child.Extension == extension)
                        {
                            HighlightRectangle(bitmap, rc, color);
                        }
                    }
                    else
                    {
                        RecurseHighlightExtensions(bitmap, child, color, extension);
                    }
                }
            }
        }
        private void FillRectangle(Rgba32Color *bitmap, Rectangle2I rc, Rgba32Color color)
        {
            int bottom = rc.Bottom;
            int right  = rc.Right;

            if (rc.Width >= rc.Height)
            {
                for (int iy = rc.Top; iy < bottom; iy++)
                {
                    for (int ix = rc.Left; ix < right; ix++)
                    {
                        bitmap[ix + iy * renderArea.Width] = color;
                    }
                }
            }
            else
            {
                for (int ix = rc.Left; ix < right; ix++)
                {
                    for (int iy = rc.Top; iy < bottom; iy++)
                    {
                        bitmap[ix + iy * renderArea.Width] = color;
                    }
                }
            }
        }
 private void HighlightRectangle(Rgba32Color *bitmap, Rectangle2I rc, Rgba32Color color)
 {
     if (rc.Width >= 7 && rc.Height >= 7)
     {
         FillRectangle(bitmap, Rectangle2I.FromLTRB(rc.Left, rc.Top, rc.Right, rc.Top + 3), color);
         FillRectangle(bitmap, Rectangle2I.FromLTRB(rc.Left, rc.Bottom - 3, rc.Right, rc.Bottom), color);
         FillRectangle(bitmap, Rectangle2I.FromLTRB(rc.Left, rc.Top + 3, rc.Left + 3, rc.Bottom - 3), color);
         FillRectangle(bitmap, Rectangle2I.FromLTRB(rc.Right - 3, rc.Top + 3, rc.Right, rc.Bottom - 3), color);
     }
     else if (rc.Width == 1 && rc.Height == 1)
     {
         bitmap[rc.Left + rc.Top * renderArea.Width] = color;
     }
     else if (rc.Width > 0 && rc.Height > 0)
     {
         FillRectangle(bitmap, rc, color);
     }
 }
        private void DrawChildren(Rgba32Color *bitmap, ITreemapItem parent, Number[] surface, Number h, uint flags)
        {
            switch (options.Style)
            {
            case TreemapStyle.KDirStatStyle:
                KDirStat_DrawChildren(bitmap, parent, surface, h, flags);
                break;

            case TreemapStyle.SequoiaViewStyle:
                throw new NotImplementedException("SequoiaViewStyle");

            //SequoiaView_DrawwChildren(bitmap, parent, surface, h, flags);
            //break;
            case TreemapStyle.SimpleStyle:
                throw new NotImplementedException("SimpleStyle");
                //Simple_DrawwChildren(bitmap, parent, surface, h, flags);
                //break;
            }
        }
        private void RecurseDrawGraph(Rgba32Color *bitmap, ITreemapItem item, Rectangle2I rc,
                                      bool isroot, Number[] pSurface, Number h, uint flags)
        {
            Debug.Assert(rc.Width >= 0);
            Debug.Assert(rc.Height >= 0);
            Debug.Assert(item.Size > 0);

            item.Rectangle = rc;

            int gridWidth = options.Grid ? 1 : 0;

            if (rc.Width <= gridWidth || rc.Height <= gridWidth)
            {
                return;
            }

            Number[] surface = new Number[] { 0, 0, 0, 0 };
            if (IsCushionShading)
            {
                Array.Copy(pSurface, surface, pSurface.Length);

                if (!isroot)
                {
                    AddRidge(rc, surface, h);
                }
            }

            if (item.IsLeaf)
            {
                RenderLeaf(bitmap, item, surface);
            }
            else
            {
                Debug.Assert(item.ChildCount > 0);
                Debug.Assert(item.Size > 0);

                DrawChildren(bitmap, item, surface, h, flags);
            }
        }
        private void KDirStat_DrawChildren(Rgba32Color *bitmap, ITreemapItem parent, Number[] surface, Number h, uint flags)
        {
            Debug.Assert(parent.ChildCount > 0);

            Rectangle2I   rc             = parent.Rectangle;
            List <Number> rows           = new List <Number>();
            List <int>    childrenPerRow = new List <int>();

            Number[] childWidth = new Number[parent.ChildCount];

            bool horizontalRows = KDirStat_ArrangeChildren(parent, childWidth, rows, childrenPerRow);

            int width  = horizontalRows ? rc.Width : rc.Height;
            int height = horizontalRows ? rc.Height : rc.Width;

            Debug.Assert(width >= 0);
            Debug.Assert(height >= 0);

            int    c   = 0;
            Number top = horizontalRows ? rc.Top : rc.Left;

            for (int row = 0; row < rows.Count; row++)
            {
                Number fBottom = top + rows[row] * height;
                int    bottom  = (int)fBottom;
                if (row == rows.Count - 1)
                {
                    bottom = horizontalRows ? rc.Bottom : rc.Right;
                }
                Number left = horizontalRows ? rc.Left : rc.Top;
                for (int i = 0; i < childrenPerRow[row]; i++, c++)
                {
                    ITreemapItem child = parent[c];
                    Debug.Assert(childWidth[c] >= 0);
                    Number fRight = left + childWidth[c] * width;
                    int    right  = (int)fRight;

                    bool lastChild = (i == childrenPerRow[row] - 1 || childWidth[c + 1] == 0);

                    if (lastChild)
                    {
                        right = horizontalRows ? rc.Right : rc.Bottom;
                    }

                    Rectangle2I rcChild;
                    if (horizontalRows)
                    {
                        rcChild = Rectangle2I.FromLTRB((int)left, (int)top, right, bottom);
                    }
                    else
                    {
                        rcChild = Rectangle2I.FromLTRB((int)top, (int)left, bottom, right);
                    }

#if DEBUG
                    if (rcChild.Width > 0 && rcChild.Height > 0)
                    {
                        //Rectangle2I test;
                        //test.IntersectRect(parent->TmiGetRectangle(), rcChild);
                        //Debug.Assert(test == rcChild);
                    }
#endif
                    RecurseDrawGraph(bitmap, child, rcChild, false, surface, h * options.ScaleFactor, 0);

                    if (lastChild)
                    {
                        i++; c++;

                        if (i < childrenPerRow[row])
                        {
                            parent[c].Rectangle = Rectangle2I.FromLTRB(-1, -1, -1, -1);
                        }

                        c += childrenPerRow[row] - i;
                        break;
                    }

                    left = fRight;
                }
                top = fBottom;
            }
        }
Esempio n. 7
0
 /// <summary>Sets the bitmap's pixels.</summary>
 public unsafe void SetPixels(Rgba32Color *pixels)
 {
     ui.Invoke(() => Source.WritePixels((Int32Rect)Bounds, (IntPtr)pixels, BufferSize, Stride));
 }