[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cairo
Subject:    Re: [cairo] Problems with gradients...
From:       benoit.vautrin () free ! fr
Date:       2004-04-21 14:23:18
Message-ID: 1082557398.408683d6f379b () imp3-q ! free ! fr
[Download RAW message or body]

Selon David Reveman <c99drn@cs.umu.se>:  
> On Tue, 2004-04-20 at 22:42 +0200, benoit.vautrin@free.fr wrote:  
> > Hi !   
> >    
> > Adapting a example code from David Reveman, I've made a simple test case  
> > which shows up some bugs in gradients patterns...   
> >    
[...]  
> >    
> > 3- Image backend:   
> >    
> > Gradients are beautifull but from time to time don't fill the whole  
> shape...   
> >    
> > There are other issues but I'm still trying to find simple test cases to  
> show   
> > them.   
>   
> This patch should fix problem 3.  
>   
  
It works ! Thanks...  
  
BTW, I've taken my pencil and did some math:  
When using a scaling matrix like this one:  
| sx  0 |  
| 0  sy |  
if the linear gradient coordinates are ( x1, y1, x2, y2 ), they should be  
transformed as  
  
x'1= (x1+x2)*sx/2 - dx  
x'2= (x1+x2)*sx/2 + dx  
y'1= (y1+y2)*sy/2 - dy  
y'2= (y1+y2)*sy/2 + dy  
  
with:  
dx = (x2-x1)sx(y2-y1)²sy² / ((x2-x1)²sx² + (y2-y1)²sy²)  
dy = (x2-x1)²sx²(y2-y1)sy / ((x2-x1)²sx² + (y2-y1)²sy²)  
  
Which gives x'1 = sx*x1, x'2 = sx*x2, y'1 = sy*x1 and y'2 = sy*y2 only when  
sx=sy...  
  
Bye,  
  
Ben.  
 
 
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic