Example #1
0
        /// <summary>Generates a plasma fractal of the specified size.</summary>
        /// <param name="width">Width of the bitmap to generate.</param>
        /// <param name="height">Height of the bitmap to generate.</param>
        /// <param name="leftTop">Desired color of the top-left pixel.</param>
        /// <param name="rightTop">Desired color of the top-right pixel.</param>
        /// <param name="leftBottom">Desired color of the bottom-left pixel.</param>
        /// <param name="rightBottom">Desired color of the bottom-right pixel.</param>
        /// <param name="varyRLevel">A number between 0 and 8 specifying by how much to vary the Red channel. 0 means maximum variance, 8 means no variance.</param>
        /// <param name="varyGLevel">A number between 0 and 8 specifying by how much to vary the Green channel. 0 means maximum variance, 8 means no variance.</param>
        /// <param name="varyBLevel">A number between 0 and 8 specifying by how much to vary the Blue channel. 0 means maximum variance, 8 means no variance.</param>
        /// <returns>The generated plasma fractal as a Bitmap object.</returns>
        public static Bitmap Create(int width, int height, Color leftTop, Color rightTop, Color leftBottom, Color rightBottom, int varyRLevel, int varyGLevel, int varyBLevel)
        {
            Color?[][] arr = Enumerable.Range(0, width).Select(i => new Color?[height]).ToArray();

            arr[0][0] = leftTop;
            arr[width - 1][0] = rightTop;
            arr[0][height - 1] = leftBottom;
            arr[width - 1][height - 1] = rightBottom;

            drawPlasmaPart(arr, 0, 0, width - 1, height - 1, varyRLevel, varyGLevel, varyBLevel, leftTop, rightTop, leftBottom, rightBottom, width, height);

            var bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb);
            unsafe
            {
                var data = bmp.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
                for (int y = 0; y < height; y++)
                {
                    var b = (byte*) data.Scan0 + y * data.Stride;
                    for (int x = 0; x < width; x++)
                    {
                        var col = arr[x][y].Value;
                        b[4 * x] = col.B;
                        b[4 * x + 1] = col.G;
                        b[4 * x + 2] = col.R;
                        b[4 * x + 3] = 255;
                    }
                }
                bmp.UnlockBits(data);
            }
            return bmp;
        }
Example #2
0
 public Vertex(Float3 position)
 {
     this.position = position;
     this.normal = Float3.zero;
     this.color = Color.Black;
     this.uv = new Float2(0, 0);
 }
Example #3
0
 public Rectangle(int longueur, int largeur, Point centre, Color couleur, Point position, float epaisseur, Color couleurFond)
     : base(centre, couleur, position, epaisseur)
 {
     this.Longueur = longueur;
     this.Largeur = largeur;
     this.CouleurFond = couleurFond;
 }
Example #4
0
 private static Color averageColor(Color one, Color two, Color three, Color four)
 {
     int r = (one.R + two.R + three.R + four.R) / 4;
     int g = (one.G + two.G + three.G + four.G) / 4;
     int b = (one.B + two.B + three.B + four.B) / 4;
     return Color.FromArgb(r, g, b);
 }
Example #5
0
        // From http://edu.cnzz.cn/show_3281.html
        public static GraphicsPath CalculateGraphicsPathFromBitmap(Bitmap bitmap, Color colorTransparent)
        {
            GraphicsPath graphicsPath = new GraphicsPath();
            if (colorTransparent == Color.Empty)
                colorTransparent = bitmap.GetPixel(0, 0);

            for (int row = 0; row < bitmap.Height; row++)
            {
                int colOpaquePixel = 0;
                for (int col = 0; col < bitmap.Width; col++)
                {
                    if (bitmap.GetPixel(col, row) != colorTransparent)
                    {
                        colOpaquePixel = col;
                        int colNext = col;
                        for (colNext = colOpaquePixel; colNext < bitmap.Width; colNext++)
                            if (bitmap.GetPixel(colNext, row) == colorTransparent)
                                break;

                        graphicsPath.AddRectangle(new Rectangle(colOpaquePixel, row, colNext - colOpaquePixel, 1));
                        col = colNext;
                    }
                }
            }
            return graphicsPath;
        }
Example #6
0
 public HSLColor(byte h, byte s, byte l)
 {
     H = h;
     S = s;
     L = l;
     RGB = RGBFromHSL(H / 255f, S / 255f, L / 255f);
 }
Example #7
0
        public ScrollBarThumb(ScrollBarThumbDefaults type)
        {
            this._imageAttributes = new ImageAttributes();
            this._imageAttributes.ClearColorKey();
            this._gripImageAttributes = new ImageAttributes();
            this._gripImageAttributes.ClearColorKey();
            switch (type)
            {
                case ScrollBarThumbDefaults.Normal:
                    this._color = SystemColors.ScrollBar;
                    this._gripColor = SystemColors.ControlText;
                    break;

                case ScrollBarThumbDefaults.Highlight:
                    this._color = SystemColors.ControlText;
                    this._gripColor = SystemColors.HighlightText;
                    break;
            }
            this._borderStyle = ScrollBarBorderStyle.Solid;
            this._borderColor = SystemColors.ControlText;
            this._gradientColor = new Resco.Controls.ScrollBar.GradientColor(FillDirection.Horizontal);
            this._gradientColor.PropertyChanged += new EventHandler(this.GradientColor_PropertyChanged);
            this._image = null;
            this._imageLayout = ScrollBarThumbImageLayout.Stretch;
            this._imageTransparentColor = System.Drawing.Color.Transparent;
            this._gripStyle = ScrollBarThumbGripStyle.Lines;
            this._gripImage = null;
            this._gripImageTransparentColor = System.Drawing.Color.Transparent;
            this._gripLines = 3;
        }
Example #8
0
        public Color GetRemappedColor(Color original, int index)
        {
            // false-color version for debug

            //return new[] {
            //    Color.FromArgb(64,0,0,0), Color.Green,
            //    Color.Blue, Color.Yellow,
            //    Color.Green,
            //    Color.Red,
            //    Color.Purple,
            //    Color.Cyan}[index % 8];

            if (isFog)
                return new[] {
                    Color.Transparent, Color.Green,
                    Color.Blue, Color.Yellow,
                    Color.FromArgb(128,0,0,0),
                    Color.FromArgb(128,0,0,0),
                    Color.FromArgb(128,0,0,0),
                    Color.FromArgb(64,0,0,0)}[index % 8];
            else
                return new[] {
                    Color.Transparent, Color.Green,
                    Color.Blue, Color.Yellow,
                    Color.Black,
                    Color.FromArgb(128,0,0,0),
                    Color.Transparent,
                    Color.Transparent}[index % 8];
        }
Example #9
0
 public CustomBitmapRenderer()
 {
    BackgroundGradientColor = Color.Aqua;
    Background = Color.GreenYellow;
    ForegroundGradientColor = Color.RoyalBlue;
    Foreground = Color.MidnightBlue;
 }
Example #10
0
		///-------------------------------------------------------------------------------------
		/// <summary>
		/// Calculates a color by applying the specified alpha value to the specified front
		/// color, assuming the color behind the front color is the specified back color. The
		/// returned color has the alpha channel set to completely opaque, but whose alpha
		/// channel value appears to be the one specified.
		/// </summary>
		///-------------------------------------------------------------------------------------
		public static Color CalculateColor(Color front, Color back, int alpha)
		{
			// Use alpha blending to brigthen the colors but don't use it
			// directly. Instead derive an opaque color that we can use.
			// -- if we use a color with alpha blending directly we won't be able
			// to paint over whatever color was in the background and there
			// would be shadows of that color showing through
			Color frontColor = Color.FromArgb(255, front);
			Color backColor = Color.FromArgb(255, back);

			float frontRed = frontColor.R;
			float frontGreen = frontColor.G;
			float frontBlue = frontColor.B;
			float backRed = backColor.R;
			float backGreen = backColor.G;
			float backBlue = backColor.B;

			float fRed = frontRed * alpha / 255 + backRed * ((float)(255 - alpha) / 255);
			byte newRed = (byte)fRed;
			float fGreen = frontGreen * alpha / 255 + backGreen * ((float)(255 - alpha) / 255);
			byte newGreen = (byte)fGreen;
			float fBlue = frontBlue * alpha / 255 + backBlue * ((float)(255 - alpha) / 255);
			byte newBlue = (byte)fBlue;

			return Color.FromArgb(255, newRed, newGreen, newBlue);
		}
Example #11
0
 public HSLColor(Color color)
 {
     RGB = color;
     H = (byte)((color.GetHue() / 360.0f) * 255);
     S = (byte)(color.GetSaturation() * 255);
     L = (byte)(color.GetBrightness() * 255);
 }
Example #12
0
        public static void DrawZone(Graphics g, Color color, int x, int y)
        {
            if (pen.Color != color)
                pen = new Pen(color, 2.0f);

            g.DrawRectangle(pen, new Rectangle(Display.ZoneCoordToPixel(x), Display.ZoneCoordToPixel(y), (int)Display.ZoneSize, (int)Display.ZoneSize));
        }
Example #13
0
        private void OptionsWindow_Load(object sender, System.EventArgs e)
        {
            hourColor = Properties.Settings.Default.HourColor;
            minuteColor = Properties.Settings.Default.MinuteColor;
            secondColor = Properties.Settings.Default.SecondColor;
            backColor = Properties.Settings.Default.BackColor;
            brushWeight = Properties.Settings.Default.Weight;
            spacing = Properties.Settings.Default.Spacing;
            _24HourFormat = Settings.Default.TimeFormat;

            btnSecondColor.BackColor = secondColor;
            btnHourColor.BackColor = hourColor;
            btnMinuteColor.BackColor = minuteColor;
            btnBackColor.BackColor = backColor;

            txtBrushWeight.Text = brushWeight.ToString();
            txtSpacing.Text = spacing.ToString();

            btnMinuteColor.Text = minuteColor.Name;
            btnHourColor.Text = hourColor.Name;
            btnSecondColor.Text = secondColor.Name;
            btnBackColor.Text = backColor.Name;

            chk24Hour.Checked = _24HourFormat;
        }
Example #14
0
        /// <summary>
        /// Create a new <see cref="Bitmap"/> instance using an array of <see cref="Color"/> pixels and the image width and height.
        /// </summary>
        /// <param name="colors"><see cref="Color"/> array containing the color of each pixel in the image.</param>
        /// <param name="width">The width of the image.</param>
        /// <param name="height">The height of the image.</param>
        /// <returns>A new <see cref="Bitmap"/> instance created using the data provided.</returns>
        public static Bitmap Create(Color[] colors, int width, int height)
        {
            Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb);
            BitmapData bitmapData = bitmap.LockBits
            (
                new Rectangle(0, 0, width, height),
                ImageLockMode.ReadWrite,
                bitmap.PixelFormat
            );

            unsafe
            {
                byte* p = (byte*)bitmapData.Scan0;
                Parallel.For(0, height, y =>
                {
                    for (int x = 0; x < width; x++)
                    {
                        int offset = (x * 4) + y * bitmapData.Stride;
                        Color color = colors[x + y * width];
                        p[offset] = color.B;
                        p[offset + 1] = color.G;
                        p[offset + 2] = color.R;
                        p[offset + 3] = color.A;
                    }
                });
            }

            bitmap.UnlockBits(bitmapData);

            return bitmap;
        }
Example #15
0
        public SeparatorWidget(string separator = "|", Color? backgroundColor = null, Color? foregroundColor = null)
        {
            this.separator = separator;

            this.backgroundColor = backgroundColor ?? Color.White;
            this.foregroundColor = foregroundColor ?? Color.Black;
        }
Example #16
0
 public static Color ColorLerp(float t, Color c1, Color c2)
 {
     return Color.FromArgb(255,
         (int)(t * c2.R + (1 - t) * c1.R),
         (int)(t * c2.G + (1 - t) * c1.G),
         (int)(t * c2.B + (1 - t) * c1.B));
 }
Example #17
0
 public new void Move(float Dx, float Dy, float Dlg, float Dlv, Color BackColor, Graphics G)
 {
     RePain(Dlg, Dlv, BackColor, BorderWidth, 1, G);
     Xn += Dx;
     Yn += Dy;
     RePain(Dlg, Dlv, false, 1, G);
 }
Example #18
0
 // Methods
 public GridWindow()
 {
     this.components = null;
     this.size = (SizeF) new Size(10, 10);
     this.color = System.Drawing.Color.Gray;
     this.InitializeComponent();
 }
Example #19
0
 public GradientStop(double offset, Color color)
 {
   Init();
   Color = color;
   Offset = offset;
   Attach();
 }
Example #20
0
        public static Bitmap ConvertDoubleArrayToBitmap(this int[][] doubleArray, Color defaultColor)
        {
            int width = doubleArray.GetLength(0);
            int height = doubleArray[0].GetLength(0);
            Bitmap bitmapReturn = new Bitmap(width, height);

            Color pixelColor;

            for (int i = 0; i < width; i++) {
                for (int j = 0; j < height; j++) {
                    pixelColor = defaultColor;

                    if (doubleArray[i][j] >= 0 && doubleArray[i][j] < 256)
                        pixelColor = Color.FromArgb(doubleArray[i][j], doubleArray[i][j], doubleArray[i][j]);
                    else if (doubleArray[i][j] >= 256 && doubleArray[i][j] < 512)
                        pixelColor = Color.FromArgb(0, 0, doubleArray[i][j] % 255);
                    else if (doubleArray[i][j] >= 512 && doubleArray[i][j] < 768)
                        pixelColor = Color.FromArgb(0, doubleArray[i][j] % 255, 0);
                    else if (doubleArray[i][j] >= 768 && doubleArray[i][j] < 1024)
                        pixelColor = Color.FromArgb(doubleArray[i][j] % 255, 0, 0);

                    bitmapReturn.SetPixel(i, j, pixelColor);
                }
            }
            return bitmapReturn;
        }
Example #21
0
 public static Color Mix(Color aColor, Color bColor)
 {
     float r = (aColor.R + bColor.R) / (2.0f);
     float g = (aColor.G + bColor.G) / (2.0f);
     float b = (aColor.B + bColor.B) / (2.0f);
     return Color.FromArgb((byte)r, (byte)g, (byte)b);
 }
Example #22
0
 private void PrintWay(List<Location> loc, Color color, RadarForm form)
 {
     if (loc != null)
     {
         PointF[] points;
         Point tempP;
         Location ld;
         if (loc.Count != 0)
         {
             points = new PointF[loc.Count + 1];
             int i = 0;
             foreach (Location lo in loc)
             {
                 form.PrintCircle(color, form.OffsetY(lo.Y, ObjectManager.MyPlayer.Location.Y),
                                  form.OffsetX(lo.X, ObjectManager.MyPlayer.Location.X), "");
                 tempP = new Point(form.OffsetY(lo.Y, ObjectManager.MyPlayer.Location.Y),
                                   form.OffsetX(lo.X, ObjectManager.MyPlayer.Location.X));
                 points[i] = tempP;
                 i++;
             }
             ld = loc[0];
             tempP = new Point(form.OffsetY(ld.Y, ObjectManager.MyPlayer.Location.Y),
                               form.OffsetX(ld.X, ObjectManager.MyPlayer.Location.X));
             points[i] = tempP;
             form.ScreenDc.DrawLines(new Pen(_colorWaypoints), points);
         }
     }
 }
Example #23
0
        public static void ConvertImage(Bitmap image, Graphics g, Color ForeColor, Color BackColor, bool isActive)
        {
            using (ImageAttributes imageAttributes = new ImageAttributes())
            {
                ColorMap[] colorMap = new ColorMap[2];
                colorMap[0] = new ColorMap();
                colorMap[0].OldColor = Color.FromArgb(0, 0, 0);
                colorMap[0].NewColor = ForeColor;

                colorMap[1] = new ColorMap();
                colorMap[1].OldColor = image.GetPixel(0, 0);
                colorMap[1].NewColor = isActive ? BackColor : Color.Transparent;

                imageAttributes.SetRemapTable(colorMap);

                g.DrawImage(
                   image,
                   new Rectangle(0, 0, image.Width, image.Height),
                   0, 0,
                   image.Width,
                   image.Height,
                   GraphicsUnit.Pixel,
                   imageAttributes);
            }
        }
Example #24
0
 public void Write(uint x, uint y, Color colour)
 {
     Pen p = new Pen(colour);
       lock (image) {
     image.SetPixel((int)x, (int)(Height - y - 1), colour);
       }
 }
Example #25
0
		public Pixel( Color c )
		{
			B = c.B;
			G = c.G;
			R = c.R;
			A = c.A;
		}
Example #26
0
        public static void DrawTextCentered(this Font font,
			string text,
			Obj_AI_Base target,
			Color color,
			bool outline = false)
        {
            var measure = GetMeasured(font, text);
            var position = Drawing.WorldToScreen(target.Position);
            if (outline)
            {
                font.DrawText(
                    null, text, (int)(position.X + 1 - measure.Width * 0.5f),
                    (int)(position.Y + 1 - measure.Height * 0.5f), XDColor.Black);
                font.DrawText(
                    null, text, (int)(position.X - 1 - measure.Width * 0.5f),
                    (int)(position.Y - 1 - measure.Height * 0.5f), XDColor.Black);
                font.DrawText(
                    null, text, (int)(position.X + 1 - measure.Width * 0.5f),
                    (int)(position.Y - measure.Height * 0.5f), XDColor.Black);
                font.DrawText(
                    null, text, (int)(position.X - 1 - measure.Width * 0.5f),
                    (int)(position.Y - measure.Height * 0.5f), XDColor.Black);
            }
            font.DrawText(
                null, text, (int)(position.X - measure.Width * 0.5f), (int)(position.Y - measure.Height * 0.5f), new XDColor(color.R, color.G, color.B, color.A));
        }
Example #27
0
        // For Ownder Drawn TreeViews
        public static void DrawItem(this DrawTreeNodeEventArgs e, Color channelColor, TreeView treeView, bool useCheckmark)
        {
            if (treeView == null) {
                e.DrawDefault = true;
                return;
            }

            if (e.Bounds.Left < 0 || e.Bounds.Top < 0) {
                return;
            }

            var fillRect = new Rectangle(e.Node.Bounds.X, e.Node.Bounds.Y, treeView.Width - e.Node.Bounds.Left, e.Node.Bounds.Height);
            GenericBrush.Color = channelColor;

            bool selected;
            var view = treeView as MultiSelectTreeview;
            if (view != null) {
                selected = view.SelectedNodes.Contains(e.Node);
            }
            else {
                selected = (e.State & TreeNodeStates.Selected) != 0;
            }

            var rectBrush = selected && !useCheckmark ? SystemBrushes.Highlight : GenericBrush;
            e.Graphics.FillRectangle(rectBrush, fillRect);
            var stringBrush = selected && !useCheckmark ? SystemBrushes.HighlightText : channelColor.GetTextColor();
            e.Graphics.DrawString(e.Node.Text, treeView.Font, stringBrush, e.Bounds.Left, e.Bounds.Top);

            if (selected && useCheckmark) {
                e.Graphics.DrawString(Checkmark, treeView.Font, channelColor.GetTextColor(), fillRect.Right - 40, e.Bounds.Top);
            }
        }
Example #28
0
 public static void AreEqual(Color expected, Color actual)
 {
   Assert.AreEqual(expected.R, actual.R, "R is not equal");
   Assert.AreEqual(expected.G, actual.G, "G is not equal");
   Assert.AreEqual(expected.B, actual.B, "B is not equal");
   Assert.AreEqual(expected.A, actual.A, "A is not equal");
 }
