![]() |
|
color picker |
karistouf
Member #5,126
October 2004
![]() |
hum... hi all! {"name":"Triangulo_HSV.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/d\/3dea04cb277c3c5280a768e8b9cb7c23.png","w":347,"h":347,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/d\/3dea04cb277c3c5280a768e8b9cb7c23"} "step by step" |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Drawing the hue circle should be easy : The saturation and value triangle will be more difficult and you will probably have to redraw it each time the hue changes unless you limit the different number of hues allowed. For example 360 different pre-drawn saturation value triangles might not be too much of a strain on memory, but it depends on how large they are. The triangle itself is basically composed of a set of gradient line segments that get shorter and shorter as you move down and left in the triangle. I would write my own gradient line function for it. Pass the function the hue and the value of the current line and inside the function vary the saturation from 0.0 at one end gradually up to 1.0 at the other end of the line segment. Repeat this for each line the triangle is composed of, varying the color value as you move down and left. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Johan Halmén
Member #1,550
September 2001
|
Isn't there some Gouraud routines for drawing triangles in Allegro? You set the colour of each vertex of the triangle. Black, white, full saturated hue. Then let Allegro draw it. [edit] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest. |
karistouf
Member #5,126
October 2004
![]() |
Quote: Drawing the hue circle should be easy completely agriing Edgardo. But for the triangle I have NO idea about how to proceed. neither how to use a vector to print to screen the result of calculation in pixels. does anybody knows where the libs that were on allegro once gone ? : altheme / http://www.allegro.cc/go.php?http://www.the-good-stuff.freeserve.co.uk/allegro/gui/mage/ ? "step by step" |
Don Freeman
Member #5,110
October 2004
![]() |
Gimp is open source, so you COULD take a look at the source code to see how they do it.::) I don't really have a clue off hand how to do the triangle...the circle would be relatively easy. -- |
TheFayl
Member #8,641
May 2007
![]() |
Quote: You set the colour of each vertex of the triangle. For sure OpenGL can do it. glBegin(GLTRIANGLES); glColor(somecolor); glVertex(coords); glColor(somecolor); glVertex(coords); glColor(somecolor); glVertex(coords); glEnd();
Well, or something like this. |
gnolam
Member #2,030
March 2002
![]() |
Johan Halmén said: Isn't there some Gouraud routines for drawing triangles in Allegro? You set the colour of each vertex of the triangle. Black, white, full saturated hue. Then let Allegro draw it. [edit] Yes there is.void triangle3d_f(BITMAP *bmp, int type, BITMAP *tex, V3D_f *v1, *v2, *v3);With POLYTYPE_GCOL as the type. You'll have to check for yourself if it can be used as-is for a WYSIWYG color picker though. As for the rest of the implementation: I assume you're familiar with barycentric coordinates? If not, read up on them now... -- |
Johan Halmén
Member #1,550
September 2001
|
I'd do the triangle like this: Another way would be to draw the gouraud rectangle and mask it to a triangle and rotate_blit it. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest. |
karistouf
Member #5,126
October 2004
![]() |
thxs... i keep you in touch about this.... "step by step" |
SiegeLord
Member #7,827
October 2006
![]() |
I'm a little confused why you are ignoring gnolam's suggestion... but I guess if you are willing to wait, I'll have a gouraud shaded triangle ready in a day or two for A5, and I can give it to you. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Johan Halmén
Member #1,550
September 2001
|
Yes, don't use my re-invented wheel. Do what Gnolam said. This I did in 4 minutes. The actual colour picking I would do with getpixel from that triangle. It won't contain all possible values in RGB space, at least the Gimp colour picker is so small that it skips over a lot of values stepping from one pixel to the next. But that can be adjusted with the sliders, if you have a slider for each channel. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest. |
Evert
Member #794
November 2000
![]() |
Assuming you drew it correctly, that triangle is basically a wedge out the (V, S) plane, tilted at an odd angle. |
Johan Halmén
Member #1,550
September 2001
|
My code:
So I just threw some coordinates there. For each vertex z is zero. It was by no means an equilateral triangle. It would have taken some more minutes to find out the coordinates for it. I would probably use a class I have for rotating coordinates. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest. |
karistouf
Member #5,126
October 2004
![]() |
woaw... quickly done ! thanks a lot for all your help. merci one thosuand times:):):)! "step by step" |
GullRaDriel
Member #3,861
September 2003
![]() |
barywhitecentric: I am perhaps the only one to get that one as it should be, hilarious ! C'est quand même cool le forum allegro, il est rare de ne pas y trouver de l'aide ou une direction pour chercher ! "Code is like shit - it only smells if it is not yours" |
|