FromArgb() public static method

public static FromArgb ( byte a, byte r, byte g, byte b ) : Color
a byte
r byte
g byte
b byte
return Color
Beispiel #1
0
        RadialGradientBrush MakeRadialBrush()
        {
            var brush = new RadialGradientBrush
            {
                GradientStops = new GradientStopCollection
                {
                    new GradientStop
                        (Color.FromArgb
                            ((byte)rnd.Next(0, 256),
                            (byte)rnd.Next(0, 256),
                            (byte)rnd.Next(0, 256),
                            (byte)rnd.Next(0, 256)),
                        0.0),
                    new GradientStop
                        (Color.FromArgb
                            ((byte)rnd.Next(0, 256),
                            (byte)rnd.Next(0, 256),
                            (byte)rnd.Next(0, 256),
                            (byte)rnd.Next(0, 256)),
                        1.0)
                }
            };

            return(brush);
        }
Beispiel #2
0
        /// <summary>
        ///     Draw all the given layers on the given rect
        /// </summary>
        /// <param name="g">The graphics to draw on</param>
        /// <param name="renderLayers">The layers to render</param>
        /// <param name="dataModel">The data model to base the layer's properties on</param>
        /// <param name="rect">A rectangle matching the current keyboard's size on a scale of 4, used for clipping</param>
        /// <param name="preview">Indicates wheter the layer is drawn as a preview, ignoring dynamic properties</param>
        /// <param name="updateAnimations">Wheter or not to update the layer's animations</param>
        internal void DrawLayers(Graphics g, IEnumerable <LayerModel> renderLayers, IDataModel dataModel, Rect rect,
                                 bool preview, bool updateAnimations)
        {
            var visual = new DrawingVisual();

            using (var c = visual.RenderOpen())
            {
                // Setup the DrawingVisual's size
                c.PushClip(new RectangleGeometry(rect));
                c.DrawRectangle(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)), null, rect);

                // Draw the layers
                foreach (var layerModel in renderLayers)
                {
                    layerModel.Update(dataModel, preview, updateAnimations);
                    layerModel.Draw(dataModel, c, preview, updateAnimations);
                }

                // Remove the clip
                c.Pop();
            }

            using (var bmp = ImageUtilities.DrawingVisualToBitmap(visual, rect))
            {
                g.DrawImage(bmp, new PointF(0, 0));
            }
        }
        private void CodIn_NuevoRegistro_GotFocus(object sender, EventArgs e)
        {
            Brush Azulprofundo = new SolidColorBrush(ColorWPF.FromArgb(255, 52, 76, 230));

            LB1Codin.Foreground = Brushes.White;
            LB1Codin.Background = Azulprofundo;// FF344CE6
        }