Example #29
0
		public static Color GetColor(float alpha, Color baseColor)
		{
            if (alpha >= 1) return baseColor;
            else if (alpha < 0) return Color.Transparent;

			return Color.FromArgb((int)(alpha * 255), baseColor);
		}
		public Color GetRemappedColor(Color original, int index)
		{
			return Color.FromArgb(original.A,
				(int)Exts.Clamp((int)(scale * original.R + offset), 0, 255),
				(int)Exts.Clamp((int)(scale * original.G + offset), 0, 255),
				(int)Exts.Clamp((int)(scale * original.B + offset), 0, 255));
		}
 public void HashingService()
 {
     Log(LogSeverity.Info, "Hashing service started");
     while (true)
     {
         bool newHashes = false;
         while (hashQueue.TryDequeue(out string fileToHash))
         {
             if (!File.Exists(fileToHash))
             {
                 Log(LogSeverity.Warning, "File to hash is missing: " + fileToHash);
                 continue;
             }
             newHashes = true;
             Log(LogSeverity.Info, "Hashing " + fileToHash);
             SystemImage si           = SystemImage.FromFile(fileToHash);
             Bitmap      resizedImage = ResizeImage(si);
             byte[]      picHash      = new byte[RESIZE_WIDTH];
             for (int yPos = 0; yPos < RESIZE_HEIGHT; yPos++)
             {
                 for (int xPos = 0; xPos < RESIZE_WIDTH; xPos++)
                 {
                     SystemColor testPixel = resizedImage.GetPixel(xPos, yPos);
                     int         rVal      = testPixel.R / 64;
                     if (rVal > 3)
                     {
                         rVal = 3;
                     }
                     int gVal = testPixel.G / 64;
                     if (gVal > 3)
                     {
                         gVal = 3;
                     }
                     int bVal = testPixel.B / 64;
                     if (bVal > 3)
                     {
                         bVal = 3;
                     }
                     byte totalVal = (byte)((rVal << 4) + (gVal << 2) + rVal);
                     picHash[xPos] = (byte)(picHash[xPos] ^ totalVal);
                 }
             }
             string base64String = GetBase64String(picHash);
             ulong  thisChannel  = GetChannelIDFromPath(fileToHash);
             string shortName    = fileToHash.Substring(fileToHash.IndexOf("Backup") + 7);
             hashes[shortName] = base64String;
             if (!reverse_hashes.ContainsKey(thisChannel))
             {
                 reverse_hashes.Add(thisChannel, new Dictionary <string, string>());
             }
             if (reverse_hashes[thisChannel].ContainsKey(base64String))
             {
                 string existingFile = reverse_hashes[thisChannel][base64String];
                 ulong  existingID   = GetMessageIDFromPath(existingFile);
                 ulong  newID        = GetMessageIDFromPath(fileToHash);
                 if (existingID != newID)
                 {
                     NotifyRepost(thisChannel, existingID, newID);
                     Log(LogSeverity.Info, $"MATCH {shortName}, hash: {base64String}, existing file {existingFile}");
                 }
             }
             else
             {
                 reverse_hashes[thisChannel][base64String] = fileToHash;
             }
             GC.Collect();
             Log(LogSeverity.Info, $"{shortName}={base64String}");
         }
         if (newHashes)
         {
             SavePictureHashes();
         }
         Task.Delay(1000).Wait();
     }
 }
Example #32
0
 public void FillRectangle(Color Color, RectangleF Rectangle)
 {
     _editorSession.RenderTarget.FillRectangle(Convert(Rectangle), Convert(Color));
 }
Example #33
0
 public void DrawLine(Point Start, Point End, Color Color, float Width)
 {
     _editorSession.RenderTarget.DrawLine(Convert(Start), Convert(End), Convert(Color), Width);
 }
Example #34
0
        void InitPassiveBuffs()
        {
            #region Teleport
            PassiveBuffs.Add(
                new PassiveBuffs
            {
                ChampionName = "Teleport",
                BuffName     = "Teleport",
                Color        = Color.Bisque
            });
            #endregion Zhonya

            #region Zhonya
            PassiveBuffs.Add(
                new PassiveBuffs
            {
                ChampionName = "Zhonya",
                BuffName     = "Zhonyas Ring",
                Color        = Color.Bisque
            });
            #endregion Zhonya

            #region Aatrox
            PassiveBuffs.Add(
                new PassiveBuffs
            {
                ChampionName = "Aatrox",
                BuffName     = "AatroxWONHLifeBuff",
                Color        = Color.FromArgb(85, 4, 144)
            });

            PassiveBuffs.Add(
                new PassiveBuffs
            {
                ChampionName = "Aatrox",
                BuffName     = "AatroxPassiveActivate",
                Color        = Color.FromArgb(85, 4, 144)
            });
            #endregion Aatrox

            #region Anivia
            PassiveBuffs.Add(
                new PassiveBuffs
            {
                ChampionName = "Anivia Passive",
                BuffName     = "Rebirth",
                Color        = Color.FromArgb(85, 4, 144)
            });

            PassiveBuffs.Add(
                new PassiveBuffs
            {
                ChampionName = "Anivia",
                BuffName     = "RebirthCooldown",
                Color        = Color.FromArgb(85, 4, 144)
            });
            #endregion Anivia

            #region Volibear

            PassiveBuffs.Add(
                new PassiveBuffs
            {
                ChampionName = "Volibear",
                BuffName     = "VolibearPassiveCD",
                Color        = Color.Red
            });
            #endregion Volibear

            #region Zac
            PassiveBuffs.Add(
                new PassiveBuffs
            {
                ChampionName = "Zac",
                BuffName     = "ZacRebirthCooldown",
                Color        = Color.FromArgb(85, 4, 144)
            });

            PassiveBuffs.Add(
                new PassiveBuffs
            {
                ChampionName = "Zac",
                BuffName     = "zacrebirthstart",
                Color        = Color.FromArgb(85, 4, 144)
            });
            #endregion Anivia
        }
Example #35
0
        private void DrawingOnOnDraw(EventArgs args)
        {
            if (!Modes.ModeDraw.MenuLocal.Item("Draw.Enable").GetValue <bool>())
            {
                return;
            }

            foreach (var hero in HeroManager.AllHeroes)
            {
                var passiveBuffs = (from b in hero.Buffs join b1 in PassiveBuffs on b.DisplayName equals b1.BuffName select new { b, b1 }).Distinct();
                foreach (var buffName in passiveBuffs)
                {
                    for (int i = 0; i < passiveBuffs.Count(); i++)
                    {
                        if (buffName.b.EndTime >= Game.Time)
                        {
                            CommonGeometry.DrawBox(new Vector2(hero.HPBarPosition.X + 10, (i * 8) + hero.HPBarPosition.Y + 32), 130, 6, Color.FromArgb(100, 255, 200, 37), 1, Color.Black);

                            var buffTime = buffName.b.EndTime - buffName.b.StartTime;
                            CommonGeometry.DrawBox(new Vector2(hero.HPBarPosition.X + 11, (i * 8) + hero.HPBarPosition.Y + 33), (130 / buffTime) * (buffName.b.EndTime - Game.Time), 4, buffName.b1.Color, 1, buffName.b1.Color);

                            TimeSpan timeSpan = TimeSpan.FromSeconds(buffName.b.EndTime - Game.Time);
                            var      timer    = $"{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2}";
                            CommonGeometry.DrawText(CommonGeometry.TextPassive, timer, hero.HPBarPosition.X + 142, (i * 8) + hero.HPBarPosition.Y + 29, SharpDX.Color.Wheat);
                        }
                    }
                }

                var jungleBuffs = (from b in hero.Buffs join b1 in JungleBuffs on b.DisplayName equals b1.BuffName select new { b, b1 }).Distinct();
                foreach (var buffName in jungleBuffs.ToList())
                {
                    var circle1 = new CommonGeometry.Circle2(new Vector2(hero.Position.X + 3, hero.Position.Y - 3), 140 + (buffName.b1.Number * 20), Game.Time - buffName.b.StartTime, buffName.b.EndTime - buffName.b.StartTime).ToPolygon();
                    circle1.Draw(Color.Black, 3);

                    var circle = new CommonGeometry.Circle2(hero.Position.To2D(), 140 + (buffName.b1.Number * 20), Game.Time - buffName.b.StartTime, buffName.b.EndTime - buffName.b.StartTime).ToPolygon();
                    circle.Draw(buffName.b1.Color, 3);
                }
            }
        }
