Skip to content

Commit

Permalink
fixes #949 deprecated PyMuPDF method names
Browse files Browse the repository at this point in the history
  • Loading branch information
mozman committed Oct 30, 2023
1 parent 4e2441a commit cf179de
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Version 1.1.2 - beta
improve modelspace extents updates
- BUGFIX: [#939](https://github.com/mozman/ezdxf/issues/939)
`Matplotlib` requires oriented outer paths and holes to draw correct filled paths
- BUGFIX: transform embedded `MTEXT` entity in `ATTRIB` and `ATTDEF` entities
- BUGFIX: transform embedded `MTEXT` entity in `ATTRIB` and `ATTDEF` entities
- BUGFIX: [#949](https://github.com/mozman/ezdxf/issues/949)
fixed `PyMuPDF` deprecated method names

Version 1.1.1 - 2023-10-08
--------------------------
Expand Down
20 changes: 10 additions & 10 deletions src/ezdxf/addons/drawing/pymupdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def set_background(self, color: Color) -> None:
if color == (1.0, 1.0, 1.0) or opacity == 0.0:
return
shape = self.new_shape()
shape.drawRect([0, 0, self.page_width_in_pt, self.page_height_in_pt])
shape.draw_rect([0, 0, self.page_width_in_pt, self.page_height_in_pt])
shape.finish(width=None, color=None, fill=rgb, fill_opacity=opacity)
shape.commit()

Expand Down Expand Up @@ -306,13 +306,13 @@ def resolve_stroke_width(self, width: float) -> float:
def draw_point(self, pos: Vec2, properties: BackendProperties) -> None:
shape = self.new_shape()
pos = Vec2(pos)
shape.drawLine(pos, pos)
shape.draw_line(pos, pos)
self.finish_line(shape, properties, close=False)
shape.commit()

def draw_line(self, start: Vec2, end: Vec2, properties: BackendProperties) -> None:
shape = self.new_shape()
shape.drawLine(Vec2(start), Vec2(end))
shape.draw_line(Vec2(start), Vec2(end))
self.finish_line(shape, properties, close=False)
shape.commit()

Expand All @@ -321,7 +321,7 @@ def draw_solid_lines(
) -> None:
shape = self.new_shape()
for start, end in lines:
shape.drawLine(start, end)
shape.draw_line(start, end)
self.finish_line(shape, properties, close=False)
shape.commit()

Expand Down Expand Up @@ -350,7 +350,7 @@ def draw_filled_polygon(
return
# input coordinates are page coordinates in pdf units
shape = self.new_shape()
shape.drawPolyline(vertices)
shape.draw_polyline(vertices)
self.finish_filling(shape, properties)
shape.commit()

Expand Down Expand Up @@ -384,18 +384,18 @@ def add_path_to_shape(shape, path: BkPath2d, close: bool) -> None:
end = command.end
if command.type == Command.MOVE_TO:
if close and not sub_path_start.isclose(end):
shape.drawLine(start, sub_path_start)
shape.draw_line(start, sub_path_start)
sub_path_start = end
elif command.type == Command.LINE_TO:
shape.drawLine(start, end)
shape.draw_line(start, end)
elif command.type == Command.CURVE3_TO:
shape.drawCurve(start, command.ctrl, end)
shape.draw_curve(start, command.ctrl, end)
elif command.type == Command.CURVE4_TO:
shape.drawBezier(start, command.ctrl1, command.ctrl2, end)
shape.draw_bezier(start, command.ctrl1, command.ctrl2, end)
start = end
last_point = end
if close and not sub_path_start.isclose(last_point):
shape.drawLine(last_point, sub_path_start)
shape.draw_line(last_point, sub_path_start)


def map_lineweight_to_stroke_width(
Expand Down

0 comments on commit cf179de

Please sign in to comment.