0
是否有人知道如何在MonoMac中填充圖案,此代碼不會遺漏任何內容。它甚至不稱爲繪製模式。任何幫助將是真棒:d如何在MonoMac中填充圖案
void DrawPattern (CGContext NewContext)
{
Console.WriteLine("Drawing Pattern?");
NewContext.SetFillColor(new CGColor(1,0,0));
NewContext.FillRect(new RectangleF(0,0,5,5));
}
public void FillPatternPath (CGContext MyCanvas,CGPath Path)
{
MyCanvas.SaveState();
CGPath NewPath=Path.GetCGPath();
MyCanvas.AddPath (NewPath);
RectangleF PBounds=MyCanvas.GetPathBoundingBox();
MyCanvas.EOClip();
CGColorSpace patternSpace = CGColorSpace.CreatePattern(null);
MyCanvas.SetFillColorSpace(patternSpace);
CGPattern Pat=new CGPattern(PBounds,CGAffineTransform.MakeIdentity(),10,10,CGPatternTiling.ConstantSpacing,true,new CGPattern.DrawPattern(DrawPattern));
MyCanvas.SetFillPattern(Pat,new float[]{1f});
MyCanvas.FillRect (PBounds);
patternSpace.Dispose();
MyCanvas.RestoreState();
}
忽略此行開始,對不起。 CGPath NewPath = Path.GetCGPath(); – 2012-08-22 07:11:54