Example #36
0
        /// <summary>
        /// Analizes all frames (from the end to the start) and paints all unchanged pixels with a given color,
        /// after, it cuts the image to reduce filesize.
        /// </summary>
        /// <param name="listToEncode">The list of frames to analize.</param>
        /// <param name="transparent">The color to paint the unchanged pixels.</param>
        /// <param name="id">The Id of the current Task.</param>
        /// <param name="tokenSource">The cancelation token source.</param>
        /// <returns>A List contaning all frames and its cut points</returns>
        public static List <FrameInfo> PaintTransparentAndCut(List <FrameInfo> listToEncode, Color transparent, int id, CancellationTokenSource tokenSource)
        {
            //First frame rect.
            var size = listToEncode[0].Path.ScaledSize();

            listToEncode[0].Rect = new Int32Rect(0, 0, (int)size.Width, (int)size.Height);

            //End to start FOR
            for (var index = listToEncode.Count - 1; index > 0; index--)
            {
                #region Cancellation

                if (tokenSource.Token.IsCancellationRequested)
                {
                    Windows.Other.Encoder.SetStatus(Status.Canceled, id);

                    break;
                }

                #endregion

                #region For each Frame, from the end to the start

                Windows.Other.Encoder.Update(id, listToEncode.Count - index - 1);

                //First frame is ignored.
                if (index <= 0)
                {
                    continue;
                }

                #region Get Image Info

                var imageAux1 = listToEncode[index - 1].Path.From();
                var imageAux2 = listToEncode[index].Path.From();

                var startY = new bool[imageAux1.Height];
                var startX = new bool[imageAux1.Width];

                var image1 = new PixelUtilOld(imageAux1); //Previous image
                var image2 = new PixelUtilOld(imageAux2); //Actual image

                image1.LockBits();
                image2.LockBits();

                var height = imageAux1.Height;
                var width  = imageAux1.Width;

                #endregion

                //Only use Parallel if the image is big enough.
                if (width * height > 150000)
                {
                    #region Parallel Loop

                    //x - width - sides
                    Parallel.For(0, width, x =>
                    {
                        //y - height - up/down
                        for (var y = 0; y < height; y++)
                        {
                            var pixel2 = image2.GetPixel(x, y);

                            if (image1.GetPixel(x, y) == pixel2 || pixel2.A == 0)
                            {
                                image2.SetPixel(x, y, transparent);
                            }
                            else
                            {
                                #region Get the Changed Pixels

                                startX[x] = true;
                                startY[y] = true;

                                #endregion
                            }
                        }
                    }); //SPEEEEEED, alot!

                    #endregion
                }
                else
                {
                    #region Sequential Loop

                    //x - width - sides
                    for (var x = 0; x < width; x++)
                    {
                        //y - height - up/down
                        for (var y = 0; y < height; y++)
                        {
                            #region For each Pixel

                            var pixel2 = image2.GetPixel(x, y);

                            if (image1.GetPixel(x, y) == pixel2 || pixel2.A == 0)
                            {
                                image2.SetPixel(x, y, transparent);
                            }
                            else
                            {
                                #region Get the Changed Pixels

                                startX[x] = true;
                                startY[y] = true;

                                #endregion
                            }

                            #endregion
                        }
                    }

                    #endregion
                }

                image1.UnlockBits();
                image2.UnlockBits();

                #region Verify positions

                var firstX = startX.ToList().FindIndex(x => x);
                var lastX  = startX.ToList().FindLastIndex(x => x);

                if (firstX == -1)
                {
                    firstX = 0;
                }
                if (lastX == -1)
                {
                    lastX = imageAux1.Width;
                }

                var firstY = startY.ToList().FindIndex(x => x);
                var lastY  = startY.ToList().FindLastIndex(x => x);

                if (lastY == -1)
                {
                    lastY = imageAux1.Height;
                }
                if (firstY == -1)
                {
                    firstY = 0;
                }

                if (lastX < firstX)
                {
                    var aux = lastX;
                    lastX  = firstX;
                    firstX = aux;
                }

                if (lastY < firstY)
                {
                    var aux = lastY;
                    lastY  = firstY;
                    firstY = aux;
                }

                #endregion

                #region Get the Width and Height

                var heightCut = Math.Abs(lastY - firstY);
                var widthCut  = Math.Abs(lastX - firstX);

                //If nothing changed, shift the delay.
                if (heightCut + widthCut == height + width)
                {
                    //TODO: Maximum of 2 bytes, 255 x 100: 25.500 ms
                    listToEncode[index - 1].Delay += listToEncode[index].Delay;
                    listToEncode[index].Rect       = new Int32Rect(0, 0, 0, 0);

                    GC.Collect(1);
                    continue;
                }

                if (heightCut != height)
                {
                    heightCut++;
                }

                if (widthCut != width)
                {
                    widthCut++;
                }

                listToEncode[index].Rect = new Int32Rect(firstX, firstY, widthCut, heightCut);

                #endregion

                #region Update Image

                //Cut the images and get the new values.
                var imageSave2 = new Bitmap(imageAux2.Clone(new Rectangle(firstX, firstY, widthCut, heightCut), imageAux2.PixelFormat));

                imageAux2.Dispose();
                imageAux1.Dispose();

                imageSave2.Save(listToEncode[index].Path);

                #endregion

                GC.Collect(1);

                #endregion
            }

            return(listToEncode);
        }
Example #37
0
        private static void Drawing_OnDraw(EventArgs args)
        {
            if (getCheckBoxItem(drawMenu, "Show.JungleBuffs"))
            {
                foreach (var hero in HeroManager.AllHeroes)
                {
                    var jungleBuffs =
                        (from b in hero.Buffs
                         join b1 in CommonBuffManager.JungleBuffs on b.DisplayName equals b1.BuffName
                         select new { b, b1 }).Distinct();

                    foreach (var buffName in jungleBuffs.ToList())
                    {
                        var circle1 =
                            new CommonGeometry.Circle2(new Vector2(hero.Position.X + 3, hero.Position.Y - 3),
                                                       140 + (buffName.b1.Number * 20),
                                                       Game.Time - buffName.b.StartTime, buffName.b.EndTime - buffName.b.StartTime).ToPolygon();
                        circle1.Draw(Color.Black, 3);

                        var circle =
                            new CommonGeometry.Circle2(hero.Position.LSTo2D(), 140 + (buffName.b1.Number * 20),
                                                       Game.Time - buffName.b.StartTime, buffName.b.EndTime - buffName.b.StartTime).ToPolygon();
                        circle.Draw(buffName.b1.Color, 3);
                    }
                }
            }

            if (getCheckBoxItem(comboMenu, "ComboShowInfo"))
            {
                var xComboStr = "Combo Mode: ";
                System.Drawing.Color color = Color.FromArgb(100, 255, 200, 37);

                var xCombo = getBoxItem(comboMenu, "ComboMode");
                switch (xCombo)
                {
                case 0:
                    xComboStr += "Auto";
                    color      = Color.FromArgb(100, 255, 200, 37);
                    break;

                case 1:     //Q-R
                    xComboStr += "Q - R";
                    color      = Color.FromArgb(100, 4, 0, 255);
                    break;

                case 2:     //W-R
                    xComboStr += "W - R";
                    color      = Color.FromArgb(100, 255, 0, 0);
                    break;

                case 3:     //E-R
                    xComboStr += "E - R";
                    color      = Color.FromArgb(100, 0, 255, 8);
                    break;
                }

                Common.CommonGeometry.DrawText(CommonGeometry.Text, xComboStr, ObjectManager.Player.HPBarPosition.X + 150, ObjectManager.Player.HPBarPosition.Y + 75, SharpDX.Color.Wheat);
            }

            //if (Config.Item("HarassShowInfo"))
            //{
            //    var xHarassInfo = "";
            //    if (Config.Item("HarassUseTQ").GetValue<KeyBind>().Active)
            //        xHarassInfo += "Q - ";

            //    if (Config.Item("HarassUseTW").GetValue<KeyBind>().Active)
            //        xHarassInfo += "W - ";

            //    if (Config.Item("HarassUseTE").GetValue<KeyBind>().Active)
            //        xHarassInfo += "E - ";
            //    if (xHarassInfo.Length < 1)
            //    {
            //        xHarassInfo = "Harass Toggle: OFF   ";
            //    }
            //    else
            //    {
            //        xHarassInfo = "Harass Toggle: " + xHarassInfo;
            //    }
            //    xHarassInfo = xHarassInfo.Substring(0, xHarassInfo.Length - 3);
            //    //Drawing.DrawText(Drawing.Width * 0.44f, Drawing.Height * 0.82f, Color.Wheat, xHarassInfo);

            //    //Common.CommonGeometry.DrawBox(new Vector2((int)ObjectManager.Player.HPBarPosition.X + 145, (int)ObjectManager.Player.HPBarPosition.Y + 15), 125, 18, Color.FromArgb(100, 255, 200, 37), 1, Color.Black);
            //    //Common.CommonGeometry.DrawText(CommonGeometry.Text, xHarassInfo, ObjectManager.Player.HPBarPosition.X + 150, ObjectManager.Player.HPBarPosition.Y + 17, SharpDX.Color.Wheat);

            //}

            foreach (var spell in SpellList)
            {
                var menuItem = getCheckBoxItem(drawMenu, spell.Slot + "Range");
                if (menuItem && spell.Level > 0)
                {
                    Render.Circle.DrawCircle(ObjectManager.Player.Position, spell.Range, Color.Honeydew,
                                             spell.IsReady() ? 5 : 1);
                }
            }

            var wqRange = getCheckBoxItem(drawMenu, "WQRange");

            if (wqRange && Q.IsReady() && W.IsReady())
            {
                Render.Circle.DrawCircle(ObjectManager.Player.Position, W.Range + Q.Range, Color.Honeydew, Q.IsReady() && W.IsReady() ? 5 : 1);
            }

            var activeERange = getCheckBoxItem(drawMenu, "ActiveERange");

            if (activeERange && EnemyHaveSoulShackle != null)
            {
                Render.Circle.DrawCircle(ObjectManager.Player.Position, 1100f, Color.Honeydew);
            }

            /*
             * var wObjPosition = Config.Item("WObjPosition");
             * var wObjTimeTick = Config.Item("WObjTimeTick");
             *
             * foreach (var existingSlide in ExistingSlide)
             * {
             *  if (wObjPosition.Active)
             *      Render.Circle.DrawCircle(existingSlide.Position, 110f, wObjPosition.Color);
             *
             *  if (!wObjTimeTick) continue;
             *  if (!(existingSlide.ExpireTime > Game.Time)) continue;
             *
             *  var time = TimeSpan.FromSeconds(existingSlide.ExpireTime - Game.Time);
             *  var pos = Drawing.WorldToScreen(existingSlide.Position);
             *  var display = string.Format("{0}:{1:D2}", time.Minutes, time.Seconds);
             *  Drawing.DrawText(pos.X - display.Length * 3, pos.Y - 65, Color.GreenYellow, display);
             * }
             *
             * foreach (
             *  var enemy in
             *      ObjectManager.Get<AIHeroClient>()
             *          .Where(
             *              enemy =>
             *                  enemy.IsEnemy && !enemy.IsDead && enemy.IsVisible &&
             *                  ObjectManager.Player.LSDistance(enemy) < E.Range + 1400 &&
             *                  !xEnemyHaveSoulShackle(enemy)))
             * {
             *  Render.Circle.DrawCircle(enemy.Position, 75f, Color.GreenYellow);
             * }
             */
        }
Example #38
0
 public void SetModulateColor(sd.Color color)
 {
     Flush();
     CurrPipeline["uModulateColor"].Set(new Vector4(color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, color.A / 255.0f));
 }
