![]() |
|
EasyToUse Dynamic Color Gradiant Generator |
Dennis
Member #1,090
July 2003
![]() |
[EDIT] http://homepages.compuserve.de/DennisTapier/allegroforum/COLGRAD.PNG The above pic was created by just these few lines: init_ca_list(&test1); add_to_ca_list(&test1,POINT,0,0, 255,255,0, 500); add_to_ca_list(&test1,POINT,639,479,0,255,0,500); add_to_ca_list(&test1,POINT,320,240,0,0,255,500); add_to_ca_list(&test1,GLOBAL,40,0,255,255,255,0); render_col_grad_to_bitmap(backb,&test1); kill_ca_list(&test1); Fully self documented C-sources + precompiled win32 binary(with more examples) is attached. Share your creations by posting your own EXAMPLE BLOCKS(see inside "main" in code).8-). Have fun! --- 0xDB | @dennisbusch_de --- |
Edward Sheets
Member #4,734
June 2004
![]() |
Looks good, Dennis Maybe you can tweak your code to make it do some funky gradients like Phipps does in Sunny Ball --- Note: carving a pentagram on the top of a container of spoiled yogurt does not summon a yogurt demon. -Kikaru |
Dennis
Member #1,090
July 2003
![]() |
I've downloaded SunnyBall to see them...(but i will be too tired today to check it out...yawn, will, go, to, sleep, in, a ,minute...) [edit] --- 0xDB | @dennisbusch_de --- |
miran
Member #2,407
June 2002
|
Nice. I made a GUI for this thing: here (535 kB). It's based on my own attempt to figure out how Sunny Ball gfx were made (I was way off btw.) It's C++ source code + statically linked Windows binary + all the original examples EDIT: Forgot to mention it. I changed x,y and range from absolute values to relative ones typically in the range 0-1 so the gradients can be scaled more easily. -- |
Neil Walker
Member #210
April 2000
![]() |
So how do you change any of the values, it always enters values of .5 .5 .5 no matter what you enter as the positions/range. Neil. Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
miran
Member #2,407
June 2002
|
First you add an attractor or two. Then select the attractor whose values you want to change. Then you type new values in with the keyboard. When you're finished typing you press enter. -- |
Dennis
Member #1,090
July 2003
![]() |
miran said: Nice. I made a GUI for this thing: here (529 kB).
Great miran! miran said: I changed x,y and range from absolute values to relative ones typically in the range 0-1 so the gradients can be scaled more easily.
Have not tried the GUI yet... i hope it's possible to enter values outside that range because the generator supports "color attractors" that are outside of the actual bitmap.;) --- 0xDB | @dennisbusch_de --- |
miran
Member #2,407
June 2002
|
Yeah, it's possible to enter any value. Btw, I didn't change your code (other than to separate it into .h and .cpp files and make it compile as C++), I just added an extra layer between the GUI and your code. Oh and attached are a few more examples -- |
Dennis
Member #1,090
July 2003
![]() |
Wooohooo, Miran, I love your GUI.:) Attached is my newest creation "pearls", which is now(thanks to the cool export feature) my desktop background.8-) crits and usability improvement suggestions(i know lots of work;D):
After all, i think your GUI is so cool that actually the whole thing could already be considered a very useful utility. --- 0xDB | @dennisbusch_de --- |
da_flo
Member #1,907
February 2002
![]() |
I quickly read the source, and the concept is simple and yet the result is impressive ! When I am less tired I'll really look at it. That might motivate me to play myself with my own graphics effect. Yeah I haven't coding in a while, that ought to make me in the mood for speedhack. |
Dennis
Member #1,090
July 2003
![]() |
Make sure you don't miss Miran's GUI for it. It really makes creation easier.;) --- 0xDB | @dennisbusch_de --- |
da_flo
Member #1,907
February 2002
![]() |
Indeed. I used Miran's GUI right from the beginning. I had never tried MASkinG before... I have a program based on the allegro GUI, and I'm now considering using MASkinG instead of porting it to wxWidgets. (and yeah I know, Qt4 rules too, but I got through all the hassle learning wxWidgets, so I might stick with it too [EDIT] (I hope this will be noticeable enough Hey I had an idea to play with your gradient algorithm, Dennis. I love maths and when I have a model or an algorithm, I like to generalize it and play with various parameters. I was thinking to let the user choose the distance function used in the algorithm. We could use a distance function pointer, and let the user choose between several examples of distances, shown in a listbox. I have some examples of classical distances in topology : N1(x,y) = |x| + |y| Norm 2 (euclidian distance) : N2(x,y) = sqrt(x^2 + y^2) Norm p : Np(x,y) = (|x|^p + |y|^p)^(1/p) Norm infinity : Ninfinity(x,y) = max(|x|,|y|)
I we use only those norms, we can even use a N(p, x, y) function rather than a function pointer, passing p=-1 for Ninfinity. What do you think of this idea ? |
miran
Member #2,407
June 2002
|
Dennis: Updated to version 1.02. Redownload from the link in my first post! da_flo: Won't be too difficult to add. Just add another field to the CA_DESC struct, modify distance_to_ca() and update the GUI -- |
Edward Sheets
Member #4,734
June 2004
![]() |
Quote: i could not see any gradients that could not easily be created by my generator
Yeah, I was probably wrong. I was referring to the tiles and background gfx in SunnyBall. There's been speculation as to how Phipps creates those gfx. Maybe gradient is the wrong word for that effect..? Anyhow, it's probably best if we don't anger Phipps by trying to hack into his mind and emulate his methods. --- Note: carving a pentagram on the top of a container of spoiled yogurt does not summon a yogurt demon. -Kikaru |
Richard Phipps
Member #1,632
November 2001
![]() |
I'm constantly surprised by people's interest in the gfx engine used in Sunny Ball. I suppose I should be flattered! This was several years ago (sorry guys!), here is one of the first mock up images I did (dated 18th March 2002): http://www.reflectedgames.com/Images/mockup_screen.png Unfortunately there would have been a lot of art to do and I am not an artist. Perhaps some day.. Anyway, the technique is not too difficult to do and pretty easy to figure out how it works IMHO. Having said that, while it is useful it does have some limitations so I wouldn't use it for many types of games. |
Neil Walker
Member #210
April 2000
![]() |
I guess two questions. 1. How fast is it in realtime for generating a full screen bitmap (as in does it have to be pre-rendered to a bitmap outside of any timer loop) 2. Has anyone tried doing any blending over images? I'm thinking something like this effect would be cool: http://images.amazon.com/images/P/B000002LRJ.01._SCLZZZZZZZ_.jpg Attached is my closest rendition [edit] Neil. Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
Dennis
Member #1,090
July 2003
![]() |
da_flo: Richard(thanks for following the invitation): miran said: All your wishes have been implemented, except for number 3. Thanks alot, i will try it out.:) Neil said: It would be nice to be able to move the attracters up/down as I added black at the end but it never shows, I need it to be at the start.
The position of any attractor inside the list has no effect to the result. Black never shows because of the mixing method that my attractors only evers ADDS fractions of colors. But i could invent detractors that would take away fractions of colors but then list position would matter and that would require too much work for now(i'm even more lazy than miran;)) [edit]hm...maybe list position would not matter if i let negative color values stay valid until the call to putpixel...[/edit] --- 0xDB | @dennisbusch_de --- |
miran
Member #2,407
June 2002
|
Quote: The position of any attractor inside the list has no effect to the result. Black never shows because of the mixing method that my attractors only evers ADDS fractions of colors. But i could invent detractors that would take away fractions of colors but then list position would matter and that would require too much work for now(i'm even more lazy than miran;) I already added the ability to move attractors up and down in the list. It's just that I disabled it (as in commented the relevant code out) because I realized the order has no effect. As for different blenders, that would be a good idea. Having just ADD is kind of limiting, because you can't darken a part of the image. Every attractor just adds to the colour and moves it towards white. I don't know exactly how those blenders I have in my PSP work, but there are many of them: multiply, screen, dissolve, dodge, burn, overlay, hard light, soft light, etc. Another thing that you could make is add linearity to POINT, VBAR and HBAR (I don't know if linearity is the right word). Right now the gradients are fully linear, that is, at the centre of the point you have full colour, then it fades linearly towards the edge. You'd get a lot more flexibility if you could define how fast or slow the gradinet should fade. If you know what I mean -- |
Dennis
Member #1,090
July 2003
![]() |
I think i know what you mean miran(it involves calculus, in which i'm not very good...) you want a function for each attractor that calculates its' intensity influence in relation to distance(currently this is linear because just the plain distance is calculated). For a first small improvement, i will look into adding support for SUBTRACT(color "absorbers") now, so that areas can be darkened(i will implement this in a way that list positions will not matter) and the funny thing will be that the absorber will work like mixing but in the opposite direction(as in: I'm an absorber and i'm very selective about what color fractions i'll take away.:)) I think i've found a BUG:( in the FileSaving Dialog: da_flo: Attached are some more simple examples and an iconized version of miran's "flair" to replace that AlexAllegator icon. --- 0xDB | @dennisbusch_de --- |
miran
Member #2,407
June 2002
|
I added linearity settings About the file selector bug, I know about that, I've know abotu it for a long time. Will fix some day... EDIT: And now version 1.04 is up. You can now place attractors by clicking on the preview. Left click moves the attractor, right click defines range. You can only move inside the image though... -- |
Neil Walker
Member #210
April 2000
![]() |
Lovely. Now, don't get me wrong here, but while Masking looks very pretty, the interface is crap. Unless its just a coding thing? What I see thats wrong is the focus automatically selects a field when you go over it. so, you're typing into a box and nudge the mouse, all of a sudden you're typing into the next box! the other annoying this is whenever I select a field to start typing I always two characters of the key I've pressed. Neil. Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
miran
Member #2,407
June 2002
|
This is configurable. For key repeat and delay open allegro.cfg and modify the relevant fields. For example: keyDelay = 300 keyRepeat = 150 For focus changing when mouse moves open the skin file (skins/kde2.ini) and change focus=1 to focus=2. Btw, this is very similar as in the built-in Allegro GUI... -- |
Dennis
Member #1,090
July 2003
![]() |
I will check your code later miran(to see if i can incorporate your changes into mine). (i'll just post what i have made while i was offline) Showing example one of the old version plus an added ABSORBER absorbing everything(color(255,255,255)). New version 2 is attached(sources + precompiled statically linked win32 binary). NEW Features: -Color ABSORBER -Effect Modifier (*experiment with this to find out how it affects the colors*) Where in the previous version "distance" was used to calculate the effect, now "effect_modifier" is used. It is calculated as effect_modifier = p * distance^exp. p and exp are set individually for each ATTRACTOR. (set p=1.0 and exp=1.0 to get the same behaviour as in version1)
--- 0xDB | @dennisbusch_de --- |
miran
Member #2,407
June 2002
|
Heh, your exp in the effect modifier is my linearity -- |
Dennis
Member #1,090
July 2003
![]() |
Does that eliminate my need to look at your code?;) --- 0xDB | @dennisbusch_de --- |
|
|