Beispiel #4
0
        public override void SetupCustomUIElements(object ui)
        {
            var nodeUI = ui as dynNodeView;

            //add a text box to the input grid of the control
            var tb = new dynTextBox
            {
                Background = new SolidColorBrush(Color.FromArgb(0x88, 0xFF, 0xFF, 0xFF))
            };

            tb.OnChangeCommitted += processTextForNewInputs;

            tb.HorizontalAlignment = HorizontalAlignment.Stretch;
            tb.VerticalAlignment   = VerticalAlignment.Top;

            nodeUI.inputGrid.Children.Add(tb);
            Grid.SetColumn(tb, 0);
            Grid.SetRow(tb, 0);

            tb.DataContext = this;
            var bindingVal = new System.Windows.Data.Binding("Value")
            {
                Mode = BindingMode.TwoWay,
                //Converter = new StringDisplay(),
                Source = this,
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            };

            tb.SetBinding(TextBox.TextProperty, bindingVal);

            if (Value != "")
            {
                tb.Commit();
            }
        }
        public void RenderOpacityMask(DrawingContext drawingContext)
        {
            if (DisplayGeometry == null)
            {
                return;
            }

            SolidColorBrush fillBrush = new(Color.FromArgb(100, 255, 255, 255));

            fillBrush.Freeze();
            SolidColorBrush penBrush = new(Color.FromArgb(255, 255, 255, 255));

            penBrush.Freeze();

            // Create transparent pixels covering the entire LedRect so the image size matched the LedRect size
            drawingContext.DrawRectangle(new SolidColorBrush(Colors.Transparent), new Pen(new SolidColorBrush(Colors.Transparent), 1), LedRect);
            // Translate to the top-left of the LedRect
            drawingContext.PushTransform(new TranslateTransform(LedRect.X, LedRect.Y));
            // Render the LED geometry
            drawingContext.DrawGeometry(fillBrush, new Pen(penBrush, 1)
            {
                LineJoin = PenLineJoin.Round
            }, DisplayGeometry.GetOutlinedPathGeometry());
            // Restore the drawing context
            drawingContext.Pop();
        }
        /// <summary>
        /// Applies the <see cref="ShinyFloorFilter" /> to the specified <paramref name="source"/>.
        /// </summary>
        /// <param name="source">The source image.</param>
        /// <param name="dc"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        protected override void ApplyFilter(FastBitmap source, DrawingContext dc, int width, int height)
        {
            // First, draw reflected image with an opacity mask.
            int reflectionHeight = (int)(source.Height * (ReflectionPercentage / 100.0f));

            dc.PushTransform(new TransformGroup
            {
                Children = new TransformCollection
                {
                    new ScaleTransform {
                        ScaleY = -1
                    },
                    new TranslateTransform {
                        Y = GetReflectionOffsetY(source) + reflectionHeight
                    }
                }
            });
            dc.PushOpacityMask(new LinearGradientBrush(
                                   SWMColors.Transparent,
                                   SWMColor.FromArgb((byte)(255.0f * (ReflectionOpacity / 100.0f)), 0, 0, 0),
                                   new Point(0, 0),
                                   new Point(0, 1)));

            dc.DrawImage(new CroppedBitmap(source.InnerBitmap, new Int32Rect(0, source.Height - reflectionHeight, source.Width, reflectionHeight)),
                         new Rect(0, 0, source.Width, reflectionHeight));


            dc.Pop();
            dc.Pop();

            // Draw original image.
            dc.DrawImage(source.InnerBitmap, new Rect(0, 0, source.Width, source.Height));
        }
Beispiel #7
0
        public override void SetupCustomUIElements(object ui)
        {
            var nodeUI = ui as dynNodeView;

            //add a text box to the input grid of the control
            var tb = new dynTextBox
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Top,
                IsNumeric           = true,
                Background          = new SolidColorBrush(Color.FromArgb(0x88, 0xFF, 0xFF, 0xFF))
            };

            nodeUI.inputGrid.Children.Add(tb);
            Grid.SetColumn(tb, 0);
            Grid.SetRow(tb, 0);

            tb.DataContext = this;
            var bindingVal = new System.Windows.Data.Binding("Value")
            {
                Mode      = BindingMode.TwoWay,
                Converter = new DoubleInputDisplay(),
                NotifyOnValidationError = false,
                Source = this,
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            };

            tb.SetBinding(TextBox.TextProperty, bindingVal);

            tb.Text = Value ?? "0.0";
        }