Example #39
0
        public static Bitmap ToDebugBitmap(this ImageData imgData, float scale = 50.0f, List <Unit> units = null, ToDebugBitmapOption options = null)
        {
            if (options == null)
            {
                options = new ToDebugBitmapOption();
            }
            //Font drawFont = new Font("Arial", 10);
            Pen      pen = new Pen(System.Drawing.Color.Yellow, 1);
            Bitmap   bv  = new Bitmap((int)(imgData.Size.X * scale), (int)(imgData.Size.Y * scale), PixelFormat.Format32bppArgb);
            Graphics g   = Graphics.FromImage(bv);

            g.Clear(System.Drawing.Color.Black);
            for (int x = 0; x < imgData.Size.X; x++)
            {
                for (int y = 0; y < imgData.Size.Y; y++)
                {
                    byte value = imgData.GetValue(x, y);
                    if (options.flgColor)
                    {
                        System.Drawing.Color color = System.Drawing.Color.FromArgb(value, value, value);
                        switch (value)
                        {
                        case 127: color = System.Drawing.Color.Black; break;

                        case 134: color = System.Drawing.Color.Orange; break;

                        case 135: color = System.Drawing.Color.Cyan; break;

                        case 143: color = System.Drawing.Color.LightGray; break;

                        case 142: color = System.Drawing.Color.Green; break;

                        case 141: color = System.Drawing.Color.Lime; break;

                        case 140: color = System.Drawing.Color.Gray; break;
                        }
                        g.FillRectangle(new SolidBrush(color), new Rectangle((int)Math.Round(x * scale), (int)Math.Round(y * scale), (int)Math.Round(scale), (int)Math.Round(scale)));
                    }
                    if (options.flgDrawValue)
                    {
                        g.DrawString("" + value, drawFont, drawBrushYellow, new PointF((float)(x) * scale, (float)(y + 0.5) * scale));
                    }
                    if (options.flgDrawGridPos)
                    {
                        g.DrawString(String.Format("{0},{1}", x, imgData.Size.Y - y), drawFont, drawBrushWhite, new PointF((float)(x) * scale, (float)(y) * scale));
                    }
                }
            }
            if (options.flgDrawGrid)
            {
                for (int x = 0; x < imgData.Size.X; x++)
                {
                    int px = (int)(x * scale);
                    g.DrawLine(pen, px, 0, px, bv.Height);
                }
                for (int y = 0; y < imgData.Size.Y; y++)
                {
                    int py = (int)(y * scale);
                    g.DrawLine(pen, 0, py, bv.Width, py);
                }
            }
            if (units != null)
            {
                DrawUnits(g, imgData.Size.Y, scale, units, options);
            }
            g.Save();
            g.Dispose();
            return(bv);
        }
Example #40
0
 public void EhView_ColorChanged(System.Drawing.Color color)
 {
     _color = color;
 }
Example #41
0
        /// <summary>
        ///     Fired when the scene is completely rendered.
        /// </summary>
        /// <param name="args">The <see cref="EventArgs" /> instance containing the event data.</param>
        private void Drawing_OnEndScene(EventArgs args)
        {
            if (!getCheckBoxItem(this.Menu, "DrawHealth_"))
            {
                return;
            }

            float i = 0;

            foreach (var hero in HeroManager.Enemies.Where(x => !x.IsDead))
            {
                var champion = hero.ChampionName;
                if (champion.Length > 12)
                {
                    champion = champion.Remove(7) + "...";
                }


                var championInfo = getCheckBoxItem(this.Menu, "DrawHealth_percent")
                    ? champion + " (" + (int)hero.HealthPercent + "%)"
                    : champion;

                // Draws the championnames
                Font.DrawText(
                    null,
                    championInfo,
                    (int)
                    ((Drawing.Width - this.HudOffsetRight - this.HudOffsetText - Font.MeasureText(null, championInfo, FontDrawFlags.Left).Width)),
                    (int)(this.HudOffsetTop + i + 4 - Font.MeasureText(null, championInfo, FontDrawFlags.Left).Height / 2f),
                    hero.HealthPercent > 0 ? new ColorBGRA(255, 255, 255, 255) : new ColorBGRA(244, 8, 8, 255));

                // Draws the rectangle
                this.DrawRect(
                    Drawing.Width - this.HudOffsetRight,
                    this.HudOffsetTop + i,
                    100,
                    this.BarHeight,
                    1,
                    Color.FromArgb(255, 51, 55, 51));

                // Fils the rectangle
                this.DrawRect(
                    Drawing.Width - this.HudOffsetRight,
                    this.HudOffsetTop + i,
                    hero.HealthPercent <= 0 ? 100 : (int)(hero.HealthPercent),
                    this.BarHeight,
                    1,
                    hero.HealthPercent < 30 && hero.HealthPercent > 0 ? Color.FromArgb(255, 230, 169, 14) : hero.HealthPercent <= 0 ? Color.FromArgb(255, 206, 20, 30) : Color.FromArgb(255, 29, 201, 38));

                i += 20f + this.HudSpacing;
            }
        }
Example #42
0
 public void FormattingExcelCells(Microsoft.Office.Interop.Excel.Range range, string HTMLcolorCode, System.Drawing.Color fontColor, bool IsFontbool)
 {
     range.Interior.Color = System.Drawing.ColorTranslator.FromHtml(HTMLcolorCode);
     range.Font.Color     = System.Drawing.ColorTranslator.ToOle(fontColor);
     if (IsFontbool == true)
     {
         range.Font.Bold = IsFontbool;
     }
 }
Example #43
0
 public static void SetSystemColor(System.Drawing.Color color)
 {
     ColorizationColor = color;
 }
Example #44
0
 /// <summary>
 ///     Draws a rectangle
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="width"></param>
 /// <param name="height"></param>
 /// <param name="thickness"></param>
 /// <param name="color"></param>
 private void DrawRect(float x, float y, int width, float height, float thickness, Color color)
 {
     for (var i = 0; i < height; i++)
     {
         Drawing.DrawLine(x, y + i, x + width, y + i, thickness, color);
     }
 }
        private void PopulateTableRows(MemObjStatisticalCollection aCollection)
        {
            // Clear existing content
            iGrid.BeginUpdate();
            iGrid.TableModel.Rows.Clear();
            iGrid.Tag = aCollection;

            // Make new content
            int count = aCollection.Count;

            for (int i = 0; i < count; i++)
            {
                // The entry we are rendering
                MemOpBase baseObject = aCollection[i];

                // Only initialised if we are dealing with an allocation (or realloc) type cell.
                MemOpAllocation memObj = null;

                // The color format for the entire row.
                System.Drawing.Color rowColor = Color.Black;

                // The row we are creating
                XPTable.Models.Row row = new XPTable.Models.Row();

                // Set tag for the row
                row.Tag = baseObject;

                // Common items
                // ============
                XPTable.Models.Cell opIndexCell = new XPTable.Models.Cell(baseObject.OperationIndex.ToString("d6"));
                row.Cells.Add(opIndexCell);
                XPTable.Models.Cell lineNumberCell = new XPTable.Models.Cell(baseObject.LineNumber.ToString("d6"));
                row.Cells.Add(lineNumberCell);
                XPTable.Models.Cell cellAddressCell = new XPTable.Models.Cell(baseObject.CellAddress.ToString("x8"));
                row.Cells.Add(cellAddressCell);
                XPTable.Models.Cell functionCell = new XPTable.Models.Cell(" " + baseObject.FunctionName);
                row.Cells.Add(functionCell);

                // Row Color & Object Association
                // ==============================
                if (baseObject is MemOpAllocation)
                {
                    // Allocation
                    memObj   = (MemOpAllocation)baseObject;
                    rowColor = Color.Blue;
                }
                else if (baseObject is MemOpFree)
                {
                    // Deallocation
                    if (baseObject.Link != null)
                    {
                        memObj = (MemOpAllocation)baseObject.Link;
                    }
                    else
                    {
                        memObj = null;
                    }
                    rowColor = Color.Green;
                }
                else if (baseObject is MemOpReallocation)
                {
                    // Reallocation
                    if (baseObject.Link != null)
                    {
                        memObj = (MemOpAllocation)baseObject.Link;
                    }
                    else
                    {
                        memObj = null;
                    }
                    rowColor = Color.Purple;
                }

                // Allocation size
                // ===============
                string allocationSize = "???";
                if (memObj != null)
                {
                    allocationSize = memObj.AllocationSize.ToString();
                }
                row.Cells.Add(new XPTable.Models.Cell(allocationSize + "  "));

                // Heap size
                // =========
                row.Cells.Add(new XPTable.Models.Cell(baseObject.HeapSize.ToString() + "  "));

                // Associated object
                // =================
                MemOpAllocation symbolObject = memObj;
                if (memObj != null && baseObject.Link != null)
                {
                    // If we have an associated link item, we can connect the two items together
                    string associatedText = string.Empty;
                    if (baseObject.IsAllocationType)
                    {
                        associatedText = "Free'd by op #:  " + baseObject.Link.OperationIndex.ToString("d5");
                    }
                    else if (baseObject.IsReallocationType)
                    {
                        associatedText = "First alloc'd by op #: " + baseObject.Link.OperationIndex.ToString("d5");
                        symbolObject   = (baseObject.Link as MemOpAllocation);
                    }
                    else
                    {
                        associatedText = "Alloc'd by op #: " + baseObject.Link.OperationIndex.ToString("d5");
                    }

                    // We store the object with the cell so that we can handle hyperlinks between
                    // associated objects.
                    XPTable.Models.Cell associatedCell = new XPTable.Models.Cell(associatedText);
                    associatedCell.Tag = baseObject;

                    // Make it look like a hyperlink
                    associatedCell.Font = new Font(iGrid.Font.FontFamily.Name, iGrid.Font.SizeInPoints, System.Drawing.FontStyle.Underline);

                    // Add the cell to the row
                    row.Cells.Add(associatedCell);
                }
                else
                {
                    if (baseObject.IsAllocationType)
                    {
                        if (memObj != null)
                        {
                            symbolObject = memObj;
                        }

                        rowColor = Color.Red;
                        row.Font = new System.Drawing.Font(iGrid.Font.FontFamily.Name, iGrid.Font.SizeInPoints, System.Drawing.FontStyle.Regular);
                        row.Cells.Add(new XPTable.Models.Cell("Object never free'd!"));
                    }
                    else
                    {
                        row.Cells.Add(new XPTable.Models.Cell("???!"));
                    }
                }

                // Set row color
                // =============
                row.ForeColor = rowColor;

                // Add row
                // =======
                iGrid.TableModel.Rows.Add(row);

                // Event handling
                // ==============
                if (i % 100 != 0)
                {
                    Application.DoEvents();
                }
                lock (this)
                {
                    if (iStopPopulatingGrid)
                    {
                        break;
                    }
                }
            }

            // If no items, then dim table
            iGrid.Enabled = (count > 0);
            iGrid.EndUpdate();
        }
