[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [E-devel] edje gradient fill



	Brian writes:

> A few weeks back, I added gradient support to edje. However,
> I think I need to rework how thigns are done slightly. Here's
> the issue:
> 
> Evas applies the fill of a grad BEFORE the rotation due to the
> angle. So, if you want a horizontal grad from left to right (angle
> = 270) you need to evas_object_gradient_fill(grad, 0, 0, h, w);
> [ e.g. flip the w and h params ].
> 
> Now, due to the way edje does fills (specify origin and size),
> you can't easily do this. So, here's what I propose:
> 
> Do away with the angle parameter.
> Use the origin/size to specify the angle AND fill.
> 
> So, for a horizontal linear gradient that fills the object,
> you would have:
> 
>  fill {
>    origin {
>      relative: 0 0;
>      offset: 0 0;
>    }
>    size {
>      relative: 1 0;
>      offset: -1 0;
>    }
>  }
> 
> 
> To fill diagonally down from top left to bottom right it would be:
> 
>  fill {
>    origin {
>      relative: 0 0;
>      offset: 0 0;
>    }
>    size {
>      relative: 1 1;
>      offset: -1 -1;
>    }
>  }
> 
> (with the current setup, this isn't even possible)
> 
> Any objections?
> 

	You could do that.. But it's inconsistent in various ways,
won't generalize to include image fills, and is not really the way
to get what you want :(

	The fill region semantics must work the same for grads as
for images, and the angle as well - and this is something that will
be useful to have for images. Would this semantics apply to image
filling as well, ie. would the image be rotated along the line
joining the top-left and bottom-right points? or with radial grads,
etc.. ?

	The concept of filling 'from point a to point b' ONLY works
intuitivly with linear grads, whereas the concept of a fill region
and angle will work fine with all grad types, and images, and other
texture notions.

	What you are describing is a nice thing to have - if you're
working with linear grads, and ONLY with linear grads - it's not a
consistent semantics for the concept of texture fills in general.

	I would suggest you add separate gradient types that allow
you to specify in full their own separate semantics.. eg. have a
LINEAR_GRADIENT type (apart from the general grad type), and here
you can put inside its gradient block stuff that is specific to
whatever semantics you want for this special one -- ie. you'd have
a new linear_fill block there, or an orientation, or whatever, to
get the linear gradient to fill in a certain way that may override
the general fill semantics.
	Or add another fill_orientation kind of option in general
that would work as mentioned -- ie. rotate things from top-left
to bottom-right.

   jose.