Beispiel #1
0
        public static BitmapSource Create(System.Windows.Media.Color HueColor, int size)
        {
            BitmapSource image;

            using (Bitmap bitmap = new Bitmap(size, size))
            {
                using (Graphics graphics = Graphics.FromImage(bitmap))
                {
                    Point[]      diamondPoints = GetDiamondTipPoints(size);
                    List <Color> listColors    = GetDiamondTipColors(HueColor);
                    DrawColorDiamond(graphics, diamondPoints, listColors.ToArray());
                }

                image = BitmapManipulator.CreateBitmapSourceFromGdiBitmap(bitmap);
            }
            return(image);
        }
Beispiel #2
0
        public OptionsViewModel()
        {
            LeftMouseDownOnPencilCommand      = new DelegateCommand(() => NotifyActionChanged(new PencilAction()));
            LeftMouseDownOnColorPickerCommand = new DelegateCommand(() => NotifyActionChanged(new ColorPickerAction()));
            LeftMouseDownOnFillCommand        = new DelegateCommand(() => NotifyActionChanged(new FillAction()));

            WidthOfImage  = 64;
            HeightOfImage = 64;

            Assembly pencilAssembly = Assembly.GetExecutingAssembly();
            Stream   pencilStream   = pencilAssembly.GetManifestResourceStream("BitTile.Resources.pencil.png");

            PencilImage = BitmapManipulator.CreateBitmapSourceFromGdiBitmap(new Bitmap(pencilStream));

            Assembly colorPickerAssembly = Assembly.GetExecutingAssembly();
            Stream   colorPickerStream   = colorPickerAssembly.GetManifestResourceStream("BitTile.Resources.colorpicker.png");

            ColorPickerImage = BitmapManipulator.CreateBitmapSourceFromGdiBitmap(new Bitmap(colorPickerStream));

            Assembly fillAssembly = Assembly.GetExecutingAssembly();
            Stream   fillStream   = fillAssembly.GetManifestResourceStream("BitTile.Resources.fill.png");

            FillImage = BitmapManipulator.CreateBitmapSourceFromGdiBitmap(new Bitmap(fillStream));
        }