namespace VaioxOnline
{
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Runtime.InteropServices;

    [StandardModule]
    internal sealed class Helpers
    {
        internal static Color _FlatColor = Color.FromArgb(0x23, 0xa8, 0x6d);
        internal static Bitmap B;
        internal static StringFormat CenterSF;
        internal static Graphics G;
        internal static StringFormat NearSF;

        static Helpers()
        {
            StringFormat format = new StringFormat {
                Alignment = StringAlignment.Near,
                LineAlignment = StringAlignment.Near
            };
            NearSF = format;
            format = new StringFormat {
                Alignment = StringAlignment.Center,
                LineAlignment = StringAlignment.Center
            };
            CenterSF = format;
        }

        public static GraphicsPath DrawArrow(int x, int y, bool flip)
        {
            GraphicsPath path2 = new GraphicsPath();
            int num = 12;
            int num2 = 6;
            if (flip)
            {
                path2.AddLine(x + 1, y, (x + num) + 1, y);
                path2.AddLine(x + num, y, x + num2, (y + num2) - 1);
            }
            else
            {
                path2.AddLine(x, y + num2, x + num, y + num2);
                path2.AddLine(x + num, y + num2, x + num2, y);
            }
            path2.CloseFigure();
            return path2;
        }

        public static GraphicsPath RoundRec(Rectangle Rectangle, int Curve)
        {
            GraphicsPath path2 = new GraphicsPath();
            int width = Curve * 2;
            path2.AddArc(new Rectangle(Rectangle.X, Rectangle.Y, width, width), -180f, 90f);
            path2.AddArc(new Rectangle((Rectangle.Width - width) + Rectangle.X, Rectangle.Y, width, width), -90f, 90f);
            path2.AddArc(new Rectangle((Rectangle.Width - width) + Rectangle.X, (Rectangle.Height - width) + Rectangle.Y, width, width), 0f, 90f);
            path2.AddArc(new Rectangle(Rectangle.X, (Rectangle.Height - width) + Rectangle.Y, width, width), 90f, 90f);
            path2.AddLine(new Point(Rectangle.X, (Rectangle.Height - width) + Rectangle.Y), new Point(Rectangle.X, Curve + Rectangle.Y));
            return path2;
        }

        public static GraphicsPath RoundRect(float x, float y, float w, float h, float r = 0.3f, bool TL = true, bool TR = true, bool BR = true, bool BL = true)
        {
            float width = Math.Min(w, h) * r;
            float num2 = x + w;
            float num3 = y + h;
            GraphicsPath path = new GraphicsPath();
            GraphicsPath path2 = path;
            if (TL)
            {
                path2.AddArc(x, y, width, width, 180f, 90f);
            }
            else
            {
                path2.AddLine(x, y, x, y);
            }
            if (TR)
            {
                path2.AddArc(num2 - width, y, width, width, 270f, 90f);
            }
            else
            {
                path2.AddLine(num2, y, num2, y);
            }
            if (BR)
            {
                path2.AddArc(num2 - width, num3 - width, width, width, 0f, 90f);
            }
            else
            {
                path2.AddLine(num2, num3, num2, num3);
            }
            if (BL)
            {
                path2.AddArc(x, num3 - width, width, width, 90f, 90f);
            }
            else
            {
                path2.AddLine(x, num3, x, num3);
            }
            path2.CloseFigure();
            path2 = null;
            return path;
        }
    }
}