Example #46
0
 public void SetPixel(int x, int y, Color c)
 {
     backingImage.SetPixel(x, y, c);
 }
Example #47
0
        public static void DrawBox(Vector2 position, int width, int height, System.Drawing.Color color, int borderwidth, System.Drawing.Color borderColor)
        {
            Drawing.DrawLine(position.X, position.Y, position.X + width, position.Y, height, color);

            if (borderwidth > 0)
            {
                Drawing.DrawLine(position.X, position.Y, position.X + width, position.Y, borderwidth, borderColor);
                Drawing.DrawLine(position.X, position.Y + height, position.X + width, position.Y + height, borderwidth, borderColor);
                Drawing.DrawLine(position.X, position.Y + 1, position.X, position.Y + height, borderwidth, borderColor);
                Drawing.DrawLine(position.X + width, position.Y + 1, position.X + width, position.Y + height, borderwidth, borderColor);
            }
        }
 internal static string RGBtoHex(System.Drawing.Color c)
 {
     return(string.Format("'{0}'", RGBtoHex(c.R, c.G, c.B)));
 }
Example #49
0
        public void t2D上下反転描画(Device device, int x, int y, float depth, Rectangle rc画像内の描画領域)
        {
            if (this.texture == null)
            {
                throw new InvalidOperationException("テクスチャは生成されていません。");
            }

            if (this.texture.Device.NativePointer != device.NativePointer)
            {
                ReuseTexture(device);
            }

            this.tレンダリングステートの設定(device);

            float fx   = x * CTexture.f画面比率 + CTexture.rc物理画面描画領域.X - 0.5f;             // -0.5 は座標とピクセルの誤差を吸収するための座標補正値。(MSDN参照)
            float fy   = y * CTexture.f画面比率 + CTexture.rc物理画面描画領域.Y - 0.5f;             //
            float w    = rc画像内の描画領域.Width * this.vc拡大縮小倍率.X * CTexture.f画面比率;
            float h    = rc画像内の描画領域.Height * this.vc拡大縮小倍率.Y * CTexture.f画面比率;
            float f左U値 = ((float)rc画像内の描画領域.Left) / ((float)this.szテクスチャサイズ.Width);
            float f右U値 = ((float)rc画像内の描画領域.Right) / ((float)this.szテクスチャサイズ.Width);
            float f上V値 = ((float)rc画像内の描画領域.Top) / ((float)this.szテクスチャサイズ.Height);
            float f下V値 = ((float)rc画像内の描画領域.Bottom) / ((float)this.szテクスチャサイズ.Height);

            this.color = Color.FromArgb(this._opacity, this.color.R, this.color.G, this.color.B);
            int color = this.color.ToArgb();

            if (this.cvTransformedColoredVertexies == null)
            {
                this.cvTransformedColoredVertexies = new TransformedColoredTexturedVertex[4];
            }

            // 以下、マネージドオブジェクトの量産を抑えるため new は使わない。

            this.cvTransformedColoredVertexies[0].TextureCoordinates.X = f左U値;              // 左上	→ 左下
            this.cvTransformedColoredVertexies[0].TextureCoordinates.Y = f下V値;
            this.cvTransformedColoredVertexies[0].Position.X           = fx;
            this.cvTransformedColoredVertexies[0].Position.Y           = fy;
            this.cvTransformedColoredVertexies[0].Position.Z           = depth;
            this.cvTransformedColoredVertexies[0].Position.W           = 1.0f;
            this.cvTransformedColoredVertexies[0].Color = color;

            this.cvTransformedColoredVertexies[1].TextureCoordinates.X = f右U値;              // 右上 → 右下
            this.cvTransformedColoredVertexies[1].TextureCoordinates.Y = f下V値;
            this.cvTransformedColoredVertexies[1].Position.X           = fx + w;
            this.cvTransformedColoredVertexies[1].Position.Y           = fy;
            this.cvTransformedColoredVertexies[1].Position.Z           = depth;
            this.cvTransformedColoredVertexies[1].Position.W           = 1.0f;
            this.cvTransformedColoredVertexies[1].Color = color;

            this.cvTransformedColoredVertexies[2].TextureCoordinates.X = f左U値;              // 左下 → 左上
            this.cvTransformedColoredVertexies[2].TextureCoordinates.Y = f上V値;
            this.cvTransformedColoredVertexies[2].Position.X           = fx;
            this.cvTransformedColoredVertexies[2].Position.Y           = fy + h;
            this.cvTransformedColoredVertexies[2].Position.Z           = depth;
            this.cvTransformedColoredVertexies[2].Position.W           = 1.0f;
            this.cvTransformedColoredVertexies[2].Color = color;

            this.cvTransformedColoredVertexies[3].TextureCoordinates.X = f右U値;              // 右下 → 右上
            this.cvTransformedColoredVertexies[3].TextureCoordinates.Y = f上V値;
            this.cvTransformedColoredVertexies[3].Position.X           = fx + w;
            this.cvTransformedColoredVertexies[3].Position.Y           = fy + h;
            this.cvTransformedColoredVertexies[3].Position.Z           = depth;
            this.cvTransformedColoredVertexies[3].Position.W           = 1.0f;
            this.cvTransformedColoredVertexies[3].Color = color;

            device.SetTexture(0, this.texture);
            device.VertexFormat = TransformedColoredTexturedVertex.Format;
            device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, this.cvTransformedColoredVertexies);
        }
Example #50
0
 private void UpdateStatusText(string text, bool clearscreen, System.Drawing.Color color) => this.UpdateStatusText(this.textFlow, text, this.font, clearscreen, color);
