Alex Muller
Alex Muller

Reputation: 1565

iPhone - is CGContextSetStrokeColorWithColor not creating wanted color?

I am having some weird troubles with drawing some lines in an application. My drawRect is using

CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetStrokeColorWithColor(context, [UIColor colorWithRed:57 green:172 blue:255 alpha:1].CGColor]);
CGContextSetAlpha(context, 0.8);
CGContextSetLineWidth(context, POLYLINE_WIDTH);

The color that is supposed to be shown is something like this. However I am getting a dark grey color, does anyone know why this color could be getting skewed?

Upvotes: 2

Views: 3433

Answers (1)

EricLeaf
EricLeaf

Reputation: 902

Try

CGContextSetStrokeColorWithColor(context, [UIColor colorWithRed:57 / 255 green:172 / 255 blue:255 / 255 alpha:1].CGColor]);

These functions are expecting a number from 0-1.

Upvotes: 2

Related Questions