示例#1
0
        private QGroupBox InitToggleButtons()
        {
            var groupBox = new QGroupBox("Toggle Buttons", this);

            color                     = new QColor();
            redButton                 = new QPushButton("Red", this);
            greenButton               = new QPushButton("Green", this);
            blueButton                = new QPushButton("Blue", this);
            colorBoxWidget            = new QWidget(this);
            colorBoxWidget.StyleSheet = "QWidget { background-color: black }";

            redButton.Toggled   += OnToggled;
            greenButton.Toggled += OnToggled;
            blueButton.Toggled  += OnToggled;

            redButton.Checkable   = true;
            greenButton.Checkable = true;
            blueButton.Checkable  = true;

            QHBoxLayout hBox = new QHBoxLayout();
            QVBoxLayout vBox = new QVBoxLayout();

            vBox.AddWidget(redButton);
            vBox.AddWidget(greenButton);
            vBox.AddWidget(blueButton);

            hBox.AddLayout(vBox);
            hBox.AddWidget(colorBoxWidget);

            groupBox.Layout = hBox;

            return(groupBox);
        }
示例#2
0
 void DrawPatternsEx(QPainter ptr)
 {
     ptr.SetPen(PenStyle.SolidLine);
     ptr.SetPen(QColor.FromRgb(255, 0, 0));
     ptr.DrawLine(0, Y, Size.Width, Y);
     ptr.DrawLine(X, 0, X, Size.Height);
 }
        void DrawPageHeader(string title, QColor titleColor, string subtitle, QColor subtitleColor, QTexture iconQTexture)
        {
            QUI.Space(SPACE_2);
            QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Gray), WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth, WindowSettings.pageHeaderHeight);
            QUI.Space(-WindowSettings.pageHeaderHeight + (WindowSettings.pageHeaderHeight - WindowSettings.pageHeaderHeight * 0.8f) / 2);
            QUI.BeginHorizontal(WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth, WindowSettings.pageHeaderHeight * 0.8f);
            {
                QUI.Space((WindowSettings.pageHeaderHeight - WindowSettings.pageHeaderHeight * 0.8f));
                QUI.BeginVertical((WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth) / 2, WindowSettings.pageHeaderHeight * 0.8f);
                {
                    QUI.FlexibleSpace();
                    if (!title.IsNullOrEmpty())
                    {
                        QUI.Space(-SPACE_2);
                        QUI.SetGUIColor(titleColor.Color);
                        QUI.Label(title, PageHeaderTitleStyle, (WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth) / 2, 26);
                        QUI.ResetColors();
                    }

                    if (!subtitle.IsNullOrEmpty())
                    {
                        QUI.Space(-SPACE_2);
                        QUI.SetGUIColor(subtitleColor.Color);
                        QUI.Label(subtitle, PageHeaderSubtitleStyle, (WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth) / 2, 18);
                        QUI.ResetColors();
                    }
                    QUI.FlexibleSpace();
                }
                QUI.EndVertical();
                QUI.FlexibleSpace();
                QUI.DrawTexture(iconQTexture.texture, WindowSettings.pageHeaderHeight * 0.8f, WindowSettings.pageHeaderHeight * 0.8f);
                QUI.Space((WindowSettings.pageHeaderHeight - WindowSettings.pageHeaderHeight * 0.8f) / 2);
            }
            QUI.EndHorizontal();
        }
示例#4
0
文件: mouse.cs 项目: micro-chen/qyoto
 public Mouse() : base()
 {
     speed             = 0;
     mouseEyeDirection = 0;
     random            = new Random();
     color             = new QColor(random.Next(255), random.Next(255), random.Next(255));
     timer             = new MouseTimer(this);
     Rotate(random.Next(360 * 16));
 }
示例#5
0
        /// <summary>
        /// Mixes two colours together.
        /// </summary>
        /// <param name="a">A colour to be mixed.</param>
        /// <param name="b">A colour to be mixed.</param>
        /// <param name="per">Amount of b to add to a. 0 = 0%, 1.0 = 100%</param>
        /// <returns>A new colour, the result of mixing two colour together.</returns>
        protected static QColor mix(QColor a, QColor b, float per)
        {
            QColor c = new QColor();

            c.a = (byte)(a.a + (byte)((b.a - a.a) * per));
            c.r = (byte)(a.r + (byte)((b.r - a.r) * per));
            c.g = (byte)(a.g + (byte)((b.g - a.g) * per));
            c.b = (byte)(a.b + (byte)((b.b - a.b) * per));
            return(c);
        }
示例#6
0
        public void OnToggled(bool toggleStatus)
        {
            int red = redButton.Checked ? 255 : 0;
            int green = greenButton.Checked ? 255 : 0;
            int blue = blueButton.Checked ? 255 : 0;

            color = new QColor (red, green, blue);
            var str = color.Name();
            string sheet = String.Format ( "QWidget {{background-color:{0} }}", str);
            colorBoxWidget.StyleSheet = sheet;
        }
示例#7
0
        public void OnToggled(bool toggleStatus)
        {
            int red   = redButton.Checked ? 255 : 0;
            int green = greenButton.Checked ? 255 : 0;
            int blue  = blueButton.Checked ? 255 : 0;

            color = new QColor(red, green, blue);
            var    str   = color.Name();
            string sheet = String.Format("QWidget {{background-color:{0} }}", str);

            colorBoxWidget.StyleSheet = sheet;
        }
示例#8
0
        public SourceWindow(QWidget parent, ClassItem klass) :
            base(parent, "", WidgetFlags.WType_TopLevel)
        {
            SetCaption(klass.Model.sourceFile.sourceFile);
            Resize(640, 480);

            QBoxLayout layout =
                new QBoxLayout(this, 0);

            editor = new QTextEdit(this);
            editor.SetTextFormat(TextFormat.PlainText);
            editor.SetReadOnly(true);
            editor.SetFamily("misc-fixed");
            editor.SetPointSize(13);
            editor.SetWordWrap(QTextEdit.WordWrap.NoWrap);
            layout.AddWidget(editor);

            int[] coverage = klass.Model.sourceFile.Coverage;

            StreamReader infile      = new StreamReader(klass.Model.sourceFile.sourceFile);
            int          pos         = 1;
            QColor       deadColor   = editor.Color();
            QColor       hitColor    = new QColor("blue");
            QColor       missedColor = new QColor("red");

            while (infile.Peek() > -1)
            {
                if (pos < coverage.Length)
                {
                    int count = coverage [pos];
                    if (count > 0)
                    {
                        editor.SetColor(hitColor);
                    }
                    else if (count == 0)
                    {
                        editor.SetColor(missedColor);
                    }
                    else
                    {
                        editor.SetColor(deadColor);
                    }
                }
                else
                {
                    editor.SetColor(deadColor);
                }
                editor.Append(String.Format("{0, 6}", pos) + "  " + infile.ReadLine());
                pos++;
            }
            editor.SetCursorPosition(0, 0);
        }
示例#9
0
    protected override void PaintEvent(QPaintEvent e)
    {
        QColor hourColor   = new QColor(127, 0, 127);
        QColor minuteColor = new QColor(0,127,127,191);

        int   side = QMin(Width(), Height());
        QTime time = QTime.CurrentTime();

        QPainter painter = new QPainter(this);

        painter.SetRenderHint(QPainter.RenderHint.Antialiasing);
        painter.Translate(Width() / 2, Height() / 2);
        painter.Scale(side / 200.0, side / 200.0);

        painter.SetPen(Qt.PenStyle.NoPen);
        painter.SetBrush(hourColor);

        painter.Save();
        painter.Rotate(30.0 * ((time.Hour() + time.Minute() / 60.0)));
        painter.DrawConvexPolygon(new QPolygon(hourHand));
        painter.Restore();

        painter.SetPen(hourColor);

        for (int i = 0; i < 12; ++i)
        {
            painter.DrawLine(88, 0, 96, 0);
            painter.Rotate(30.0);
        }

        painter.SetPen(Qt.PenStyle.NoPen);
        painter.SetBrush(minuteColor);

        painter.Save();
        painter.Rotate(6.0 * (time.Minute() + time.Second() / 60.0));
        painter.DrawConvexPolygon(new QPolygon(minuteHand));
        painter.Restore();

        painter.SetPen(minuteColor);

        for (int j = 0; j < 60; ++j)
        {
            if ((j % 5) != 0)
            {
                painter.DrawLine(92, 0, 96, 0);
            }
            painter.Rotate(6.0);
        }

        painter.End();
    }