Example #51
0
        public void t2D描画(Device device, float x, float y, float depth, Rectangle rc画像内の描画領域)
        {
            if (this.texture == null)
            {
                return;
            }

            if (this.texture.Device.NativePointer != device.NativePointer)
            {
                ReuseTexture(device);
            }

            this.tレンダリングステートの設定(device);

            if (this.fZ軸中心回転 == 0f)
            {
                #region [ (A) 回転なし ]
                //-----------------
                float f補正値X = -0.5f;                    // -0.5 は座標とピクセルの誤差を吸収するための座標補正値。(MSDN参照)
                float f補正値Y = -0.5f;                    //
                float w     = rc画像内の描画領域.Width;
                float h     = rc画像内の描画領域.Height;
                float f左U値  = ((float)rc画像内の描画領域.Left) / ((float)this.szテクスチャサイズ.Width);
                float f右U値  = ((float)rc画像内の描画領域.Right) / ((float)this.szテクスチャサイズ.Width);
                float f上V値  = ((float)rc画像内の描画領域.Top) / ((float)this.szテクスチャサイズ.Height);
                float f下V値  = ((float)rc画像内の描画領域.Bottom) / ((float)this.szテクスチャサイズ.Height);

                this.color = Color.FromArgb(this._opacity, this.color.R, this.color.G, this.color.B);
                int color = this.color.ToArgb();

                if (this.cvTransformedColoredVertexies == null)
                {
                    this.cvTransformedColoredVertexies = new TransformedColoredTexturedVertex[4];
                }

                // #27122 2012.1.13 from: 以下、マネージドオブジェクト(=ガベージ)の量産を抑えるため、new は使わず、メンバに値を1つずつ直接上書きする。

                this.cvTransformedColoredVertexies[0].Position.X           = x + f補正値X;
                this.cvTransformedColoredVertexies[0].Position.Y           = y + f補正値Y;
                this.cvTransformedColoredVertexies[0].Position.Z           = depth;
                this.cvTransformedColoredVertexies[0].Position.W           = 1.0f;
                this.cvTransformedColoredVertexies[0].Color                = color;
                this.cvTransformedColoredVertexies[0].TextureCoordinates.X = f左U値;
                this.cvTransformedColoredVertexies[0].TextureCoordinates.Y = f上V値;

                this.cvTransformedColoredVertexies[1].Position.X           = (x + (w * this.vc拡大縮小倍率.X)) + f補正値X;
                this.cvTransformedColoredVertexies[1].Position.Y           = y + f補正値Y;
                this.cvTransformedColoredVertexies[1].Position.Z           = depth;
                this.cvTransformedColoredVertexies[1].Position.W           = 1.0f;
                this.cvTransformedColoredVertexies[1].Color                = color;
                this.cvTransformedColoredVertexies[1].TextureCoordinates.X = f右U値;
                this.cvTransformedColoredVertexies[1].TextureCoordinates.Y = f上V値;

                this.cvTransformedColoredVertexies[2].Position.X           = x + f補正値X;
                this.cvTransformedColoredVertexies[2].Position.Y           = (y + (h * this.vc拡大縮小倍率.Y)) + f補正値Y;
                this.cvTransformedColoredVertexies[2].Position.Z           = depth;
                this.cvTransformedColoredVertexies[2].Position.W           = 1.0f;
                this.cvTransformedColoredVertexies[2].Color                = color;
                this.cvTransformedColoredVertexies[2].TextureCoordinates.X = f左U値;
                this.cvTransformedColoredVertexies[2].TextureCoordinates.Y = f下V値;

                this.cvTransformedColoredVertexies[3].Position.X           = (x + (w * this.vc拡大縮小倍率.X)) + f補正値X;
                this.cvTransformedColoredVertexies[3].Position.Y           = (y + (h * this.vc拡大縮小倍率.Y)) + f補正値Y;
                this.cvTransformedColoredVertexies[3].Position.Z           = depth;
                this.cvTransformedColoredVertexies[3].Position.W           = 1.0f;
                this.cvTransformedColoredVertexies[3].Color                = color;
                this.cvTransformedColoredVertexies[3].TextureCoordinates.X = f右U値;
                this.cvTransformedColoredVertexies[3].TextureCoordinates.Y = f下V値;

                device.SetTexture(0, this.texture);
                device.VertexFormat = TransformedColoredTexturedVertex.Format;
                device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 0, 2, this.cvTransformedColoredVertexies);

                //-----------------
                #endregion
            }
            else
            {
                #region [ (B) 回転あり ]
                //-----------------
                float f補正値X = ((rc画像内の描画領域.Width % 2) == 0) ? -0.5f : 0f;                   // -0.5 は座標とピクセルの誤差を吸収するための座標補正値。(MSDN参照)
                float f補正値Y = ((rc画像内の描画領域.Height % 2) == 0) ? -0.5f : 0f;                  // 3D(回転する)なら補正はいらない。
                float f中央X  = ((float)rc画像内の描画領域.Width) / 2f;
                float f中央Y  = ((float)rc画像内の描画領域.Height) / 2f;
                float f左U値  = ((float)rc画像内の描画領域.Left) / ((float)this.szテクスチャサイズ.Width);
                float f右U値  = ((float)rc画像内の描画領域.Right) / ((float)this.szテクスチャサイズ.Width);
                float f上V値  = ((float)rc画像内の描画領域.Top) / ((float)this.szテクスチャサイズ.Height);
                float f下V値  = ((float)rc画像内の描画領域.Bottom) / ((float)this.szテクスチャサイズ.Height);

                this.color = Color.FromArgb(this._opacity, this.color.R, this.color.G, this.color.B);
                int color = this.color.ToArgb();

                if (this.cvPositionColoredVertexies == null)
                {
                    this.cvPositionColoredVertexies = new PositionColoredTexturedVertex[4];
                }

                // #27122 2012.1.13 from: 以下、マネージドオブジェクト(=ガベージ)の量産を抑えるため、new は使わず、メンバに値を1つずつ直接上書きする。

                this.cvPositionColoredVertexies[0].Position.X           = -f中央X + f補正値X;
                this.cvPositionColoredVertexies[0].Position.Y           = f中央Y + f補正値Y;
                this.cvPositionColoredVertexies[0].Position.Z           = depth;
                this.cvPositionColoredVertexies[0].Color                = color;
                this.cvPositionColoredVertexies[0].TextureCoordinates.X = f左U値;
                this.cvPositionColoredVertexies[0].TextureCoordinates.Y = f上V値;

                this.cvPositionColoredVertexies[1].Position.X           = f中央X + f補正値X;
                this.cvPositionColoredVertexies[1].Position.Y           = f中央Y + f補正値Y;
                this.cvPositionColoredVertexies[1].Position.Z           = depth;
                this.cvPositionColoredVertexies[1].Color                = color;
                this.cvPositionColoredVertexies[1].TextureCoordinates.X = f右U値;
                this.cvPositionColoredVertexies[1].TextureCoordinates.Y = f上V値;

                this.cvPositionColoredVertexies[2].Position.X           = -f中央X + f補正値X;
                this.cvPositionColoredVertexies[2].Position.Y           = -f中央Y + f補正値Y;
                this.cvPositionColoredVertexies[2].Position.Z           = depth;
                this.cvPositionColoredVertexies[2].Color                = color;
                this.cvPositionColoredVertexies[2].TextureCoordinates.X = f左U値;
                this.cvPositionColoredVertexies[2].TextureCoordinates.Y = f下V値;

                this.cvPositionColoredVertexies[3].Position.X           = f中央X + f補正値X;
                this.cvPositionColoredVertexies[3].Position.Y           = -f中央Y + f補正値Y;
                this.cvPositionColoredVertexies[3].Position.Z           = depth;
                this.cvPositionColoredVertexies[3].Color                = color;
                this.cvPositionColoredVertexies[3].TextureCoordinates.X = f右U値;
                this.cvPositionColoredVertexies[3].TextureCoordinates.Y = f下V値;

                float n描画領域内X = x + (rc画像内の描画領域.Width / 2.0f);
                float n描画領域内Y = y + (rc画像内の描画領域.Height / 2.0f);
                var   vc3移動量  = new Vector3(n描画領域内X - (((float)device.Viewport.Width) / 2f), -(n描画領域内Y - (((float)device.Viewport.Height) / 2f)), 0f);

                this.vc.X = this.vc拡大縮小倍率.X;
                this.vc.Y = this.vc拡大縮小倍率.Y;
                this.vc.Z = this.vc拡大縮小倍率.Z;

                var matrix = Matrix.Identity * Matrix.Scaling(this.vc);
                matrix *= Matrix.RotationZ(this.fZ軸中心回転);
                matrix *= Matrix.Translation(vc3移動量);
                device.SetTransform(TransformState.World, matrix);

                device.SetTexture(0, this.texture);
                device.VertexFormat = PositionColoredTexturedVertex.Format;
                device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, this.cvPositionColoredVertexies);
                //-----------------
                #endregion
            }
        }
Example #52
0
        public void t3D描画(Device device, System.Numerics.Matrix4x4 mat, Rectangle rc画像内の描画領域)
        {
            if (this.texture == null)
            {
                return;
            }

            if (this.texture.Device.NativePointer != device.NativePointer)
            {
                ReuseTexture(device);
            }

            matrix.M11 = mat.M11;
            matrix.M12 = mat.M12;
            matrix.M13 = mat.M13;
            matrix.M14 = mat.M14;
            matrix.M21 = mat.M21;
            matrix.M22 = mat.M22;
            matrix.M23 = mat.M23;
            matrix.M24 = mat.M24;
            matrix.M31 = mat.M31;
            matrix.M32 = mat.M32;
            matrix.M33 = mat.M33;
            matrix.M34 = mat.M34;
            matrix.M41 = mat.M41;
            matrix.M42 = mat.M42;
            matrix.M43 = mat.M43;
            matrix.M44 = mat.M44;

            float x    = ((float)rc画像内の描画領域.Width) / 2f;
            float y    = ((float)rc画像内の描画領域.Height) / 2f;
            float z    = 0.0f;
            float f左U値 = ((float)rc画像内の描画領域.Left) / ((float)this.szテクスチャサイズ.Width);
            float f右U値 = ((float)rc画像内の描画領域.Right) / ((float)this.szテクスチャサイズ.Width);
            float f上V値 = ((float)rc画像内の描画領域.Top) / ((float)this.szテクスチャサイズ.Height);
            float f下V値 = ((float)rc画像内の描画領域.Bottom) / ((float)this.szテクスチャサイズ.Height);

            this.color = Color.FromArgb(this._opacity, this.color.R, this.color.G, this.color.B);
            int color = this.color.ToArgb();

            if (this.cvPositionColoredVertexies == null)
            {
                this.cvPositionColoredVertexies = new PositionColoredTexturedVertex[4];
            }

            // #27122 2012.1.13 from: 以下、マネージドオブジェクト(=ガベージ)の量産を抑えるため、new は使わず、メンバに値を1つずつ直接上書きする。

            this.cvPositionColoredVertexies[0].Position.X           = -x;
            this.cvPositionColoredVertexies[0].Position.Y           = y;
            this.cvPositionColoredVertexies[0].Position.Z           = z;
            this.cvPositionColoredVertexies[0].Color                = color;
            this.cvPositionColoredVertexies[0].TextureCoordinates.X = f左U値;
            this.cvPositionColoredVertexies[0].TextureCoordinates.Y = f上V値;

            this.cvPositionColoredVertexies[1].Position.X           = x;
            this.cvPositionColoredVertexies[1].Position.Y           = y;
            this.cvPositionColoredVertexies[1].Position.Z           = z;
            this.cvPositionColoredVertexies[1].Color                = color;
            this.cvPositionColoredVertexies[1].TextureCoordinates.X = f右U値;
            this.cvPositionColoredVertexies[1].TextureCoordinates.Y = f上V値;

            this.cvPositionColoredVertexies[2].Position.X           = -x;
            this.cvPositionColoredVertexies[2].Position.Y           = -y;
            this.cvPositionColoredVertexies[2].Position.Z           = z;
            this.cvPositionColoredVertexies[2].Color                = color;
            this.cvPositionColoredVertexies[2].TextureCoordinates.X = f左U値;
            this.cvPositionColoredVertexies[2].TextureCoordinates.Y = f下V値;

            this.cvPositionColoredVertexies[3].Position.X           = x;
            this.cvPositionColoredVertexies[3].Position.Y           = -y;
            this.cvPositionColoredVertexies[3].Position.Z           = z;
            this.cvPositionColoredVertexies[3].Color                = color;
            this.cvPositionColoredVertexies[3].TextureCoordinates.X = f右U値;
            this.cvPositionColoredVertexies[3].TextureCoordinates.Y = f下V値;

            this.tレンダリングステートの設定(device);

            device.SetTransform(TransformState.World, matrix);
            device.SetTexture(0, this.texture);
            device.VertexFormat = PositionColoredTexturedVertex.Format;
            device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, this.cvPositionColoredVertexies);
        }
 internal static string GetHexStringFromColor(DrawingColor c)
 {
     return("#" + c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2"));
 }
Example #54
0
        public void t2D幕用描画(Device device, float x, float y, Rectangle rc画像内の描画領域, bool left, int num = 0)
        {
            if (this.texture == null)
            {
                return;
            }

            if (this.texture.Device.NativePointer != device.NativePointer)
            {
                ReuseTexture(device);
            }

            this.tレンダリングステートの設定(device);

            #region [ (A) 回転なし ]
            //-----------------
            float f補正値X = -0.5f;                // -0.5 は座標とピクセルの誤差を吸収するための座標補正値。(MSDN参照)
            float f補正値Y = -0.5f;                //
            float w     = rc画像内の描画領域.Width;
            float h     = rc画像内の描画領域.Height;
            float f左U値  = ((float)rc画像内の描画領域.Left) / ((float)this.szテクスチャサイズ.Width);
            float f右U値  = ((float)rc画像内の描画領域.Right) / ((float)this.szテクスチャサイズ.Width);
            float f上V値  = ((float)rc画像内の描画領域.Top) / ((float)this.szテクスチャサイズ.Height);
            float f下V値  = ((float)rc画像内の描画領域.Bottom) / ((float)this.szテクスチャサイズ.Height);

            this.color = Color.FromArgb(this._opacity, this.color.R, this.color.G, this.color.B);
            int color = this.color.ToArgb();

            if (this.cvTransformedColoredVertexies == null)
            {
                this.cvTransformedColoredVertexies = new TransformedColoredTexturedVertex[4];
            }

            // #27122 2012.1.13 from: 以下、マネージドオブジェクト(=ガベージ)の量産を抑えるため、new は使わず、メンバに値を1つずつ直接上書きする。

            this.cvTransformedColoredVertexies[0].Position.X           = x + f補正値X;
            this.cvTransformedColoredVertexies[0].Position.Y           = y + f補正値Y;
            this.cvTransformedColoredVertexies[0].Position.Z           = 1.0f;
            this.cvTransformedColoredVertexies[0].Position.W           = 1.0f;
            this.cvTransformedColoredVertexies[0].Color                = color;
            this.cvTransformedColoredVertexies[0].TextureCoordinates.X = f左U値;
            this.cvTransformedColoredVertexies[0].TextureCoordinates.Y = f上V値;

            this.cvTransformedColoredVertexies[1].Position.X           = (x + (w * this.vc拡大縮小倍率.X)) + f補正値X;
            this.cvTransformedColoredVertexies[1].Position.Y           = y + f補正値Y;
            this.cvTransformedColoredVertexies[1].Position.Z           = 1.0f;
            this.cvTransformedColoredVertexies[1].Position.W           = 1.0f;
            this.cvTransformedColoredVertexies[1].Color                = color;
            this.cvTransformedColoredVertexies[1].TextureCoordinates.X = f右U値;
            this.cvTransformedColoredVertexies[1].TextureCoordinates.Y = f上V値;

            this.cvTransformedColoredVertexies[2].Position.X           = x + f補正値X + ((!left) ? num : 0);
            this.cvTransformedColoredVertexies[2].Position.Y           = (y + (h * this.vc拡大縮小倍率.Y)) + f補正値Y;
            this.cvTransformedColoredVertexies[2].Position.Z           = 1.0f;
            this.cvTransformedColoredVertexies[2].Position.W           = 1.0f;
            this.cvTransformedColoredVertexies[2].Color                = color;
            this.cvTransformedColoredVertexies[2].TextureCoordinates.X = f左U値;
            this.cvTransformedColoredVertexies[2].TextureCoordinates.Y = f下V値;

            this.cvTransformedColoredVertexies[3].Position.X           = (x + (w * this.vc拡大縮小倍率.X)) + f補正値X - ((left) ? num : 0);
            this.cvTransformedColoredVertexies[3].Position.Y           = (y + (h * this.vc拡大縮小倍率.Y)) + f補正値Y;
            this.cvTransformedColoredVertexies[3].Position.Z           = 1.0f;
            this.cvTransformedColoredVertexies[3].Position.W           = 1.0f;
            this.cvTransformedColoredVertexies[3].Color                = color;
            this.cvTransformedColoredVertexies[3].TextureCoordinates.X = f右U値;
            this.cvTransformedColoredVertexies[3].TextureCoordinates.Y = f下V値;

            device.SetTexture(0, this.texture);
            device.VertexFormat = TransformedColoredTexturedVertex.Format;
            device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 0, 2, this.cvTransformedColoredVertexies);

            //-----------------
            #endregion
        }
