Skip to content

Commit

Permalink
Use new pydyf API
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Jul 6, 2024
1 parent 61852c4 commit dd7cee2
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ requires-python = '>=3.9'
readme = {file = 'README.rst', content-type = 'text/x-rst'}
license = {file = 'LICENSE'}
dependencies = [
'pydyf >=0.10.0',
'pydyf >=0.11.0',
'cffi >=0.6',
'html5lib >=1.1',
'tinycss2 >=1.3.0',
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/draw/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def draw_background_image(stream, layer, image_rendering):
with stacked(stream):
layer.image.draw(group, image_width, image_height, image_rendering)
pattern.draw_x_object(group.id)
stream.color_space('Pattern')
stream.set_color_space('Pattern')
stream.set_color_special(pattern.id)
if layer.unbounded:
x1, y1, x2, y2 = stream.page_rectangle
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/draw/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def draw_first_line(stream, textbox, text_overflow, block_ellipsis, matrix):

utf8_text = textbox.pango_layout.text.encode()
previous_utf8_position = 0
stream.text_matrix(*matrix.values)
stream.set_text_matrix(*matrix.values)
last_font = None
string = ''
x_advance = 0
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def draw(self, stream, concrete_width, concrete_height, _image_rendering):
alpha_stream.transform(d=scale_y)
alpha_stream.stream = [f'/{alpha_shading.id} sh']

stream.shading(shading.id)
stream.paint_shading(shading.id)

def layout(self, width, height):
"""Get layout information about the gradient.
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/pdf/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def pop_state(self):
assert self._ctm_stack

def transform(self, a=1, b=0, c=0, d=1, e=0, f=0):
super().transform(a, b, c, d, e, f)
super().set_matrix(a, b, c, d, e, f)
self._ctm_stack[-1] = Matrix(a, b, c, d, e, f) @ self.ctm

def begin_text(self):
Expand Down
6 changes: 3 additions & 3 deletions weasyprint/svg/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,10 @@ def draw_gradient(svg, node, gradient, font_size, opacity, stroke):
shading_type, 'Gray', domain, coords, extend, function)
alpha_stream.stream = [f'/{alpha_shading.id} sh']

group.shading(shading.id)
group.paint_shading(shading.id)
pattern.set_alpha(1)
pattern.draw_x_object(group.id)
svg.stream.color_space('Pattern', stroke=stroke)
svg.stream.set_color_space('Pattern', stroke=stroke)
svg.stream.set_color_special(pattern.id, stroke=stroke)
return True

Expand Down Expand Up @@ -461,7 +461,7 @@ def draw_pattern(svg, node, pattern, font_size, opacity, stroke):
group, pattern_width, pattern_height, svg.base_url,
svg.url_fetcher, svg.context)
stream_pattern.draw_x_object(group.id)
svg.stream.color_space('Pattern', stroke=stroke)
svg.stream.set_color_space('Pattern', stroke=stroke)
svg.stream.set_color_special(stream_pattern.id, stroke=stroke)
return True

Expand Down

0 comments on commit dd7cee2

Please sign in to comment.