示例#10
0
        private static void Drawing_OnDraw(EventArgs args)
        {
            if (Me.IsDead)
            {
                return;
            }
            if (DrawMenu.GetCheckBoxValue("drawReady"))
            {
                if (QColor.BoolValue && Q.IsReady())
                {
                    Q.DrawSpell(QColor.GetColor());
                }

                if (WColor.BoolValue && W.IsReady())
                {
                    W.DrawSpell(WColor.GetColor());
                }

                if (EColor.BoolValue && E.IsReady())
                {
                    E.DrawSpell(EColor.GetColor());
                }

                if (RColor.BoolValue && R.IsReady())
                {
                    R.DrawSpell(RColor.GetColor());
                }
            }
            else
            {
                if (QColor.BoolValue)
                {
                    Q.DrawSpell(Q.IsReady() ? QColor.GetColor() : Color.Red);
                }

                if (WColor.BoolValue)
                {
                    W.DrawSpell(W.IsReady() ? WColor.GetColor() : Color.Red);
                }

                if (EColor.BoolValue)
                {
                    E.DrawSpell(E.IsReady() ? EColor.GetColor() : Color.Red);
                }

                if (RColor.BoolValue)
                {
                    R.DrawSpell(R.IsReady() ? RColor.GetColor() : Color.Red);
                }
            }
        }
示例#11
0
    public Projector()
    {
        WindowTitle = "Paint Demo";
        Palette.SetColor(QPalette.ColorRole.Background, QColor.FromRgb(0, 0, 0));

        Resize(800, 800);
        Show();
        Info        = new QQuickWidget(this);
        Info.Source = new QUrl(@"\QML\main.qml");
        Info.RootObject.SetProperty("componentName", "lorem ipsum");
        Info.resizeMode = QQuickWidget.ResizeMode.SizeRootObjectToView;
        Info.Geometry   = new QRect(50, 10, 100, 300);
        Info.Show();
    }
示例#12
0
        /// <summary>
        /// Applies the pattern described in this object to the specified bitmap.
        /// </summary>
        /// <param name="b">A bitmap to apply the pattern to.</param>
        /// <remarks>For speed critical operation use this function with a preallocated bitmap rather than call makeBitmap. <see cref="pattern.makeBitmap"/></remarks>
        public override void applyPattern(ref Bitmap b)
        {
            float  perX = 0.0f, perY = 0.0f;
            float  stepX = 1.0f / (float)b.Width, stepY = 1.0f / (float)b.Height;
            QColor col = Color.Blue;
            QColor qcol1 = (QColor)topLeft, qcol2 = (QColor)topRight, qcol3 = (QColor)bottomLeft, qcol4 = (QColor)bottomRight;

            BitmapData bd = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);

            ///added i and j to fix a bug
            ///int i=0,j=0;

            unsafe
            {
                QColor *pixelPtr = (QColor *)bd.Scan0.ToPointer();

                QColor  t1 = mix(qcol1, qcol3, perY), t2 = mix(qcol2, qcol4, perY);
                QColor *end = pixelPtr + (bd.Width * bd.Height);

                float endLineValue = 1.0f - (stepX * 0.9f);

                for (; pixelPtr < end; pixelPtr++)
                {
                    //col = mix(mix(qcol1, qcol2, perX), mix(qcol3, qcol4, perX), perY);
                    ///perX = stepX * i++;
                    col = mix(t1, t2, perX);
                    *pixelPtr = *(&col);

                    perX += stepX;



                    if (perX > endLineValue)                   //stupid float comparison
                    ///if(i>=bd.Width)
                    {
                        ///i=0;
                        perX = 0.0f;
                        //fast but fp accumulation problem
                        perY += stepY;

                        ///perY = stepY * j++;

                        t1 = mix(qcol1, qcol3, perY);
                        t2 = mix(qcol2, qcol4, perY);
                    }
                }
            }
            b.UnlockBits(bd);
        }
示例#13
0
        /// <summary>
        /// Applies the pattern described in this object to the specified bitmap.
        /// </summary>
        /// <param name="b">A bitmap to apply the pattern to.</param>
        /// <remarks>For speed critical operation use this function with a preallocated bitmap rather than call makeBitmap. <see cref="pattern.makeBitmap"/></remarks>
        public override void applyPattern(ref Bitmap b)
        {
            //int i,j;
            float centreX = 0.5f, centreY = 0.5f;

            float[] sinLut = new float[256] {
                0.000000f, 0.012320f, 0.024637f, 0.036951f, 0.049260f, 0.061561f, 0.073853f, 0.086133f, 0.098400f, 0.110653f, 0.122888f, 0.135105f, 0.147302f, 0.159476f, 0.171626f, 0.183750f, 0.195845f, 0.207912f, 0.219946f, 0.231948f, 0.243914f, 0.255843f, 0.267733f, 0.279583f, 0.291390f, 0.303153f, 0.314870f, 0.326539f, 0.338158f, 0.349727f, 0.361242f, 0.372702f, 0.384106f, 0.395451f, 0.406737f, 0.417960f, 0.429121f, 0.440216f, 0.451244f, 0.462204f, 0.473094f, 0.483911f, 0.494656f, 0.505325f, 0.515918f,
                0.526432f, 0.536867f, 0.547220f, 0.557489f, 0.567675f, 0.577774f, 0.587785f, 0.597707f, 0.607539f, 0.617278f, 0.626924f, 0.636474f, 0.645928f, 0.655284f, 0.664540f, 0.673696f, 0.682749f, 0.691698f, 0.700543f, 0.709281f, 0.717912f, 0.726434f, 0.734845f, 0.743145f, 0.751332f, 0.759405f, 0.767363f, 0.775204f, 0.782928f, 0.790532f, 0.798017f, 0.805381f, 0.812622f, 0.819740f, 0.826734f, 0.833602f, 0.840344f, 0.846958f, 0.853444f, 0.859800f, 0.866025f, 0.872120f, 0.878081f, 0.883910f, 0.889604f,
                0.895163f, 0.900587f, 0.905873f, 0.911023f, 0.916034f, 0.920906f, 0.925638f, 0.930229f, 0.934680f, 0.938988f, 0.943154f, 0.947177f, 0.951057f, 0.954791f, 0.958381f, 0.961826f, 0.965124f, 0.968276f, 0.971281f, 0.974139f, 0.976848f, 0.979410f, 0.981823f, 0.984086f, 0.986201f, 0.988165f, 0.989980f, 0.991645f, 0.993159f, 0.994522f, 0.995734f, 0.996795f, 0.997705f, 0.998464f, 0.999070f, 0.999526f, 0.999829f, 0.999981f, 0.999981f, 0.999829f, 0.999526f, 0.999070f, 0.998464f, 0.997705f, 0.996795f,
                0.995734f, 0.994522f, 0.993159f, 0.991645f, 0.989980f, 0.988165f, 0.986201f, 0.984086f, 0.981823f, 0.979410f, 0.976848f, 0.974139f, 0.971281f, 0.968276f, 0.965124f, 0.961826f, 0.958381f, 0.954791f, 0.951057f, 0.947177f, 0.943154f, 0.938988f, 0.934680f, 0.930229f, 0.925638f, 0.920906f, 0.916034f, 0.911023f, 0.905873f, 0.900587f, 0.895163f, 0.889604f, 0.883910f, 0.878081f, 0.872120f, 0.866025f, 0.859800f, 0.853444f, 0.846958f, 0.840344f, 0.833602f, 0.826734f, 0.819740f, 0.812622f, 0.805381f,
                0.798017f, 0.790532f, 0.782928f, 0.775204f, 0.767363f, 0.759405f, 0.751332f, 0.743145f, 0.734845f, 0.726434f, 0.717912f, 0.709281f, 0.700543f, 0.691698f, 0.682749f, 0.673696f, 0.664540f, 0.655284f, 0.645928f, 0.636474f, 0.626924f, 0.617278f, 0.607539f, 0.597707f, 0.587785f, 0.577774f, 0.567675f, 0.557489f, 0.547220f, 0.536867f, 0.526432f, 0.515918f, 0.505325f, 0.494656f, 0.483911f, 0.473094f, 0.462204f, 0.451244f, 0.440216f, 0.429121f, 0.417960f, 0.406737f, 0.395451f, 0.384106f, 0.372702f,
                0.361242f, 0.349727f, 0.338158f, 0.326539f, 0.314870f, 0.303153f, 0.291390f, 0.279583f, 0.267733f, 0.255843f, 0.243914f, 0.231948f, 0.219946f, 0.207912f, 0.195845f, 0.183750f, 0.171626f, 0.159476f, 0.147302f, 0.135105f, 0.122888f, 0.110653f, 0.098400f, 0.086133f, 0.073853f, 0.061561f, 0.049260f, 0.036951f, 0.024637f, 0.012320f, 0.000000f
            };


            float  perX = 0.0f, perY = 0.0f;
            float  stepX = 1.0f / (float)b.Width, stepY = 1.0f / (float)b.Height;
            QColor col = Color.Blue;
            QColor qcol1 = (QColor)col1, qcol2 = (QColor)col2;

            float endLineValue = 1.0f - (stepX * 0.9f);

            BitmapData bd = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);

            unsafe
            {
                QColor *pixelPtr = (QColor *)bd.Scan0.ToPointer();

                float   d;
                QColor *end = pixelPtr + (bd.Width * bd.Height);

                for (; pixelPtr < end; pixelPtr++)
                {
                    d   = dist(perX, perY, centreX, centreY);
                    col = mix(col1, col2, sinLut[(byte)(d * 255 * (waveLenth))]);
                    *pixelPtr = *(&col);
                    perX += stepX;
                    if (perX > endLineValue)
                    {
                        perX  = 0.0f;
                        perY += stepY;
                    }
                }
            }
            b.UnlockBits(bd);
        }
