Example #1
0
 TextureBrush(ITextureBrush handler, Image image, float opacity)
 {
     this.handler       = handler;
     this.ControlObject = handler.Create(image, opacity);
     this.Image         = image;
     this.opacity       = opacity;
 }
Example #2
0
        static void Main()
        {
            System.Windows.Forms.Application.EnableVisualStyles();
            System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
            MnM.GWS.Application.Attach(Gws.Instance);
#if Demo
            goto Run;
#endif
            rg           = new BrushStyle(BrushTypes.Conical, Rgba.Red, Rgba.SkyBlue, Rgba.LightPink, Rgba.Green);
            rg1          = new BrushStyle(BrushTypes.Vertical, Rgba.Yellow, Rgba.Green, Rgba.Orange, Rgba.Olive);
            fs           = new BrushStyle(BrushTypes.Conical, Rgba.Gold, Rgba.Orange, Rgba.Green, Rgba.Teal);
            fs1          = new BrushStyle(BrushTypes.Vertical, Rgba.Black, Rgba.Maroon);
            moonfs       = new BrushStyle(BrushTypes.BackwardDiagonal, Rgba.Red, Rgba.Green);
            textureBrush = Factory.newBrush(AppDomain.CurrentDomain.BaseDirectory + "\\GWS.png");
            tahoma       = Factory.newFont("c:\\windows\\fonts\\tahoma.ttf", 40);

            Desktop = Factory.newForm(120, 120, 1000, 900);
            var Path = Desktop.Controls;
            Path.Add(new Polygon(90, 215, 163, 29, 63, 202,
                                 188, 46, 41, 182, 206, 70, 26, 156, 217, 97, 20,
                                 127, 219, 127, 22, 97, 213, 156, 33, 70, 198, 182, 51,
                                 46, 176, 202, 76, 29, 149, 215, 105,
                                 21, 120, 220, 134, 21, 90, 215), rg1);
            var parameters = new IParameter[] { rg, 23.ToStroke() };
            Path.Add(new Curve(600, 10, 300, 400), parameters);

            Path.Add(new Bezier(158, 181, 174, 348, 350, 363, 541, 145), parameters);

            Path.Add(new Tetragon(425, 480, 650, 690, 190), parameters);

            ////window.AddBuffer();
            ////window.SwitchToBuffer(0);

            Path.Add(new RoundBox(300, 300, 200, 200, 25), parameters);
            //window.Objects.Add(Factory.newTriangle(20, 300, 200, 350, 200, 467), Settings);

            Path.Add(new Curve(100, 500, 300, 200, 55, 300, CurveType.Pie), parameters);
            ////window.Settings.FillCommand = 0;
            Path.Add(parameters.AppendItem(tahoma), new TextElement("GWS - Drawing", 576, 507));
            Desktop.Paint     += Window_PaintBackground;
            Desktop.KeyPress  += Window_KeyPress;
            Desktop.MouseDown += Window_MouseDown;
            Desktop.MouseUp   += Window_MouseUp;
Run:
#if Demo
            MnM.GWS.Application.Run(Demo.Instance);
#else
            MnM.GWS.Application.Run(Desktop);
#endif
        }
Example #3
0
        static void Main()
        {
            //frame = true;
            Application.Attach(Gws.Instance);

            rg           = new BrushStyle(BrushTypes.Conical, Rgba.Red, Rgba.SkyBlue, Rgba.LightPink, Rgba.Green);
            rg1          = new BrushStyle(BrushTypes.Vertical, Rgba.Yellow, Rgba.Green, Rgba.Orange, Rgba.Olive);
            fs           = new BrushStyle(BrushTypes.Conical, Rgba.Gold, Rgba.Orange, Rgba.Green, Rgba.Teal);
            fs1          = new BrushStyle(BrushTypes.Vertical, Rgba.Black, Rgba.Maroon);
            moonfs       = new BrushStyle(BrushTypes.Horizontal, Rgba.Red, Rgba.Green);
            textureBrush = Factory.newBrush(AppContext.BaseDirectory + "\\GWS.png");
            tahoma       = Factory.newFont("c:\\windows\\fonts\\tahoma.ttf", 30);

            Desktop            = Factory.newDesktopWindow(width: 1000, height: 1000, flags: GwsWindowFlags.Resizable);
            Desktop.Paint     += Window_PaintBackground;
            Desktop.KeyPress  += Window_KeyPress;
            Desktop.MouseDown += Window_MouseDown;
            Desktop.MouseUp   += Window_MouseUp;
            Desktop.Resized   += Window_Resized;
            Desktop.KeyDown   += Desktop_KeyDown;

            //Factory.SystemFont.Size = 20;
            var Path = Desktop.Controls;

            Path.Add(new Polygon(167 + 200, 97, 110 + 200, 216, 248 + 200, 149, 107 + 200, 151, 218 + 200, 216),
                     new BrushStyle(BrushTypes.Conical, Rgba.Green, Rgba.Orange, Rgba.Black),
                     8.ToStroke(), PolyState.FloodFill.Add());

            Path.Add(new Polygon(90, 215, 163, 29, 63, 202, 188, 46, 41, 182, 206, 70,
                                 26, 156, 217, 97, 20, 127, 219, 127, 22, 97, 213, 156, 33, 70, 198, 182,
                                 51, 46, 176, 202, 76, 29, 149, 215, 105, 21, 120, 220, 134, 21, 90, 215), rg1);

            Path.Add(new Triangle(40, 10, 100, 140, 56, 300), moonfs);

            Path.Add(new Polygon(0, 500, 0, 300, 20, 300, 40, 500, 60, 300, 80, 300, 80, 500, 81, 499, 82,
                                 497, 83, 494, 84, 490, 85, 484, 86, 477, 87, 469, 88, 460, 89, 450, 90, 439, 91, 427,
                                 92, 414, 93, 400, 93, 475, 94, 480, 95, 485, 97, 490, 99, 495, 101, 500, 103, 495, 105,
                                 490, 107, 485, 108, 480, 110, 475, 110, 400, 112, 400, 112, 490, 113, 495, 115, 500, 117,
                                 497, 118, 493, 119, 488, 120, 482, 121, 475, 122, 467, 123, 458, 124, 448, 125, 437,
                                 126, 425, 127, 412, 129, 350, 129, 500, 129, 450, 140, 400, 130, 455, 140, 500, 141,
                                 494, 142, 487, 143, 479, 144, 470, 145, 460, 146, 450, 167, 450, 167, 443, 165, 431,
                                 163, 417, 161, 405, 159, 402, 157, 400, 155, 402, 153, 405, 151, 417, 149, 431, 147,
                                 443, 145, 449, 147, 458, 149, 470, 151, 484, 153, 495, 155, 500, 157, 500, 159, 500,
                                 161, 494, 163, 487, 165, 479, 167, 470, 169, 460, 171, 449, 173, 442, 175, 431, 177,
                                 418, 179, 407, 181, 404, 183, 402, 185, 404, 187, 407, 189, 418, 191, 431, 189, 424,
                                 187, 414, 185, 411, 183, 409, 181, 411, 179, 414, 177, 423, 175, 434, 177, 442, 179,
                                 446, 181, 449, 183, 452, 185, 456, 187, 464, 189, 475, 187, 488, 185, 499, 183, 502,
                                 181, 504, 179, 501, 177, 490, 175, 477, 177, 474, 179, 474, 181, 473, 183, 471, 185,
                                 468, 187, 464, 189, 459, 191, 453, 193, 446, 195, 438, 197, 429, 199, 419, 201, 408,
                                 203, 396, 205, 383, 207, 369, 209, 354, 209, 350, 209, 500, 210, 450, 212, 438, 214,
                                 425, 216, 412, 218, 405, 220, 402, 222, 400, 224, 403, 226, 410, 228, 422, 230, 433,
                                 232, 443, 232, 600, 0, 600, 0, 500), moonfs);
            var parameters = new IParameter[] { rg, 23.ToStroke(), FillMode.ExceptOutLine.Add() };

            Path.Add(new Curve(600, 20, 300, 400), parameters);
            Path.Add(parameters.AppendItem(moonfs), new Tetragon(425, 480, 650, 690, 190));

            Path.Add(new Bezier(158, 181, 174, 348, 350, 363, 541, 145), parameters);

            Path.Add(new RoundBox(300, 300, 200, 200, 25), parameters);
            Path.Add(new Curve(300, 527, 300, 200, 55, 300, CurveType.Pie), parameters);

            Path.Add(new TextElement("GWS - Drawing", 400, 570), tahoma, moonfs, 90.ToRotation(500, 500));
            //Path.Add(new TextElement(tahoma, "GWS - Drawing", 400, 570), rg1);

            //var polygonList = new PolygonCollection();
            //polygonList.Add(new Box(20, 20, 300, 300));
            //polygonList.Add(new Triangle(50, 30, 10, 100, 255, 240));
            //polygonList.Parameters = new ISettingsParam[] {
            //    moonfs, new FillType(FillMode.Outer), new Stroke(10)};
            //Path.Add(polygonList);

            Desktop.Show();
            Application.Run();
        }
Example #4
0
		TextureBrush (ITextureBrush handler, Image image, float opacity)
		{
			this.handler = handler;
			this.ControlObject = handler.Create (image, opacity);
			this.Image = image;
			this.opacity = opacity;
		}
Example #5
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Eto.Drawing.TextureBrush"/> class.
		/// </summary>
		/// <param name="image">Image for the brush</param>
		/// <param name="opacity">Opacity of the texture to apply to the brush when painting</param>
		/// <param name="generator">Generator to create the brush</param>
		public TextureBrush (Image image, float opacity = 1f, Generator generator = null)
		{
			this.Image = image;
			handler = generator.CreateShared<ITextureBrush> ();
			ControlObject = handler.Create (image, opacity);
		}
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Eto.Drawing.TextureBrush"/> class.
 /// </summary>
 /// <param name="image">Image for the brush</param>
 /// <param name="opacity">Opacity of the texture to apply to the brush when painting</param>
 /// <param name="generator">Generator to create the brush</param>
 public TextureBrush(Image image, float opacity = 1f, Generator generator = null)
 {
     this.Image    = image;
     handler       = generator.CreateShared <ITextureBrush> ();
     ControlObject = handler.Create(image, opacity);
 }