[Recolor] Re-painting the 'gimpcolorwheel'
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.
Okay guys, no need for the above said approaches, I took care of it using saturation adjustment itself. :) Here's a snapshot: [image: Inline image 1]
On Sat, Jun 15, 2013 at 11:10 PM, Arshdeep Singh <moduli16@...400...> wrote:
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.
-- Arshdeep Singh Third Year, Computer Engineering Delhi Technological University Ph: +91-9654115614 https://sites.google.com/site/adsingh1729/home
One thing... Could do the same whith outer cirle and black? Hi, Jabier.
El dom, 16-06-2013 a las 00:17 +0530, Arshdeep Singh escribió:
Okay guys, no need for the above said approaches, I took care of it using saturation adjustment itself. :) Here's a snapshot: Inline image 1
On Sat, Jun 15, 2013 at 11:10 PM, Arshdeep Singh <moduli16@...400...> wrote: Hello devs, My current state of the wheel looks like this: 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. -- Arshdeep Singh Third Year, Computer Engineering Delhi Technological University Ph: +91-9654115614 https://sites.google.com/site/adsingh1729/home
-- Arshdeep Singh Third Year, Computer Engineering Delhi Technological University Ph: +91-9654115614 https://sites.google.com/site/adsingh1729/home
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
participants (2)
-
Arshdeep Singh
-
Jabiertxo Arraiza Cenoz