- polyrect := TglvgRect.Create; //create an rectangle
- polyrect.X:= 1.0; //position
- polyrect.Y:= 1.0;
- polyrect.Width:=100.0; //size
- polyrect.Height:=200.0;
- polyrect.Rx:=20.0; //rounded corner size
- polyrect.Ry:=20.0;
- polyrect.Style.Color.SetColor(1,0,0,1); //set solid color with individual rgba values
- polyrect.Style.Color.a:=0.8; //it is also possible to set only the alpha value (transparency)
- polyrect.Style.GradColorAngle:=90; //rotate the gradient color fill
- polyrect.Style.NumGradColors := 2; //set the number of colors in the gradient color fill
- polyrect.Style.GradColor[0].a :=1.0; //change the alpha for the first gradient color point (it takes over values from the solid color, so i change it here)
- polyrect.Style.GradColor[0].SetColor('#FF0000'); //you can use web hex color codes
- polyrect.Style.GradColor[1].SetColor('#00FF00');
- polyrect.Style.FillType := glvgLinearGradient; //set the fill type to gradient
- polyrect.Style.LineType := glvgSolid; //make the line style solid (basic line color is white)
- polyrect.Polygon.Id:=7; //give it an id (need to automate that) , needed for stencil buffer filling
- polyrect.Init; //init the rectange (makes an svg path from it)
- polyrect.Polygon.Tesselate; //optianaly tesselate the object (does get auto called on first time rendering)