Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1387e8b

Browse files
committed
Somehow the merge went awry last time. Fixing.
svn path=/branches/transforms/; revision=4691
1 parent 60430fd commit 1387e8b

4 files changed

Lines changed: 0 additions & 197 deletions

File tree

lib/matplotlib/backends/backend_cairo.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ def _fill_and_stroke (self, ctx, fill_c, alpha):
118118
ctx.stroke()
119119

120120

121-
<<<<<<< .working
122121
#@staticmethod
123122
def convert_path(ctx, tpath):
124123
for points, code in tpath.iter_segments():
@@ -135,48 +134,12 @@ def convert_path(ctx, tpath):
135134
elif code == Path.CLOSEPOLY:
136135
ctx.close_path()
137136
convert_path = staticmethod(convert_path)
138-
=======
139-
def draw_path(self, gc, rgbFace, path):
140-
ctx = gc.ctx
141-
ctx.new_path()
142-
>>>>>>> .merge-right.r4686
143137

144-
<<<<<<< .working
145138

146139
def draw_path(self, gc, path, transform, rgbFace=None):
147140
if len(path.vertices) > 18980:
148141
raise ValueError("The Cairo backend can not draw paths longer than 18980 points.")
149142

150-
=======
151-
while 1:
152-
code, xp, yp = path.vertex()
153-
yp = self.height - yp
154-
155-
if code == agg.path_cmd_stop:
156-
ctx.close_path()
157-
break
158-
elif code == agg.path_cmd_move_to:
159-
ctx.move_to(xp, yp)
160-
elif code == agg.path_cmd_line_to:
161-
ctx.line_to(xp, yp)
162-
elif code == agg.path_cmd_curve3:
163-
_, xp1, yp1 = path.vertex()
164-
yp1 = self.height - yp1
165-
ctx.curve_to(xp, yp, xp, yp, xp1, yp1)
166-
elif code == agg.path_cmd_curve4:
167-
_, xp1, yp1 = path.vertex()
168-
yp1 = self.height - yp1
169-
_, xp2, yp2 = path.vertex()
170-
yp2 = self.height - yp2
171-
ctx.curve_to(xp, yp, xp1, yp1, xp2, yp2)
172-
elif code == agg.path_cmd_end_poly:
173-
ctx.close_path()
174-
self._fill_and_stroke(ctx, rgbFace)
175-
176-
def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2,
177-
rotation):
178-
if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name())
179-
>>>>>>> .merge-right.r4686
180143
ctx = gc.ctx
181144
transform = transform + \
182145
Affine2D().scale(1.0, -1.0).translate(0, self.height)

lib/matplotlib/backends/backend_pdf.py

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,97 +1211,7 @@ def merge_used_characters(self, other):
12111211
stat_key, (realpath, Set()))
12121212
used_characters[1].update(set)
12131213

1214-
<<<<<<< .working
12151214
def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None):
1216-
=======
1217-
def draw_arc(self, gcEdge, rgbFace, x, y, width, height,
1218-
angle1, angle2, rotation):
1219-
"""
1220-
Draw an arc using GraphicsContext instance gcEdge, centered at x,y,
1221-
with width and height and angles from 0.0 to 360.0
1222-
0 degrees is at 3-o'clock, rotated by `rotation` degrees
1223-
positive angles are anti-clockwise
1224-
1225-
If the color rgbFace is not None, fill the arc with it.
1226-
"""
1227-
# source: agg_bezier_arc.cpp in agg23
1228-
1229-
def arc_to_bezier(cx, cy, rx, ry, angle1, sweep, rotation):
1230-
halfsweep = sweep / 2.0
1231-
x0, y0 = cos(halfsweep), sin(halfsweep)
1232-
tx = (1.0 - x0) * 4.0/3.0;
1233-
ty = y0 - tx * x0 / y0;
1234-
px = x0, x0+tx, x0+tx, x0
1235-
py = -y0, -ty, ty, y0
1236-
sn, cs = sin(angle1 + halfsweep), cos(angle1 + halfsweep)
1237-
result = [ (rx * (pxi * cs - pyi * sn),
1238-
ry * (pxi * sn + pyi * cs))
1239-
for pxi, pyi in zip(px, py) ]
1240-
result = [ (cx + cos(rotation)*x - sin(rotation)*y,
1241-
cy + sin(rotation)*x + cos(rotation)*y)
1242-
for x, y in result ]
1243-
return reduce(lambda x, y: x + y, result)
1244-
1245-
epsilon = 0.01
1246-
angle1 *= pi/180.0
1247-
angle2 *= pi/180.0
1248-
rotation *= pi/180.0
1249-
sweep = angle2 - angle1
1250-
angle1 = angle1 % (2*pi)
1251-
sweep = min(max(-2*pi, sweep), 2*pi)
1252-
1253-
if sweep < 0.0:
1254-
sweep, angle1, angle2 = -sweep, angle2, angle1
1255-
bp = [ pi/2.0 * i
1256-
for i in range(4)
1257-
if pi/2.0 * i < sweep-epsilon ]
1258-
bp.append(sweep)
1259-
subarcs = [ arc_to_bezier(x, y, width/2.0, height/2.0,
1260-
bp[i], bp[i+1]-bp[i], rotation)
1261-
for i in range(len(bp)-1) ]
1262-
1263-
self.check_gc(gcEdge, rgbFace)
1264-
self.file.output(subarcs[0][0], subarcs[0][1], Op.moveto)
1265-
for arc in subarcs:
1266-
self.file.output(*(arc[2:] + (Op.curveto,)))
1267-
1268-
self.file.output(self.gc.close_and_paint())
1269-
1270-
def draw_path(self, gc, rgbFace, path):
1271-
self.check_gc(gc, rgbFace)
1272-
1273-
cmds = []
1274-
1275-
while 1:
1276-
code, xp, yp = path.vertex()
1277-
1278-
if code == agg.path_cmd_stop:
1279-
cmds.append(Op.closepath)
1280-
break
1281-
elif code == agg.path_cmd_move_to:
1282-
cmds.extend([xp, yp, Op.moveto])
1283-
elif code == agg.path_cmd_line_to:
1284-
cmds.extend([xp, yp, Op.lineto])
1285-
elif code == agg.path_cmd_curve3:
1286-
cmds.extend([xp, yp])
1287-
cmds.extend([xp, yp])
1288-
cmds.extend(path.vertex()[1:])
1289-
cmds.append(Op.curveto)
1290-
elif code == agg.path_cmd_curve4:
1291-
cmds.extend([xp, yp])
1292-
cmds.extend(path.vertex()[1:])
1293-
cmds.extend(path.vertex()[1:])
1294-
cmds.append(Op.curveto)
1295-
elif code == agg.path_cmd_end_poly:
1296-
cmds.append(Op.closepath)
1297-
self.file.output(*cmds)
1298-
self.file.output(self.gc.paint())
1299-
1300-
def get_image_magnification(self):
1301-
return self.image_magnification
1302-
1303-
def draw_image(self, x, y, im, bbox):
1304-
>>>>>>> .merge-right.r4686
13051215
#print >>sys.stderr, "draw_image called"
13061216

