-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Context.restore() doesn't restore the current point? #273
Comments
Not sure, but reading the docs the current point restored to |
This might be a documentation issue - in the docs it says "state" is saved/restored, but not what that state includes (e.g. position)... it'll be interesting to see what people say on the mailing list/ |
I guess the entire path is not part of the save/restore: import cairo
def show_path(label, context):
path_str = str(context.copy_path())
if path_str:
path_str = path_str.replace("\n", "; ")
else:
path_str = "<empty>"
print(f"{label}: {path_str}")
with cairo.SVGSurface("example.svg", 200, 200) as surface:
context = cairo.Context(surface)
show_path("Initial", context)
context.move_to(100, 200)
context.line_to(300, 400)
context.close_path()
show_path("Before save", context)
context.save()
show_path("Before stroke", context)
context.stroke()
show_path("After stroke", context)
context.restore()
show_path("After restore", context) produces:
|
This prints:
After the
context.restore()
, shouldn't the current point be restored to (100, 200)?The text was updated successfully, but these errors were encountered: