iphone - How to draw a triangle with QUARTZ 2D? -
i'm developing iphone app 3.1.3 sdk.
i'm trying draw triangle transparent fill 1px black stroke code:
cgcontextmovetopoint(ctx, position.x, position.y - (size.height / 2)); cgcontextaddlinetopoint(ctx, position.x - (size.width / 2), position.y + (size.height / 2)); cgcontextaddlinetopoint(ctx, position.x + (size.width / 2), position.y + (size.height / 2)); cgcontextfillpath(ctx); cgcontextsetlinewidth(ctx, 1.0); cgcontextstrokepath(ctx); cgcontextsetfillcolorwithcolor(ctx, [[uicolor clearcolor] cgcolor]);
but black filled triangle.
what doing wrong?
if want draw path transparent fill - don't need fill - stroke when draw, seems cgcontextfillpath method redundant - remove it:
cgcontextmovetopoint(ctx, position.x, position.y - (size.height / 2)); cgcontextaddlinetopoint(ctx, position.x - (size.width / 2), position.y + (size.height / 2)); cgcontextaddlinetopoint(ctx, position.x + (size.width / 2), position.y + (size.height / 2)); cgcontextsetlinewidth(ctx, 1.0); cgcontextstrokepath(ctx);
Comments
Post a Comment