示例#14
0
        void DrawDonut(QPainter painter)
        {
            var color = new QColor();

            color.SetNamedColor("#333333");

            painter.Pen = new QPen(color, 0.5);
            painter.SetRenderHint(QPainter.RenderHint.Antialiasing);

            painter.Translate(new QPoint(Width / 2, Height / 2));

            for (double rot = 0; rot < 360.0; rot += 5.0)
            {
                painter.DrawEllipse(-125, -40, 250, 80);
                painter.Rotate(5.0);
            }
        }
示例#15
0
        /// <summary>
        /// Creates a colour from a string, Returns black when an error occurs
        /// String can be int the form (i)(i a)(r g b)(r g b a) OR a prenamed color string
        /// </summary>
        /// <param name="s">String to parse</param>
        /// <returns></returns>
        public static HColor fromString(string s)
        {
            try
            {
                string[] elements = s.Trim().Replace("  ", " ").Split(" ".ToCharArray());
                float    c;
                if (s.IndexOfAny(".".ToCharArray()) != -1)
                {
                    //floating point information string
                    switch (elements.Length)
                    {
                    case 0:
                        return(HColor.fromRGB(0, 0, 0));

                    case 1:
                        c = float.Parse(elements[0]);
                        return(HColor.fromRGB(c, c, c));

                    case 2:
                        //assume c c c a (intensity + opacity)
                        c = float.Parse(elements[0]);
                        return(HColor.fromRGBA(c, c, c, float.Parse(elements[1])));

                    case 3:
                        return(HColor.fromRGB(float.Parse(elements[0]), float.Parse(elements[1]), float.Parse(elements[2])));

                    default:
                        //four or more
                        return(HColor.fromRGBA(float.Parse(elements[0]), float.Parse(elements[1]), float.Parse(elements[2]), float.Parse(elements[2])));
                    }
                }
                else
                {
                    //integer(0-255) or named string
                    QColor col = QColor.fromString(s);
                    return((HColor)col);
                }
            }
            catch
            {
                return(QColor.fromRGB(0, 0, 0));
            }
        }
