Example #1
0
        /// <summary>
        /// Center (Horizontally or Vertically) GUI Content within a Layout Area
        /// </summary>
        /// <param name="ct">Enum specifying the direction to center the content in</param>
        /// <param name="rd">Delegate function for creating centered content</param>
        public static void Center(CenterType ct, RenderDelegate rd)
        {
            if (ct != CenterType.Horizontal)
            {
                GUILayout.BeginVertical();
            }

            GUILayout.FlexibleSpace();
            if (ct != CenterType.Vertical)
            {
                GUILayout.BeginHorizontal();
            }

            GUILayout.FlexibleSpace();
            rd.Invoke();
            GUILayout.FlexibleSpace();
            if (ct != CenterType.Vertical)
            {
                GUILayout.EndHorizontal();
            }

            GUILayout.FlexibleSpace();
            if (ct != CenterType.Horizontal)
            {
                GUILayout.EndVertical();
            }
        }
Example #2
0
        public void Render(bool force = true, bool recalculateLayout = true, bool lowQuality = false, bool invokeOnRender = true)
        {
            if (force == false && currentlyRendering)
            {
                return;
            }

            if (pictureBox1.Image is null || pictureBox1.Image.Size != pictureBox1.Size)
            {
                if (pictureBox1.Width < 1 | pictureBox1.Height < 1)
                {
                    return;
                }
                pictureBox1.Image?.Dispose();
                pictureBox1.Image = new Bitmap(pictureBox1.Width, pictureBox1.Height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
            }

            currentlyRendering = true;
            using (var renderer = new SystemDrawingRenderer((Bitmap)pictureBox1.Image))
                Plot?.Render(renderer, recalculateLayout, lowQuality);
            pictureBox1.Invalidate();
            Application.DoEvents();
            if (invokeOnRender)
            {
                OnRender?.Invoke();
            }
            currentlyRendering = false;
        }
Example #3
0
 protected override void InternalRender(T node)
 {
     render?.Invoke(node);
 }
Example #4
0
 public void UpdateImage()
 {
     Render?.Invoke(pixels, currIntensity);
 }