I forgot to insert all your line drawing code BEFORE the cairo_clip call 
in my snippet.  Hopefully you figured that out though.


Julian

On 04/03/2011 09:55 PM, Curtis C. Pope wrote:
> OK...I'm making progress.  I was able to identify the geometry and store
> the nets in an array.  I wrote the following snippet to try to draw the
> path and clip:
>
>       j = 0;
>       cairo_new_path(cr);
>       draw_cairo_move_to(cr, border[0]->start_x, border[0]->start_y, FALSE);
>       while ( border[j] != NULL){
>           draw_cairo_line_to(cr, border[j]->stop_x, border[j]->stop_y);
>           j++;
>       }
>       cairo_clip(cr);
>
> It is clipping, but it is clipping everything.  I have a feeling that
> there is some translation of the gerber coordinates to cairo coordinates
> going on in other routines before these draw operations would normally
> be called and my border isn't being set properly in the screen.  The
> coordinates look like this:
>
> Border 0: sX=0.010100, sY=0.010100, eX=0.010100, eY=2.097100
> Border 1: sX=0.010100, sY=2.097100, eX=1.209300, eY=2.097100
> Border 2: sX=1.209300, sY=2.097100, eX=1.209300, eY=0.010100
> Border 3: sX=1.209300, sY=0.010100, eX=0.010100, eY=0.010100
>
> where sX/Y = StartX/Y and eX/Y = StopX/Y
>
> Obviously this is inches where cairo is probably looking for something else.
>
> Any pointers in the right direction would help.
>
> Thanks,
> Curtis
>
> On 4/2/2011 11:52 AM, Julian Lamb wrote:
>> Curtis,
>>> With that array of segments, I could then use cairo to draw the
>>> background before rendering the layers.  I could tell it to "subtract"
>>> the soldermask from the background as the first step and then continue
>>> placing the other layers.
>>        I don't think the overall board clipping would be that hard, since
>> cairo will do it quite simply.  Once you extract the geometry you want
>> for the edge, you create a cairo target, draw a path along the outside
>> of the board, and then call cairo_clip.  Then you just pass that cairo
>> target to the normal rendering routines and nothing will be drawn
>> outside of the board edges.  You may have to review the gerbv code and
>> figure out which translation "frame" to draw the edge in, though (the
>> current transform matrix will have to be zoomed in to the correct level,
>> etc).  I think that will give you the appearance you desire.
>>
>> Julian
>>
>> ------------------------------------------------------------------------------
>> Create and publish websites with WebMatrix
>> Use the most popular FREE web apps or write code yourself;
>> WebMatrix provides all the features you need to develop and
>> publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
>> _______________________________________________
>> Gerbv-devel mailing list
>> Gerbv-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gerbv-devel
>>
>>
>
> ------------------------------------------------------------------------------
> Create and publish websites with WebMatrix
> Use the most popular FREE web apps or write code yourself;
> WebMatrix provides all the features you need to develop and
> publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
> _______________________________________________
> Gerbv-devel mailing list
> Gerbv-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gerbv-devel

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Gerbv-devel mailing list
Gerbv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gerbv-devel

Reply via email to