我想画一个六边形,这是我的代码
int mgX = penThickness * 6;
int mgY = penThickness * 2;
CGPoint st = CGPointMake(MIN(startingPt.x, endingPt.x),
MIN(startingPt.y, endingPt.y));
CGPoint et = CGPointMake(MAX(startingPt.x, endingPt.x),
MAX(startingPt.y, endingPt.y));
CGRect outsideRect = CGRectMake(st.x,st.y, MAX(mgX, et.x-st.x),
MAX(mgY, et.y-st.y));
CGRect insideRect = CGRectInset(outsideRect, outsideRect.size.width * 0.40f,
outsideRect.size.height * 0.30f);
CGPathMoveToPoint(pathRef, nil, CGRectGetMinX(outsideRect),
CGRectGetMinY(outsideRect));
//0
CGPathAddLineToPoint(pathRef, nil, CGRectGetMaxX(insideRect),
CGRectGetMinY(outsideRect));
//1
CGPathAddLineToPoint(pathRef, nil, CGRectGetMaxX(outsideRect),
CGRectGetMidY(insideRect));
//2
CGPathAddLineToPoint(pathRef, nil, CGRectGetMaxX(insideRect),
CGRectGetMaxY(outsideRect));
//3
CGPathAddLineToPoint(pathRef, nil, CGRectGetMinX(outsideRect),
CGRectGetMaxY(outsideRect));
//las line
CGPathAddLineToPoint(pathRef, nil, CGRectGetMidX(outsideRect),
CGRectGetMidY(outsideRect));
任何人请帮助我。