Logo Search packages:      
Sourcecode: matplotlib version File versions

def matplotlib::backends::backend_ps::RendererPS::_draw_ps (   self,
  ps,
  gc,
  rgbFace,
  fill = True,
  stroke = True,
  command = None 
) [private]

Emit the PostScript sniplet 'ps' with all the attributes from 'gc'
applied.  'ps' must consist of PostScript commands to construct a path.

The fill and/or stroke kwargs can be set to False if the
'ps' string already includes filling and/or stroking, in
which case _draw_ps is just supplying properties and
clipping.

Definition at line 748 of file backend_ps.py.

00748                                                                              :
        """
        Emit the PostScript sniplet 'ps' with all the attributes from 'gc'
        applied.  'ps' must consist of PostScript commands to construct a path.

        The fill and/or stroke kwargs can be set to False if the
        'ps' string already includes filling and/or stroking, in
        which case _draw_ps is just supplying properties and
        clipping.
        """
        # local variable eliminates all repeated attribute lookups
        write = self._pswriter.write
        if debugPS and command:
            write("% "+command+"\n")
        mightstroke = (gc.get_linewidth() > 0.0 and
                  (len(gc.get_rgb()) <= 3 or gc.get_rgb()[3] != 0.0))
        stroke = stroke and mightstroke
        fill = (fill and rgbFace is not None and
                (len(rgbFace) <= 3 or rgbFace[3] != 0.0))

        if mightstroke:
            self.set_linewidth(gc.get_linewidth())
            jint = gc.get_joinstyle()
            self.set_linejoin(jint)
            cint = gc.get_capstyle()
            self.set_linecap(cint)
            self.set_linedash(*gc.get_dashes())
            self.set_color(*gc.get_rgb()[:3])
        write('gsave\n')

        cliprect = gc.get_clip_rectangle()
        if cliprect:
            x,y,w,h=cliprect.bounds
            write('%1.4g %1.4g %1.4g %1.4g clipbox\n' % (w,h,x,y))
        clippath, clippath_trans = gc.get_clip_path()
        if clippath:
            id = self._get_clip_path(clippath, clippath_trans)
            write('%s\n' % id)

        # Jochen, is the strip necessary? - this could be a honking big string
        write(ps.strip())
        write("\n")

        hatch = gc.get_hatch()
        if hatch:
            self.set_hatch(hatch)

        if fill:
            if stroke:
                write("gsave\n")
                self.set_color(store=0, *rgbFace[:3])
                write("fill\ngrestore\n")
            else:
                self.set_color(store=0, *rgbFace[:3])
                write("fill\n")
        if stroke:
            write("stroke\n")

        write("grestore\n")



class GraphicsContextPS(GraphicsContextBase):


Generated by  Doxygen 1.6.0   Back to index