Ich hab nun gefunden was ich brauche, aber leider nur in Objective-C.
Hier ist der Code.
In Delphi übersetzt sieht das so aus:
Delphi-Quellcode:
procedure TForm1.UIView1DrawRect(Sender: TObject; ARect: TRectF);
var context: CGContextRef;
dim: Double;
subdiv: Integer;
r,g: Double;
halfinteriorPerim: Double;
halfexteriorPerim: Double;
smallBase: Double;
largeBase: Double;
cell: UIBezierPath;
incr: Double;
n: Integer;
rect: CGrect;
begin
rect:= CGrectMake(aRect.Location.X,aRect.Location.Y,aRect.Size.Width,aRect.Size.Height);
context:= UIGraphicsGetCurrentContext();
TUIColor.Wrap(TUIColor.OCClass.whiteColor).setFill;
UIRectFill(rect);
dim:= MIN(rect.size.width, rect.size.height);
subdiv:= 512;
r:= dim/4;
g:= dim/2;
halfinteriorPerim:= PI*r;
halfexteriorPerim:= PI*g;
smallBase:= halfinteriorPerim/subdiv;
largeBase:= halfexteriorPerim/subdiv;
cell:= TUIBezierPath.Wrap(TUIBezierPath.Alloc.CGPath);
cell.moveToPoint(CGPointMake(-smallBase/2,r));
cell.addLineToPoint(CGPointMake(smallBase/2,r));
cell.addLineToPoint(CGPointMake(largeBase/2,g));
cell.addLineToPoint(CGPointMake(-largeBase/2,g));
cell.closePath;
incr:= PI/subdiv;
//[[NSColor whiteColor]set];
// CGContextRef ctx = [[NSGraphicsContext currentContext] graphicsPort];
CGContextTranslateCTM(context, rect.size.width/2, rect.size.height/2);
CGContextScaleCTM(context, 0.9, 0.9);
CGContextRotateCTM(context,PI/2);
CGContextRotateCTM(context,-incr/2);
for n:= 0 to subdiv do
begin
TUIColor.Wrap(TUIColor.OCClass.blueColor).setFill;
cell.fill;
cell.stroke;
CGContextRotateCTM(context,-incr);
end;
end;
Funktioniert nur nicht ^^
Weiß jemand warum?