Beispiel #8
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            ProgressIndicator indicator = new ProgressIndicator();

            indicator.IsIndeterminate = true;
            indicator.IsVisible       = true;
            indicator.Text            = "Seferler yükleniyor..";
            string whereFrom = NavigationContext.QueryString["whereFrom"];
            string whereTo   = NavigationContext.QueryString["whereTo"];

            dateFrom       = NavigationContext.QueryString["dateFrom"];
            passengerCount = NavigationContext.QueryString["passengerCount"];
            actionType     = NavigationContext.QueryString["actionType"] == "Satış" ? "0" : "1";
            string requestFrom = "<Sefer>" +
                                 "<FirmaNo>0</FirmaNo>" +
                                 "<KalkisAdi>" + whereFrom + "</KalkisAdi>" +
                                 "<VarisAdi>" + whereTo + "</VarisAdi>" +
                                 "<Tarih>" + dateFrom + "</Tarih>" +
                                 "<AraNoktaGelsin>1</AraNoktaGelsin>" +
                                 "<IslemTipi>" + actionType + "</IslemTipi>" +
                                 "<YolcuSayisi>" + passengerCount + "</YolcuSayisi>" +
                                 "</Sefer>";
            ServiceSoapClient client = new ServiceSoapClient();

            client.StrIsletAsync(requestFrom, Database.Admin);
            client.StrIsletCompleted += client_StrIsletCompleted;
            SystemTray.SetProgressIndicator(this, indicator);
            WhereFrom.Text      = whereFrom;
            WhereTo.Text        = whereTo;
            TimeGrid.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x33, 0x99, 0xFF));
            TimeText.Foreground = new SolidColorBrush(Colors.White);
            TimeImage.Source    = new BitmapImage(new Uri("/Assets/down.png", UriKind.Relative));
            orderType           = 3;
            base.OnNavigatedTo(e);
        }
 public void AddContentToSelection(string contentName)
 {
     if (SelectedContentList.Contains(contentName))
     {
         foreach (var contentIconAndName in DisplayContentList)
         {
             if (contentIconAndName.Name == contentName)
             {
                 contentIconAndName.Brush = new SolidColorBrush(Color.FromArgb(0, 175, 175, 175));
                 SelectedContentList.Remove(contentName);
                 return;
             }
         }
     }
     foreach (var contentIconAndName in DisplayContentList)
     {
         if (contentIconAndName.Name == contentName)
         {
             contentIconAndName.Brush = new SolidColorBrush(Color.FromArgb(255, 195, 195, 195));
         }
     }
     SelectedContentList.Add(contentName);
     lastSelectedContent = contentName;
     RaisePropertyChanged("ContentList");
 }
Beispiel #10
0
        public ChangeTimeView()
        {
            InitializeComponent();

            ChangeTimeViewModel vm = (ChangeTimeViewModel)DataContext;

            vm.PropertyChanged += (_, args) => {
                if (args.PropertyName == nameof(vm.Title))
                {
                    InlineExpression.SetInlineExpression(TitleBlock, vm.Title);
                }
            };
            Loaded += (_, _) => {
                // Window Setup
                _window = Window.GetWindow(this);
                Debug.Assert(_window != null, nameof(_window) + " != null");
                _window.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));

                (double dpiWidthFactor, double dpiHeightFactor) = WindowHelpers.GetDpiFactors(_window);
                _window.CenterOnScreen(dpiWidthFactor, dpiHeightFactor);
            };

            MouseDown += (_, e) => {
                if (e.ChangedButton == MouseButton.Left)
                {
                    DependencyObject scope = FocusManager.GetFocusScope(Root);
                    FocusManager.SetFocusedElement(scope, _window);
                    _window.DragMove();
                }
            };
        }
Beispiel #11
0
        public static SolidColorBrush GetColorBrushFromString(string color)
        {
            if (color == null)
            {
                return(new SolidColorBrush(Colors.White));
            }
            var  ret = new SolidColorBrush();
            var  dyes = color.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            byte alfa, r, g, b;

            if (dyes.Count <string>() == 4)
            {
                Byte.TryParse(dyes[3], NumberStyles.Integer, Thread.CurrentThread.CurrentCulture, out alfa);
                Byte.TryParse(dyes[0], NumberStyles.Integer, Thread.CurrentThread.CurrentCulture, out r);
                Byte.TryParse(dyes[1], NumberStyles.Integer, Thread.CurrentThread.CurrentCulture, out g);
                Byte.TryParse(dyes[2], NumberStyles.Integer, Thread.CurrentThread.CurrentCulture, out b);
                ret.Color = dyes.Length == 4
                    ? Color.FromArgb(alfa, r, g, b)
                    : Colors.White;
                return(ret);
            }
            else
            {
                return(System.Windows.Media.Brushes.White);
            }
        }
Beispiel #12
0
        private void PlatformSelect(object sender, SelectionChangedEventArgs e)
        {
            var item = (ListBox)sender;
            var su   = (ListBoxItem)item.SelectedItem;

            su.Background = new SolidColorBrush(Color.FromArgb(255, 21, 21, 30));
        }
