brightness (darkness) confusion?

Please check here FIRST if you are having difficulties with Context Free. This forum contains answers to the most common questions users have.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
User avatar
minimaleye
Posts: 14
Joined: Sat Jan 22, 2011 1:03 am

brightness (darkness) confusion?

Post by minimaleye »

the Reference_Card wrote:saturation num sat num
brightness num b num
alpha num a num

Range [-1,1]. If num < 0 then change the drawing saturation, brightness, or alpha by the proportion num toward 0. If num > 0 then change it by the proportion num toward 1.
It's working perfectly for me when the things are going from darkness to brightness but the other way seems to be broken. OK I'm not sure is it CFA issue or just mine..

here is an example:

Code: Select all

startshape balance 

background {b -1}

rule balance {
	bright {}
	dark { f 90 y -1.382}
}

rule bright {
	SQUARE {b .5}
	bright {s .618 x .5 y 1 b .24} 
	bright {s .618 x -.5 y 1 b .24} 
}

rule dark {
	SQUARE {b .5}
	dark {s .618 x .5 y -1 b -.24}
	dark {s .618 x -.5 y -1 b -.24}
}
Image and here is the image that its gave...

As you can see the upper part goes from 50% gray to white but the lower part remains constantly gray nevertheless it should go to black.

Am I doing something wrong! Pls help... Its the same with transparency - it cant go from transparent to non transparent.

Im windows7 u(lo)ser e-e and playing with CF 2.2.2 (v20)
there is no end...
...therefore there isn't now and here

User avatar
MtnViewJohn
Site Admin
Posts: 871
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: brightness (darkness) confusion?

Post by MtnViewJohn »

Rule dark does go all the way to zero brightness, but each SQUARE has b 0.5, which takes it back up to 50% dark. You need to move the b 0.5 up to rule balance:

Code: Select all

startshape balance 

background {b -1}

rule balance {
   bright {b 0.5}
   dark { f 90 y -1.382 b 0.5}
}

rule bright {
   SQUARE {}
   bright {s .618 x .5 y 1 b .24} 
   bright {s .618 x -.5 y 1 b .24} 
}

rule dark {
   SQUARE {}
   dark {s .618 x .5 y -1 b -.24}
   dark {s .618 x -.5 y -1 b -.24}
}

User avatar
minimaleye
Posts: 14
Joined: Sat Jan 22, 2011 1:03 am

Re: brightness (darkness) confusion?

Post by minimaleye »

hmm thats pity...
cause let say we have one-rule design, lets say the above example but without balance and bright rules... Is it possible the root SQUARE to be 50% gray and to fractal itself towards black somehow?
and if yes - how? for now I'm using photoshop to invert the image brightness..
there is no end...
...therefore there isn't now and here

User avatar
MtnViewJohn
Site Admin
Posts: 871
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: brightness (darkness) confusion?

Post by MtnViewJohn »

The next version will let you put the 50% gray in the startshape line. But with the current version you will need two rules.

User avatar
minimaleye
Posts: 14
Joined: Sat Jan 22, 2011 1:03 am

Re: brightness (darkness) confusion?

Post by minimaleye »

hope it will come soon - I'm addicted ^_^

Thank you very much for the fast respond and wish you fun doing the next version of CFA...

If I can make a suggestion - It will be nicer if the values of brightens, alpha and saturation are between 0 and 100...

0 = white, completely opaque and completely desaturated
100 = black, completely transparent and completely saturated

It will make the work with those parameters much easier and similar to the work with hue, which will unlock a lot of opportunities...
there is no end...
...therefore there isn't now and here

User avatar
MtnViewJohn
Site Admin
Posts: 871
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: brightness (darkness) confusion?

Post by MtnViewJohn »

I can't change the range for brightness, etc. without breaking existing cfdg files. But I can add percentages to the parser so that you can write foo{b 5%} instead of foo{b 0.05}.

User avatar
minimaleye
Posts: 14
Joined: Sat Jan 22, 2011 1:03 am

Re: brightness (darkness) confusion?

Post by minimaleye »

It's really not so important what range of values those parameters have... [-1, 1]; [0, 100] or [0%, 100%] etc.
0 to 100 is the most common range for the transition from white to black color in most of the graphic softs around... this is the reason why I think it will be more comfortable for wide range of people to use 0 to 100...

in 2.2.2 we have two different values for 50% gray:
    when in shape - {b 0.5} when in background - {b -0.5}
I personally found this kind confusing... and the "go brighter and no go darker" thing too :)

If at least this two things are fixed in the next version I will fly... if you can add the opportunity to loop brightness and alpha by the same (or similar) way like the hue - that will be just great!
there is no end...
...therefore there isn't now and here

User avatar
MtnViewJohn
Site Admin
Posts: 871
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: brightness (darkness) confusion?

Post by MtnViewJohn »

The new percentage constants are not going to change that, they are just syntactic sugar. Color changes are always relative to the current color. In the beginning the default shape color is black and the default background color is white.

Post Reply