IOS zeichnen eines einfachen Bildes wird unscharf mit Xamarin C#

Ich bin in der Entwicklung in Xamarin und möchte zeichnen Sie einen einfachen Kreis mit dem text "KREIS" drin das Bild und zeigen es in einem UIImageView. Das problem ist, dass der Kreis und der text erscheinen sehr verschwommen. Ich habe gelesen, ein bisschen über die Subpixel aber ich glaube nicht, dass das mein problem.

Hier ist das verschwommene Bild und code, in der Hoffnung, jemand hat ein paar Ideen 🙂

UIGraphics.BeginImageContext (new SizeF(150,150));
var context = UIGraphics.GetCurrentContext ();

var content = "CIRCLE";
var font = UIFont.SystemFontOfSize (16);

const float width = 150;
const float height = 150;

context.SetFillColorWithColor (UIColor.Red.CGColor);
context.FillEllipseInRect (new RectangleF (0, 0, width, height));

var contentString = new NSString (content);
var contentSize = contentString.StringSize (font);

var rect = new RectangleF (0, ((height - contentSize.Height) / 2) + 0, width, contentSize.Height);

context.SetFillColorWithColor (UIColor.White.CGColor);
new NSString (content).DrawString (rect, font, UILineBreakMode.WordWrap, UITextAlignment.Center);

var image = UIGraphics.GetImageFromCurrentImageContext ();
imageView.Image = image;

IOS zeichnen eines einfachen Bildes wird unscharf mit Xamarin C#

InformationsquelleAutor Click Ahead | 2013-04-08
Schreibe einen Kommentar