13071217
# MGDTODO: Support clippath here

lib/matplotlib/backends/backend_ps.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,31 +1430,4 @@ class FigureManagerPS(FigureManagerBase):
14301430
clip
14311431
newpath
14321432
} bind def""",
1433-
<<<<<<< .working
1434-
=======
1435-
# angle1 angle2 rx ry x y *ellipse* -
1436-
"""/ellipse {
1437-
newpath
1438-
matrix currentmatrix 7 1 roll
1439-
translate
1440-
scale
1441-
0 0 1 5 3 roll arc
1442-
setmatrix
1443-
closepath
1444-
} bind def""",
1445-
"""/unitcircle {
1446-
newpath
1447-
0. -1. moveto
1448-
0.2652031 -1.0 0.519579870785 -0.894633691588 0.707106781187 -0.707106781187 curveto
1449-
0.894633691588 -0.519579870785 1.0 -0.2652031 1.0 0.0 curveto
1450-
1.0 0.2652031 0.894633691588 0.519579870785 0.707106781187 0.707106781187 curveto
1451-
0.519579870785 0.894633691588 0.2652031 1.0 0.0 1.0 curveto
1452-
-0.2652031 1.0 -0.519579870785 0.894633691588 -0.707106781187 0.707106781187 curveto
1453-
-0.894633691588 0.519579870785 -1.0 0.2652031 -1.0 0.0 curveto
1454-
-1.0 -0.2652031 -0.894633691588 -0.519579870785 -0.707106781187 -0.707106781187 curveto
1455-
-0.519579870785 -0.894633691588 -0.2652031 -1.0 0.0 -1.0 curveto
1456-
closepath
1457-
} bind def""",
1458-
1459-
>>>>>>> .merge-right.r4679
14601433
]

lib/matplotlib/backends/backend_svg.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -140,49 +140,6 @@ def open_group(self, s):
140140
def close_group(self, s):
141141
self._svgwriter.write('</g>\n')
142142

143-
<<<<<<< .working
144-
=======
145-
def draw_path(self, gc, rgbFace, path):
146-
cmd = []
147-
148-
while 1:
149-
code, xp, yp = path.vertex()
150-
yp = self.height - yp
151-
152-
if code == agg.path_cmd_stop:
153-
cmd.append('z') # Hack, path_cmd_end_poly not found
154-
break
155-
elif code == agg.path_cmd_move_to:
156-
cmd.append('M%g %g' % (xp, yp))
157-
elif code == agg.path_cmd_line_to:
158-
cmd.append('L%g %g' % (xp, yp))
159-
elif code == agg.path_cmd_curve3:
160-
verts = [xp, yp]
161-
verts.extent(path.vertex()[1:])
162-
verts[-1] = self.height - verts[-1]
163-
cmd.append('Q%g %g %g %g' % tuple(verts))
164-
elif code == agg.path_cmd_curve4:
165-
verts = [xp, yp]
166-
verts.extend(path.vertex()[1:])
167-
verts[-1] = self.height - verts[-1]
168-
verts.extend(path.vertex()[1:])
169-
verts[-1] = self.height - verts[-1]
170-
cmd.append('C%g %g %g %g %g %g'%tuple(verts))
171-
elif code == agg.path_cmd_end_poly:
172-
cmd.append('z')
173-
174-
path_data = "".join(cmd)
175-
self._draw_svg_element("path", 'd="%s"' % path_data, gc, rgbFace)
176-
177-
def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2, rotation):
178-
"""
179-
Ignores angles for now
180-
"""
181-
details = 'cx="%s" cy="%s" rx="%s" ry="%s" transform="rotate(%1.1f %s %s)"' % \
182-
(x, self.height-y, width/2.0, height/2.0, -rotation, x, self.height-y)
183-
self._draw_svg_element('ellipse', details, gc, rgbFace)
184-
185-
>>>>>>> .merge-right.r4686
186143
def option_image_nocomposite(self):
187144
"""
188145
if svg.image_noscale is True, compositing multiple images into one is prohibited

0 commit comments

Comments
 (0)