AddRect() public method

public AddRect ( RectangleF rect ) : void
rect System.Drawing.RectangleF
return void
Exemplo n.º 1
0
 public static void FillRect(CGContext context, RectangleF rect, CGColor color)
 {
     context.SaveState();
     context.AddRect(rect);
     context.Clip();
     context.SetFillColor(color);
     context.FillRect(rect);
     context.RestoreState();
 }
Exemplo n.º 2
0
 public static void DrawRect(CGContext context, RectangleF rect, CGColor color, float lineWidth)
 {
     context.SaveState();
     context.AddRect(rect);
     context.Clip();
     context.SetLineWidth(lineWidth);
     context.SetStrokeColor(color);
     context.StrokeRect(rect);
     context.RestoreState();
 }
Exemplo n.º 3
0
 public static void FillGradient(CGContext context, RectangleF rect, CGColor color1, CGColor color2, bool isHorizontal)
 {
     CGGradient gradientBackground;
     CGColorSpace colorSpace = CGColorSpace.CreateDeviceRGB();
     
     float[] locationListBackground = new float[] { 1.0f, 0.0f };
     List<float> colorListBackground = new List<float>();
     colorListBackground.AddRange(color1.Components);
     colorListBackground.AddRange(color2.Components);
     gradientBackground = new CGGradient(colorSpace, colorListBackground.ToArray(), locationListBackground);
     
     context.SaveState();
     context.AddRect(rect);
     context.Clip();
     //context.ScaleCTM(1, -1);
     if(isHorizontal)
         context.DrawLinearGradient(gradientBackground, new PointF(rect.X, rect.Y), new PointF(rect.X + rect.Width, rect.Y + rect.Height), CGGradientDrawingOptions.DrawsBeforeStartLocation);
     else
         context.DrawLinearGradient(gradientBackground, new PointF(0, 0), new PointF(0, rect.Height), CGGradientDrawingOptions.DrawsBeforeStartLocation);
     context.RestoreState();
 }