示例#16
0
        public SourceWindow(QWidget parent, ClassItem klass)
            : base(parent, "", WidgetFlags.WType_TopLevel)
        {
            SetCaption (klass.Model.sourceFile.sourceFile);
            Resize (640, 480);

            QBoxLayout layout =
            new QBoxLayout (this, 0);

            editor = new QTextEdit (this);
            editor.SetTextFormat (TextFormat.PlainText);
            editor.SetReadOnly (true);
            editor.SetFamily ("misc-fixed");
            editor.SetPointSize (13);
            editor.SetWordWrap (QTextEdit.WordWrap.NoWrap);
            layout.AddWidget (editor);

            int[] coverage = klass.Model.sourceFile.Coverage;

            StreamReader infile = new StreamReader (klass.Model.sourceFile.sourceFile);
            int pos = 1;
            QColor deadColor = editor.Color ();
            QColor hitColor = new QColor ("blue");
            QColor missedColor = new QColor ("red");
            while (infile.Peek () > -1) {
            if (pos < coverage.Length) {
                int count = coverage [pos];
                if (count > 0)
                    editor.SetColor (hitColor);
                else if (count == 0)
                    editor.SetColor (missedColor);
                else
                    editor.SetColor (deadColor);
            }
            else
                editor.SetColor (deadColor);
            editor.Append (String.Format ("{0, 6}", pos) + "  " + infile.ReadLine ());
            pos ++;
            }
            editor.SetCursorPosition (0, 0);
        }
示例#17
0
        public void OnToggled(bool @checked)
        {
            int red   = _color.Red;
            int green = _color.Green;
            int blue  = _color.Blue;

            if (_redButton.Checked)
            {
                red = 255;
            }
            else
            {
                red = 0;
            }

            if (_greenButton.Checked)
            {
                green = 255;
            }
            else
            {
                green = 0;
            }

            if (_blueButton.Checked)
            {
                blue = 255;
            }
            else
            {
                blue = 0;
            }

            _color = new QColor(red, green, blue);

            string sheet = System.String.Format("QWidget {{ background-color: {0} }}", _color.Name());

            _square.StyleSheet = sheet;
        }
示例#18
0
        public override void InitUI()
        {
            _color = new QColor();

            _redButton             = new QPushButton("Red", this);
            _redButton.Checkable   = true;
            _greenButton           = new QPushButton("Green", this);
            _greenButton.Checkable = true;
            _blueButton            = new QPushButton("Blue", this);
            _blueButton.Checkable  = true;

            _redButton.Toggled   += OnToggled;
            _greenButton.Toggled += OnToggled;
            _blueButton.Toggled  += OnToggled;

            _square            = new QWidget(this);
            _square.StyleSheet = "QWidget { background-color: black }";

            _redButton.Move(30, 30);
            _greenButton.Move(30, 80);
            _blueButton.Move(30, 130);
            _square.SetGeometry(150, 25, 150, 150);
        }
示例#19
0
        /// <summary>
        /// Convert RGBA image to grayscale RGBA
        /// </summary>
        /// <param name="originalImage"></param>
        /// <returns></returns>
        public static QImage ConvertToGrayScale(QImage originalImage)
        {
            var newImage = originalImage.Copy();

            for (int x = 0; x < originalImage.Width; x++)
            {
                for (int y = 0; y < originalImage.Height; y++)
                {
                    var point = new QPoint(x, y); // pixel position

                    using (var color = originalImage.PixelColor(point)) {
                        UInt32 pixel = originalImage.Pixel(point);
                        int    alpha = color.Alpha;
                        int    gray  = qrgb.QGray(pixel);

                        using (var qColor = new QColor(gray, gray, gray, alpha)) {
                            newImage.SetPixelColor(point, qColor);
                        }
                    }
                }
            }

            return(newImage);
        }
示例#20
0
        public static Bitmap GenerateDebugImage(int width, int height, string message)
        {
            GradientPattern pattern = new GradientPattern();

            pattern.bottomLeft  = (Color)QColor.generateRandomOpaque(128, 255);
            pattern.bottomRight = (Color)QColor.generateRandomOpaque(128, 255);
            pattern.topLeft     = Color.Fuchsia;
            pattern.topRight    = Color.Fuchsia;

            Bitmap          bmp      = pattern.makeBitmap(width, height);
            GDIPlusRenderer r        = new GDIPlusRenderer(bmp);
            float           fontSize = Math.Min(width, height) / 10.0f;

            fontSize = Range.clamp(fontSize, 10, 45);
            using (Font f = new Font("Arial", fontSize, FontStyle.Bold))
            {
                TextFormat tf = new TextFormat(f, Color.Black, true, Color.White, false);
                tf.render(r, message, 0, height / 2);
                bmp = r.RenderTargetAsGDIBitmap();
            }


            return(bmp);
        }
