Hello devs, My current state of the wheel looks like this: [image: Inline image 1]
I want a white center that blends into the respective colors towards the circumference. Here's a snippet from gimpcolorwheel.c *Function :* static void paint_ring (GimpColorWheel *wheel, cairo_t *cr) { ...}
Snippet: *for (yy = 0; yy < height; yy++)* * {* * p = buf + yy * width;* * dy = -(yy - center_y);* * * * for (xx = 0; xx < width; xx++)* * {* * dx = xx - center_x;* * * * dist = dx * dx + dy * dy;* * if (dist < ((inner-1) * (inner-1)) || dist > ((outer+1) * (outer+1)))* * {* * *p++ = 0;* * continue;* * }* * * * angle = atan2 (dy, dx);* * if (angle < 0.0)* * angle += 2.0 * G_PI;* * * * hue = angle / (2.0 * G_PI);* * * * r = hue;* * g = 1.0;* * b = 1.0;* * hsv_to_rgb (&r, &g, &b);* * * * *p++ = (((int)floor (r * 255 + 0.5) << 16) |* * ((int)floor (g * 255 + 0.5) << 8) |* * (int)floor (b * 255 + 0.5));* * }* * }* * * this paints the colors of the wheel. Because we need to paint the center white, we have two options: ( I suppose ? ) One is to include a distance from the center that shall be the faintest white from the center We can choose this distance to be 20% of the radius allocated. This white coloration can be accommodated into the above snippet but what I fail to solve is how to add the transparency ? Should I calculate a separate 'buf' that is then OR-ed (overlaid) with the 'p' buffer to create that effect ?
OR
I can create a smaller circular arc and use radial gradient (white at center and transparent at circumference , radius again 20% ) and overlay onto the same surface used to draw the initial color wheel as shown in the picture above.
I personally feel, the second option is easier because the first option would require to know how rgb changes when a certain degree of white is added to it. Your views are looked forward to. Thanks.