Beispiel #13
0
        protected override void OnElementChanged(ElementChangedEventArgs <CustomHubTileView> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null || Element == null)
            {
                return;
            }

            HubTile.Title   = Element.Title;
            HubTile.Message = Element.Message;
            var fileImageSource = Element.Source as FileImageSource;

            if (fileImageSource != null)
            {
                HubTile.Source = new BitmapImage(new Uri(fileImageSource.File, UriKind.RelativeOrAbsolute));
            }

            Color color = Color.FromArgb(
                (byte)(Element.Color.A * 255),
                (byte)(Element.Color.R * 255),
                (byte)(Element.Color.G * 255),
                (byte)(Element.Color.B * 255));

            HubTile.Background = new SolidColorBrush(color);

            SetNativeControl(HubTile);
        }
Beispiel #14
0
        /// <summary>
        ///     Draw all the provided layers of type Keyboard and KeyboardGif
        /// </summary>
        /// <param name="keyboard">The graphics to draw on</param>
        /// <param name="renderLayers">The layers to render</param>
        /// <param name="dataModel">The data model to base the layer's properties on</param>
        /// <param name="keyboardRect">A rectangle matching the current keyboard's size on a scale of 4, used for clipping</param>
        /// <param name="preview">Indicates wheter the layer is drawn as a preview, ignoring dynamic properties</param>
        /// <param name="updateAnimations">Wheter or not to update the layer's animations</param>
        internal void DrawProfile(Graphics keyboard, List <LayerModel> renderLayers, IDataModel dataModel, Rect keyboardRect,
                                  bool preview,
                                  bool updateAnimations)
        {
            var visual = new DrawingVisual();

            using (var c = visual.RenderOpen())
            {
                // Setup the DrawingVisual's size
                c.PushClip(new RectangleGeometry(keyboardRect));
                c.DrawRectangle(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)), null, keyboardRect);

                // Draw the layers
                foreach (var layerModel in renderLayers
                         .Where(l => l.LayerType == LayerType.Keyboard ||
                                l.LayerType == LayerType.KeyboardGif))
                {
                    layerModel.Draw(dataModel, c, preview, updateAnimations);
                }

                // Remove the clip
                c.Pop();
            }

            using (Bitmap bmp = ImageUtilities.DrawinVisualToBitmap(visual, keyboardRect))
                keyboard.DrawImage(bmp, new PointF(0, 0));
        }
Beispiel #15
0
        public Theme GetTheme(int id)
        {
            ((userThemesList.Parent as FrameworkElement).Parent as FrameworkElement).Visibility = Visibility.Collapsed;
            switch (id)
            {
            case 0:
                return(new Theme()
                {
                    Apple = Colors.OrangeRed,
                    Background = Color.FromArgb(0xFF, 0x33, 0xCC, 0x33)
                });

            case 1:
                return(new Theme()
                {
                    Apple = Color.FromArgb(0xFF, 0x66, 0x66, 0x66),
                    Background = Color.FromArgb(0xFF, 0x33, 0x33, 0x33)
                });

            case 2:
                ((userThemesList.Parent as FrameworkElement).Parent as FrameworkElement).Visibility = Visibility.Visible;
                LoadUserThemes();
                return((userThemesList?.SelectedItem as ListBoxItem)?.Tag as Theme ?? new Theme());

            default:
                break;
            }
            return(new Theme());
        }
Beispiel #16
0
 private void BoardRefresh()
 {
     Dispatcher.Invoke(() =>
     {
         Items.Children.Clear();
         for (var i = 0; i < _bitems.Count; i++)
         {
             _bitems[i].G.Margin = new Thickness(0, i * 62 + 5, 0, 0);
             Items.Children.Add(_bitems[i].G);
         }
         if (_bitems.Count == 0)
         {
             //TaskBoard.Visibility = Visibility.Hidden;
             LABSS.Content    = "[Выкл]";
             LABSS.Foreground = new SolidColorBrush(Color.FromArgb(0xff, 0xee,
                                                                   0x22, 0x22));
             IStartBack.Source = ImgHelpers.BitmapToImageSource(Properties.Resources.startback);
         }
         else
         {
             TaskBoard.Visibility = Visibility.Visible;
         }
         LItemsCount.Content = _bitems.Count.ToString();
     });
 }