示例#21
0
 /// <remarks>
 ///  This recolors a pixmap. The most dark color will become color a,
 ///  the most bright one color b, and in between.
 /// <param> name="img" The image to process.
 /// </param><param> name="ca" Color a
 /// </param><param> name="cb" Color b
 ///      </param></remarks>        <short>    This recolors a pixmap.</short>
 public static QImage Flatten(QImage img, QColor ca, QColor cb)
 {
     return((QImage)staticInterceptor.Invoke("flatten###", "flatten(QImage&, const QColor&, const QColor&)", typeof(QImage), typeof(QImage), img, typeof(QColor), ca, typeof(QColor), cb));
 }
示例#22
0
 public Color getColor(QColor color)
 {
     return(colors[color]);
 }
示例#23
0
 public void SetDefaultColor(QColor c)
 {
     interceptor.Invoke("setDefaultColor#", "setDefaultColor(const QColor&)", typeof(void), typeof(QColor), c);
 }
示例#24
0
 public Color getColor(QColor color)
 {
     return(EditorGUIUtility.isProSkin ? colorsDark[color] : colorsLight[color]);
 }
示例#25
0
 public static QImage UnbalancedGradient(QSize size, QColor ca, QColor cb, Blitz.GradientType type)
 {
     return((QImage)staticInterceptor.Invoke("unbalancedGradient###$", "unbalancedGradient(const QSize&, const QColor&, const QColor&, Blitz::GradientType)", typeof(QImage), typeof(QSize), size, typeof(QColor), ca, typeof(QColor), cb, typeof(Blitz.GradientType), type));
 }
示例#26
0
 /// <summary>
 /// Creates a new qColour
 /// </summary>
 /// <param name="red">0-255</param>
 /// <param name="green">0-255</param>
 /// <param name="blue">0-255</param>
 /// <returns></returns>
 public static HColor fromRGB(int red, int green, int blue)
 {
     return((HColor)QColor.fromRGB(red, green, blue));
 }
示例#27
0
 /// <summary>
 /// Creates a new qColour
 /// </summary>
 /// <param name="red">0-255</param>
 /// <param name="green">0-255</param>
 /// <param name="blue">0-255</param>
 /// <param name="alpha">0-255 (0=transparent, 255=solid)</param>
 /// <returns></returns>
 public static HColor fromRGBA(int red, int green, int blue, int alpha)
 {
     return((HColor)QColor.fromRGBA(red, green, blue, alpha));
 }
