sabit / tint2

Automatically exported from code.google.com/p/tint2
GNU General Public License v2.0
0 stars 0 forks source link

Gradient backgrounds #245

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Would be great if task items could have gradient backgrounds based on a
provided start and end colour.

Original issue reported on code.google.com by airtonix@gmail.com on 16 Apr 2010 at 1:39

GoogleCodeExporter commented 9 years ago

Original comment by thilo...@gmail.com on 18 Apr 2010 at 8:41

GoogleCodeExporter commented 9 years ago
I was just thinking the same as airtonix :)
I use tint2 with openbox and I spent some time yesterday to "fix" the 
appearance of
my panel and a openbox theme that I like: my solution was to "flatten" all 
gradient
in openbox, but I'd rather applied them to tint2...
Openbox themes have the color/colorTo options for their single elements, and it 
would
be perfect if this functionality can be introduced in tint2 for its singles
components (clock, tray, taskbar, tasks, etc).

Original comment by fairpoin...@gmail.com on 19 Apr 2010 at 4:48

GoogleCodeExporter commented 9 years ago
imlib2 supports linear gradients.

Radial gradients would be nice too.

Original comment by mrovi9...@gmail.com on 1 Feb 2015 at 10:16

GoogleCodeExporter commented 9 years ago
Related: issue 393.

Original comment by mrovi9...@gmail.com on 2 Feb 2015 at 12:08

GoogleCodeExporter commented 9 years ago

Original comment by mrovi9...@gmail.com on 3 Feb 2015 at 10:58

GoogleCodeExporter commented 9 years ago
Issue 477 has been merged into this issue.

Original comment by mrovi9...@gmail.com on 21 Mar 2015 at 11:03

GoogleCodeExporter commented 9 years ago
We are using cairo for drawing backgrounds. The API is the following:

http://cairographics.org/manual-1.0.2/cairo-Patterns.html

Example code:

http://cairographics.org/samples/gradient/

To configure a linear background, a possible option would be to specify:
* the orientation of the gradient, in degrees
* a list of colors and the corresponding distances
  * the distances could be given in pixels
  * the distances could also be given in percentages. If the gradient is horizontal, we convert them to pixels by muliplying by the object's width; if they are vertical, we muliply by the object's height; if they are at an angle we could use width * sin(angle) + height * cos(angle)

I am not sure about radial gradients.

The relevant parts of tint2 which would be modified are:
* util/area.h (probably add a new member to Background)
* util/area.c (modify draw_background(Area *a, cairo_t *c))
* config.c (read background config options)

This is a lot of work and I don't have time for it but I'm willing to accept 
patches (for the release after 0.12). The condition is that performance (CPU & 
memory) must not be affected for configs that do not use gradients.

Original comment by mrovi9...@gmail.com on 21 Mar 2015 at 11:27

GoogleCodeExporter commented 9 years ago
Than you very much for the information and algorithm, in fact that's what i 
need.
i'm working on it.

Thank you.

Original comment by haska...@gmail.com on 21 Mar 2015 at 11:40

GoogleCodeExporter commented 9 years ago
Hi,

I prepared a patch for gradient background and border. 
Because of I'm not an experienced developer, most probably it has buggy code. 
Please test it before use it.
I could not find any appropirate solution for radial gradient. So I just 
implemented linear gradient for now.

New config parameters:
background_color_2 = < same style with the first color >
background_gradient_type = < disabled, linear >
background_gradient_settings = < smoothness( 0 to 5), balance(-200 to 200) 
orientationAngle(0 to 360) >

border_color_2 = < same style with the first color >
border_gradient_type = < disabled, linear >
border_gradient_settings = < smoothness( 0 to 5), balance(-200 to 200) 
orientationAngle(0 to 360) >

sample: 
background_color_2 = #000000 100
background_gradient_type = linear
background_gradient_settings = 5 0 0

Thank you.

Original comment by haska...@gmail.com on 30 Mar 2015 at 9:41

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks! I will take a look in the weekend.

Original comment by mrovi9...@gmail.com on 30 Mar 2015 at 6:08