Exemplo n.º 1
0
def renderGerberFile(rep, cr):

    cr.push_group()
    cr.set_operator(cairo.OPERATOR_OVER)

    for j in rep.layers:
        if (j.polarity == "LP_C"):
            cr.set_source_rgba(1, 0, 0, 1)
        else:
            cr.set_source_rgba(0, 0, 1, 1)

        for k in j.draws:
            GD.emitGerbObjectCairoPath(cr, k)

            cr.stroke()

    cr.pop_group_to_source()
    cr.paint_with_alpha(1)
Exemplo n.º 2
0
def renderGerberFile(rep, cr):
	
	cr.push_group()
	cr.set_operator(cairo.OPERATOR_OVER)
	

	for j in rep.layers:
		if (j.polarity == "LP_C"):
				cr.set_source_rgba(1,0,0, 1)
		else:
				cr.set_source_rgba(0,0,1, 1)

		for k in j.draws:
			GD.emitGerbObjectCairoPath(cr, k)
			
			cr.stroke()		
			
	cr.pop_group_to_source()
	cr.paint_with_alpha(1)
Exemplo n.º 3
0
def renderGerberFile(rep, cr, layer, outlines):
    ps = plotmode.getPlotSettings(layer)

    cr.push_group()
    if not ps.drawinverted:
        cr.set_operator(cairo.OPERATOR_OVER)
    else:
        cr.set_operator(cairo.OPERATOR_OVER)
        cr.set_source_rgba(ps.ovr, ps.ovg, ps.ovb, 1)

        if outlines:
            for i in outlines:
                cr.move_to(i[0][0], i[0][1])
                for x, y, _ in i[1:]:
                    cr.line_to(x, y)
                cr.close_path()
            cr.fill()
        else:
            cr.paint()

        cr.set_operator(cairo.OPERATOR_DEST_OUT)

    cr.set_source_rgba(ps.ovr, ps.ovg, ps.ovb, 1)

    for l in rep.layers:
        for k in l.draws:
            if isinstance(
                    k, GD.GerbObj_Line) and (k.width
                                             == 0) and ps.strokeZeroWidthLines:
                createCairoLineCenterLinePath(k, cr)
                cr.stroke()
            else:
                GD.emitGerbObjectCairoPath(cr, k)

                if (ps.drawfilled):
                    cr.fill()
                else:
                    cr.stroke()

    cr.pop_group_to_source()
    cr.paint_with_alpha(ps.alpha)
    cr.set_operator(ps.renderOperator)
Exemplo n.º 4
0
def renderGerberFile(rep, cr, layer, outlines):
	ps = plotmode.getPlotSettings(layer)
	
	cr.push_group()
	if not ps.drawinverted:
		cr.set_operator(cairo.OPERATOR_OVER)
	else:
		cr.set_operator(cairo.OPERATOR_OVER)
		cr.set_source_rgba(ps.ovr, ps.ovg, ps.ovb, 1)
		
		if outlines:
			for i in outlines:
				cr.move_to(i[0][0], i[0][1])
				for x,y,_ in i[1:]:
					cr.line_to(x,y)
				cr.close_path()
			cr.fill()
		else:
			cr.paint()
			
		cr.set_operator(cairo.OPERATOR_DEST_OUT)
		
	cr.set_source_rgba(ps.ovr, ps.ovg, ps.ovb, 1)

	for l in rep.layers:
		for k in l.draws:
			if isinstance(k, GD.GerbObj_Line) and (k.width == 0) and ps.strokeZeroWidthLines:
					createCairoLineCenterLinePath(k,cr)
					cr.stroke()
			else:
				GD.emitGerbObjectCairoPath(cr, k)
				
				if (ps.drawfilled):
					cr.fill()
				else:
					cr.stroke()		
			
	cr.pop_group_to_source()
	cr.paint_with_alpha(ps.alpha)
	cr.set_operator(ps.renderOperator)