Beispiel #17
0
        public Color GetPixelColor(int x, int y)
        {
            Color color;
            var   bytesPerPixel = (_screenSource.Format.BitsPerPixel + 7) / 8;
            var   bytes         = new byte[bytesPerPixel];
            var   rect          = new Int32Rect(x, y, 1, 1);

            _screenSource.CopyPixels(rect, bytes, bytesPerPixel, 0);

            if (_screenSource.Format == PixelFormats.Pbgra32)
            {
                color = Color.FromArgb(bytes[3], bytes[2], bytes[1], bytes[0]);
            }
            else if (_screenSource.Format == PixelFormats.Bgr32)
            {
                color = Color.FromArgb(0xFF, bytes[2], bytes[1], bytes[0]);
            }
            else if (_screenSource.Format == PixelFormats.Bgra32)
            {
                color = Color.FromArgb(bytes[3], bytes[2], bytes[1], bytes[0]);
            }
            else
            {
                if (!_hasBeenWarned)
                {
                    Logging.Warning("Unsupported format: " + _screenSource.Format);
                    _hasBeenWarned = true;
                }

                color = Colors.Black;
            }

            return(color);
        }
Beispiel #18
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            DColor col  = (DColor)value;
            MColor mcol = MColor.FromArgb(col.A, col.R, col.G, col.B);

            return(new SolidColorBrush(mcol));
        }
Beispiel #19
0
        public BoneVisual3d(TransformPtrViewModel transform, SkeletonVisual3d skeleton, string name)
        {
            this.ViewModel = transform;
            this.Skeleton  = skeleton;

            this.rotation = new RotateTransform3D();
            this.position = new TranslateTransform3D();

            Transform3DGroup transformGroup = new Transform3DGroup();

            transformGroup.Children.Add(this.rotation);
            transformGroup.Children.Add(this.position);

            this.Transform = transformGroup;

            PaletteHelper ph = new PaletteHelper();
            ITheme        t  = ph.GetTheme();

            this.defaultMaterial  = new DiffuseMaterial(new SolidColorBrush(WinColor.FromArgb(64, 0, 0, 0)));
            this.hoverMaterial    = new EmissiveMaterial(new SolidColorBrush(t.PrimaryDark.Color));
            this.selectedMaterial = new EmissiveMaterial(new SolidColorBrush(t.PrimaryMid.Color));

            System.Windows.Media.Color c1 = System.Windows.Media.Color.FromArgb(200, 255, 255, 255);
            this.sphere          = new Sphere();
            this.sphere.Radius   = 0.02;
            this.sphere.Material = this.defaultMaterial;
            this.Children.Add(this.sphere);

            this.OriginalBoneName = name;
            this.BoneName         = name;

            this.Skeleton.PropertyChanged += this.OnSkeletonPropertyChanged;
        }
Beispiel #20
0
        private void FilterApplyClick(object sender)
        {
            MyAnimations.AnimateOpacity(LabelWriteOutput, 0, 1.00, 300);
            MyAnimations.AnimateOpacity(ImageProcessingInfo, 1.0, 0, 300);

            if (Image3.Opacity > 0)
            {
                MyAnimations.AnimateOpacity(Image3, 1.0, 0, 300);
            }

            var filterBox = (FilterEdit)sender;

            _lastFilterType = filterBox.TypeOfFilter;

            var filterColors = new[]
            {
                Color.FromArgb(150, 244, 164, 96),
                Color.FromArgb(150, 164, 244, 96),
                Color.FromArgb(150, 244, 96, 164),
                Color.FromArgb(150, 96, 164, 244)
            };

            if (FiltersGraph.SelectedFilter != -1)
            {
                FiltersGraph.EditFilterDef(FiltersGraph.SelectedFilter, filterBox.TypeOfFilter,
                                           filterBox.FrequencyOne, filterBox.FrequencyTwo,
                                           filterColors[FiltersGraph.SelectedFilter]);
            }
            else
            {
                FiltersGraph.AddFilterDef(filterBox.TypeOfFilter,
                                          filterBox.FrequencyOne, filterBox.FrequencyTwo,
                                          filterColors[FiltersGraph.GetFiltersCount()]);
            }
        }
Beispiel #21
0
        public override void SetupCustomUIElements(object ui)
        {
            var nodeUI = ui as dynNodeView;

            var tb = new dynTextBox();

            tb.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            tb.VerticalAlignment   = System.Windows.VerticalAlignment.Top;
            nodeUI.inputGrid.Children.Add(tb);
            System.Windows.Controls.Grid.SetColumn(tb, 0);
            System.Windows.Controls.Grid.SetRow(tb, 0);
            tb.IsNumeric  = false;
            tb.Background = new SolidColorBrush(Color.FromArgb(0x88, 0xFF, 0xFF, 0xFF));

            tb.DataContext = this;
            var bindingVal = new Binding("Formula")
            {
                Mode = BindingMode.TwoWay,
                NotifyOnValidationError = false,
                Source = this,
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            };

            tb.SetBinding(TextBox.TextProperty, bindingVal);
        }
Beispiel #22
0
        private void HalfTimeDisable()
        {
            _pauseStopWatch.Stop();

            GameHub.Instance.CurrentGame.HalfTime = false;
            HalftimeButton.Background             = new SolidColorBrush(Color.FromArgb(255, 128, 128, 128));
        }
        void ShowCancelText()
        {
            foreach (var screen in _screens)
            {
                var bounds = screen.Rectangle;

                var left   = -Left + bounds.Left / Dpi.X;
                var top    = -Top + bounds.Top / Dpi.Y;
                var width  = bounds.Width / Dpi.X;
                var height = bounds.Height / Dpi.Y;

                var container = new ContentControl
                {
                    Width               = width,
                    Height              = height,
                    Margin              = new Thickness(left, top, 0, 0),
                    VerticalAlignment   = VerticalAlignment.Top,
                    HorizontalAlignment = HorizontalAlignment.Left
                };

                var textBlock = new TextBlock
                {
                    Text = $"Select {_mode} or Press Esc to Cancel",
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Padding             = new Thickness(10, 5, 10, 5),
                    Foreground          = new SolidColorBrush(Colors.White),
                    Background          = new SolidColorBrush(Color.FromArgb(183, 0, 0, 0))
                };

                container.Content = textBlock;

                Grid.Children.Add(container);
            }
        }
Beispiel #24
0
        private void TimeoutDisable()
        {
            _timeoutStopWatch.Stop();

            GameHub.Instance.CurrentGame.Timeout = false;
            TimeoutButton.Background             = new SolidColorBrush(Color.FromArgb(255, 128, 128, 128));
        }
Beispiel #25
0
        /// <summary>
        /// constructor
        /// </summary>
        public mainViewModel()
        {
            showCurves = true;
            showFaces  = false;
            showPanels = true;

            effectsManager = new DefaultEffectsManager();

            helixMaterials = Enum.GetValues(typeof(projectMaterials)).Cast <projectMaterials>();

            updateProperties      = new relayCommand(x => updatePanelProperties(selection));
            changePreviewMaterial = new relayCommand(x => previewSelectionMaterial());

            // titles
            title    = "App";
            subTitle = "Test";

            // camera setup
            camera = new PerspectiveCamera
            {
                Position          = new Point3D(1500, 1500, 2500),
                LookDirection     = new Vector3D(-60, -60, -100),
                UpDirection       = upDirection,
                FarPlaneDistance  = 1e4,
                NearPlaneDistance = 0.01,
            };

            camera2d = new OrthographicCamera
            {
                Position          = new Point3D(0, 0, 55),
                LookDirection     = new Vector3D(0, 0, -25),
                UpDirection       = upDirection2d,
                FarPlaneDistance  = 1e4,
                NearPlaneDistance = 0.01,
            };

            // setup lighting
            ambientLightColor     = Colors.DimGray;
            directionalLightColor = Colors.White;

            // selection options
            //selectionColor = Color.FromRgb(91, 198, 208);
            selectionColor    = Colors.Red;
            selectionMaterial = new DiffuseMaterial()
            {
                DiffuseColor = new Color4(91, 198, 208, 255)
            };

            // floor plane grid (1')
            majorGrid          = LineBuilder.GenerateGrid(new Vector3(1, 1, 0), -100, 100, -100, 100);
            majorGridColor     = Color.FromArgb(150, 200, 200, 200);
            majorGridTransform = new Media3D.TranslateTransform3D(0, 0, -0.01);

            // grid (1')
            panelGrid          = LineBuilder.GenerateGrid(new Vector3(1, 1, 0), -10, 10, -10, 10);
            panelGridColor     = Color.FromArgb(255, 100, 100, 100);
            panelGridTransform = new Media3D.TranslateTransform3D(0, 0, -0.01);

            addCubes();
        }