Example #55
0
 public static void AddOrUpdate(local.Point point, sys.Color color)
 {
     CoordsColorDictionary.AddOrUpdate(point, color, (key, value) => value = color);
 }
Example #56
0
        private void SetListItemParamObject(ParamEntry entry, ListViewItem item)
        {
            item.SubItems.Clear();
            item.Text = entry.HashString;
            item.Tag  = entry;
            item.UseItemStyleForSubItems = false;
            item.SubItems.Add(entry.ParamType.ToString());
            string ValueText = "";

            System.Drawing.Color color = System.Drawing.Color.Empty;

            switch (entry.ParamType)
            {
            case ParamType.Boolean:
            case ParamType.Float:
            case ParamType.Int:
            case ParamType.Uint:
                ValueText = $"{entry.Value}";
                break;

            case ParamType.String64:
            case ParamType.String32:
            case ParamType.String256:
            case ParamType.StringRef:
                ValueText = $"{((AampLibraryCSharp.StringEntry)entry.Value).ToString()}";
                break;

            case ParamType.Vector2F:
                var vec2 = (Vector2F)entry.Value;
                ValueText = $"{vec2.X} {vec2.Y}";
                break;

            case ParamType.Vector3F:
                var vec3 = (Vector3F)entry.Value;
                ValueText = $"{vec3.X} {vec3.Y} {vec3.Z}";
                break;

            case ParamType.Vector4F:
                var vec4 = (Vector4F)entry.Value;
                ValueText = $"{vec4.X} {vec4.Y} {vec4.Z} {vec4.W}";
                break;

            case ParamType.Color4F:
                var col = (Vector4F)entry.Value;
                ValueText = $"{col.X} {col.Y} {col.Z} {col.W}";

                int ImageIndex = Images.Count;

                color = System.Drawing.Color.FromArgb(
                    EditBox.FloatToIntClamp(col.W),
                    EditBox.FloatToIntClamp(col.X),
                    EditBox.FloatToIntClamp(col.Y),
                    EditBox.FloatToIntClamp(col.Z));
                break;

            default:
                break;
            }

            item.SubItems.Add(ValueText);

            if (color != System.Drawing.Color.Empty)
            {
                item.SubItems[2].BackColor = color;
            }
        }
Example #57
0
    /// <summary>
    /// Create QRCode Color Option Extend
    /// </summary>
    /// <param name="str">String Gen QR</param>
    /// <param name="Pixel">Pixel input a Int</param>
    /// <param name="ColorQR">Color in QR</param>
    /// <param name="ColorBG">Color BackGround</param>
    /// <returns></returns>
    public static Bitmap CreateQRCodeColor(string str, int Pixel, System.Drawing.Color ColorQR, System.Drawing.Color ColorBG)
    {
        QRCodeGenerator QrCodeGenerator = new QRCodeGenerator();
        QRCodeData      qrCodeData      = QrCodeGenerator.CreateQrCode(str, QRCodeGenerator.ECCLevel.M);

        QRCode QrCode = new QRCode(qrCodeData);

        Bitmap QrcodeimageBitmap = QrCode.GetGraphic(Pixel, ColorQR, ColorBG, true);

        return(QrcodeimageBitmap);
    }
 private static string ToCssColorString(System.Drawing.Color c)
 {
     return("#" + c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2"));
 }
Example #59
0
        public Bitmap Draw(GraphBlueprint wgraph, string path, Action <string> logwrite, Image last)
        {
            var idmap = MapLevels(path, logwrite);

            int minX;
            int minY;
            int maxX;
            int maxY;

            if (wgraph == null || wgraph.LevelNodes.Count == 0)
            {
                Bitmap gb = new Bitmap(1024, 640);
                if (last != null)
                {
                    gb = new Bitmap(last.Width, last.Height);
                }

                using (Graphics g = Graphics.FromImage(gb))
                {
                    g.SmoothingMode = SmoothingMode.AntiAlias;

                    if (last == null)
                    {
                        g.Clear(Color.OrangeRed);
                        g.DrawLine(new Pen(Color.DarkRed, 32), 0, 0, gb.Width, gb.Height);
                        g.DrawLine(new Pen(Color.DarkRed, 32), gb.Width, 0, 0, gb.Height);
                    }
                    else
                    {
                        g.DrawImageUnscaled(last, 0, 0);
                        g.FillRectangle(new SolidBrush(Color.FromArgb(32, Color.OrangeRed)), 0, 0, gb.Width, gb.Height);

                        g.DrawLine(new Pen(Color.FromArgb(64, Color.DarkRed), 32), 0, 0, gb.Width, gb.Height);
                        g.DrawLine(new Pen(Color.FromArgb(64, Color.DarkRed), 32), gb.Width, 0, 0, gb.Height);
                    }
                }
                return(gb);
            }
            else if (wgraph.LevelNodes.Count == 0)
            {
                Bitmap gb = new Bitmap(1024, 640);
                using (Graphics g = Graphics.FromImage(gb))
                {
                    g.SmoothingMode = SmoothingMode.AntiAlias;
                    g.Clear(Color.LightSkyBlue);
                }
                return(gb);
            }
            else
            {
                minX = (int)wgraph.AllNodes.Min(n => n.X) - 250;
                minY = (int)wgraph.AllNodes.Min(n => n.Y) - 250;
                maxX = (int)wgraph.AllNodes.Max(n => n.X) + 250;
                maxY = (int)wgraph.AllNodes.Max(n => n.Y) + 250;
            }

            Bitmap buffer = new Bitmap(maxX - minX, maxY - minY);

            using (Graphics g = Graphics.FromImage(buffer))
            {
                g.TranslateTransform(-minX, -minY);

                g.SmoothingMode = SmoothingMode.AntiAlias;
                g.Clear(Color.Black);

                DrawGrid(minX, maxX, g, minY, maxY);

                DrawPipes(wgraph, g);

                DrawNodes(wgraph, g, idmap);
                DrawRootNode(wgraph, g);
                DrawWarpNodes(wgraph, g);

                DrawPriorityMarker(wgraph, g);
            }

            return(buffer);
        }
Example #60
0
 public static string ToHex(this Drawing.Color color)
 {
     return(string.Format("#{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B));
 }