Colors in app different than the image they're based on

Go To StackoverFlow.com

1

I'm creating a coloring book app for a client and it's coming along well. Very well, in fact, because it's finished. However there's one snag: some of the colors aren't displaying as expected.

The client gave me images and a key to use for the brush creation. I took the color reference and made several different sizes of circle to use, for each color, to represent different brush sizes. I then load the brush as so:

    brush = [[CCSprite spriteWithFile:@"yellowbrush3.png"] retain];
    [brush setBlendFunc: (ccBlendFunc) { GL_ONE, GL_ONE_MINUS_SRC_ALPHA }];  
    [brush setOpacity:20];

The brush image for this particular file is:

Yellow brush

I made a screenshot of the colors output to compare with the key I used to create the brushes:

Several color swatches

About half of the colors show up just fine while the others are pretty noticeable.

I've tried different levels of opacity, changing some GL settings, but nothing seems to help.

2012-04-04 19:51
by Jason McMaster
On the plus side, black looks good - John Riselvato 2012-04-04 20:24


2

This is due to a blending artifact and the fact that you are drawing on a white background. To confirm this, alter the background color and see that the hue for each color changes slightly. To correct this issue you can reduce the opacity of the painted colors, or pick a more appropriate blending mode.

Try changing your glBlendFunc to use GL_ONE for both parameters. This will remove the blending but at least your colors should be 100% accurate.

2012-04-04 21:13
by Sam
I kind of figured this was this issue. I'm trying a bunch of different styles. I really like the effect it gives, just wish the colors weren't screwed u - Jason McMaster 2012-04-05 15:10
Awesome, thanks! I haven't got them all to exactly where I wanted, but with some messing around I'm steadily fixing it - Jason McMaster 2012-04-05 16:21
Ads