示例#28
0
        private static void Drawing_OnDraw(EventArgs args)
        {
            if (Me.IsDead)
            {
                return;
            }

            var flash = EloBuddy.SDK.Spells.SummonerSpells.Flash;

            if (flash != null && flash.IsReady() && R.IsReady() && HasQ3())
            {
                Console.WriteLine("Trying");
                var targets = EntityCache.EnemyHeroes.Where(e => e.IsValidTarget(1000)).ToArray();

                var range = flash.Range + (QCircleRange / 2);
                var width = QCircleRange;
                var delay = EDelay + Q.CastDelay / 2 + Game.Ping;

                var predLocationCircular =
                    Prediction.Position.PredictCircularMissileAoe(targets, range, width, delay,
                                                                  int.MaxValue)
                    .OrderByDescending(r => r.GetCollisionObjects <AIHeroClient>().Length)
                    .FirstOrDefault();

                if (predLocationCircular != null && predLocationCircular.HitChancePercent >= 75)
                {
                    predLocationCircular.CastPosition.DrawCircle(width, SharpDX.Color.Aqua, 5f);
                    var predictedMinion = predLocationCircular.GetCollisionObjects <AIHeroClient>();
                    if (predictedMinion.Length >= 1)
                    {
                        try
                        {
                            Console.WriteLine("Casting");
                            if (Me.Dashing())
                            {
                                //Q.Cast();
                                //flash.Cast(predLocationCircular.CastPosition);
                            }
                        }
                        catch (Exception)
                        {
                            //ignored
                        }
                    }
                }
            }

            if (DrawMenu.GetCheckBoxValue("drawReady"))
            {
                if (QColor.BoolValue && Q.IsReady())
                {
                    Q.DrawSpell(QColor.GetColor());


                    var targets = EntityCache.EnemyHeroes.Where(m => Q.CanCast(m));
                    if (targets != null || targets.Any())
                    {
                        /*
                         * var predPos = Q.GetBestLinearCastPosition(targets);
                         * if (predPos.CastPosition != null)
                         * {
                         *  var polygon = new Geometry.Polygon.Rectangle(Me.Position, Me.Position.Extend(predPos.CastPosition, Q.Range).To3D(), Q.Width);
                         *
                         *  if (polygon != null)
                         *  {
                         *      polygon.Draw(QColor.CurrentColor, 6);
                         *  }
                         * }
                         */
                    }
                }

                if (WColor.BoolValue && W.IsReady())
                {
                    W.DrawSpell(WColor.GetColor());
                }

                if (EColor.BoolValue && E.IsReady())
                {
                    E.DrawSpell(EColor.GetColor());
                }

                if (RColor.BoolValue && R.IsReady())
                {
                    R.DrawSpell(RColor.GetColor());
                }
            }
            else
            {
                if (QColor.BoolValue)
                {
                    Q.DrawSpell(Q.IsReady() ? QColor.GetColor() : Color.Red);
                }

                if (WColor.BoolValue)
                {
                    W.DrawSpell(W.IsReady() ? WColor.GetColor() : Color.Red);
                }

                if (EColor.BoolValue)
                {
                    E.DrawSpell(E.IsReady() ? EColor.GetColor() : Color.Red);
                }

                if (RColor.BoolValue)
                {
                    R.DrawSpell(R.IsReady() ? RColor.GetColor() : Color.Red);
                }
            }
        }
示例#29
0
 public virtual void SetPaper(QColor c)
 {
     interceptor.Invoke("setPaper#", "setPaper(const QColor&)", typeof(void), typeof(QColor), c);
 }
示例#30
0
 /// <remarks>
 ///  Fade an image to a certain background color. The number of colors will
 ///  not be changed.
 /// <param> name="img" The image to process.
 /// </param><param> name="val" The strength of the effect. 0 <= val <= 1.
 /// </param><param> name="color" The background color.
 /// </param></remarks>        <return> A reference to the image for convenience.
 ///      </return>
 ///         <short>    Fade an image to a certain background color.</short>
 public static QImage Fade(QImage img, float val, QColor color)
 {
     return((QImage)staticInterceptor.Invoke("fade#$#", "fade(QImage&, float, const QColor&)", typeof(QImage), typeof(QImage), img, typeof(float), val, typeof(QColor), color));
 }
示例#31
0
 public virtual void SetPaper(QColor c, int style)
 {
     interceptor.Invoke("setPaper#$", "setPaper(const QColor&, int)", typeof(void), typeof(QColor), c, typeof(int), style);
 }
示例#32
0
        private QGroupBox InitToggleButtons()
        {
            var groupBox = new QGroupBox ("Toggle Buttons", this);
            color = new QColor ();
            redButton = new QPushButton ("Red", this);
            greenButton = new QPushButton ("Green", this);
            blueButton = new QPushButton ("Blue", this);
            colorBoxWidget = new QWidget (this);
            colorBoxWidget.StyleSheet = "QWidget { background-color: black }";

            redButton.Toggled += OnToggled;
            greenButton.Toggled += OnToggled;
            blueButton.Toggled += OnToggled;

            redButton.Checkable = true;
            greenButton.Checkable = true;
            blueButton.Checkable = true;

            QHBoxLayout hBox = new QHBoxLayout ();
            QVBoxLayout vBox = new QVBoxLayout ();

            vBox.AddWidget (redButton);
            vBox.AddWidget (greenButton);
            vBox.AddWidget (blueButton);

            hBox.AddLayout (vBox);
            hBox.AddWidget (colorBoxWidget);

            groupBox.Layout = hBox;

            return groupBox;
        }