Beispiel #26
0
        public void tekenopdr()
        {
            Spelscherm.Children.Clear();

            int scherm_x  = 20;  //start x coordinaat
            int scherm_y  = 280; //Print rechtelijntjes
            int scherm_x2 = 20;  //Schuif op
            int scherm_y2 = 10;

            if (Waterskibaan.Game.waterb.p._lijnen.Count > 0)
            {
                foreach (Lijn lijn in Game.waterb.p._lijnen)
                {
                    Line teken = new Line();
                    var  brush = new SolidColorBrush(Color.FromArgb(lijn.Sp.KledingKleur.A, lijn.Sp.KledingKleur.R, lijn.Sp.KledingKleur.G, lijn.Sp.KledingKleur.B));
                    teken.Stroke          = brush;
                    teken.X1              = scherm_x;
                    teken.X2              = scherm_x2;
                    teken.Y1              = scherm_y;
                    teken.Y2              = scherm_y2;
                    teken.StrokeThickness = 2;
                    Spelscherm.Children.Add(teken);

                    Label l = new Label();
                    Canvas.SetTop(l, scherm_y2);
                    Canvas.SetLeft(l, scherm_x);
                    l.Content = lijn.Sp.Sporternummer;
                    Spelscherm.Children.Add(l);

                    Label kabel = new Label();
                    scherm_x  += 30;
                    scherm_x2 += 30;
                }
            }
        }
Beispiel #27
0
        public static MediaColor GetClassColor(string className, bool priestAsGray)
        {
            if (string.IsNullOrEmpty(className))
            {
                return(Colors.DimGray);
            }
            MediaColor color;

            if (Config.Instance.ClassColorScheme == ClassColorScheme.HearthStats)
            {
                if (!HearthStatsClassColors.TryGetValue(className, out color))
                {
                    color = Colors.DimGray;
                }
            }
            else
            {
                if (className == "Priest" && priestAsGray)
                {
                    color = MediaColor.FromArgb(0xFF, 0xD2, 0xD2, 0xD2);                     //#D2D2D2
                }
                else if (!ClassicClassColors.TryGetValue(className, out color))
                {
                    color = MediaColor.FromArgb(0xFF, 0x80, 0x80, 0x80);                     //#808080
                }
            }
            return(color);
        }
        protected void SampleImageClick(BitmapSource img, Point pos)
        {
            // https://social.msdn.microsoft.com/Forums/vstudio/en-US/82a5731e-e201-4aaf-8d4b-062b138338fe/getting-pixel-information-from-a-bitmapimage?forum=wpf

            int stride = (int)img.Width * 4;
            int size   = (int)img.Height * stride;

            byte[] pixels = new byte[(int)size];

            img.CopyPixels(pixels, stride, 0);


            // Get pixel
            var x = (int)pos.X;
            var y = (int)pos.Y;

            int index = y * stride + 4 * x;

            byte red   = pixels[index];
            byte green = pixels[index + 1];
            byte blue  = pixels[index + 2];
            byte alpha = pixels[index + 3];

            var color = Color.FromArgb(alpha, blue, green, red);

            SetColor(color);
        }
        private void CodIn_NuevoRegistro_LostFocus(object sender, EventArgs e)
        {
            Brush ModoNormal = new SolidColorBrush(ColorWPF.FromArgb(255, 127, 144, 255));

            LB1Codin.Foreground = Brushes.Black;
            LB1Codin.Background = ModoNormal;//FF7F90FF
        }
        private void ShowLoader(Panel control)
        {
            var rect = new Rectangle
            {
                Margin = new Thickness(0),
                Fill   = new SolidColorBrush(WPFColor.FromArgb(192, 40, 40, 40)),
                Name   = "prLoaderContainer"
            };

            var loader = new ProgressRing
            {
                Foreground          = (Brush)FindResource("AccentColorBrush"),
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                Width    = 80,
                Height   = 80,
                IsActive = true,
                Name     = "prLoader"
            };

            Panel.SetZIndex(rect, 10000);
            Panel.SetZIndex(loader, 10001);

            control.Children.Add(rect);
            control.Children.Add(loader);
        }