public override void FillRect(double x, double y, double width, double height, DColor color, double alpha, DFillStyle fillStyle) { CairoSetPattern(cr, color, alpha, fillStyle); cr.Rectangle(x, y, width, height); cr.Fill(); }
void CairoSetPattern(Context cr, DColor color, double alpha, DFillStyle fillStyle) { switch (fillStyle) { case DFillStyle.ForwardDiagonalHatch: Surface patSurf = cr.Target.CreateSimilar(Content.ColorAlpha, 7, 7); Context patCr = new Context(patSurf); patCr.SetSource(MakeColor(color, alpha)); patCr.LineWidth = 1; patCr.MoveTo(0, 0); patCr.LineTo(7, 7); patCr.Stroke(); SurfacePattern pat = new SurfacePattern(patSurf); pat.Extend = Extend.Repeat; cr.SetSource(pat); ((IDisposable)patCr).Dispose(); ((IDisposable)patSurf).Dispose(); break; default: cr.SetSource(MakeColor(color, alpha)); break; } }
public abstract void FillRect(double x, double y, double width, double height, DColor color, double alpha, DFillStyle fillStyle);
public override void FillRect(double x, double y, double width, double height, DColor color, double alpha, DFillStyle fillStyle) { UpdateMaxNumOfObjects(1); CreateBrushIndirect(1, color); SelectObject(1); SelectObject((uint)Emf.StockObject.NULL_PEN); Rectangle(x, y, width, height); DeleteObject(1); }
public override void FillRect(double x, double y, double width, double height, DColor color, double alpha, DFillStyle fillStyle) { CreateBrushIndirect(color); SelectObject(0); CreatePenIndirect(); SelectObject(1); RectShape(Wmf.Rectangle, (ushort)x, (ushort)y, (ushort)width, (ushort)height); DeleteObject(1); DeleteObject(0); }
// Helper Functions // Brush MakeBrush(DFillStyle fillStyle, DColor color, double alpha) { switch (fillStyle) { case DFillStyle.ForwardDiagonalHatch: return new HatchBrush(HatchStyle.ForwardDiagonal, WFHelper.MakeColor(color, alpha), Color.FromArgb(0, Color.Red)); default: return new SolidBrush(WFHelper.MakeColor(color, alpha)); ; } }
public override void FillRect(double x, double y, double width, double height, DColor color, double alpha, DFillStyle fillStyle) { g.FillRectangle(MakeBrush(fillStyle, color, alpha), (float)x, (float)y, (float)width, (float)height); }