Skip to content
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

Proposal : Draw behind, z index ? #62

Closed
kpym opened this issue Oct 19, 2020 · 4 comments
Closed

Proposal : Draw behind, z index ? #62

kpym opened this issue Oct 19, 2020 · 4 comments

Comments

@kpym
Copy link
Contributor

kpym commented Oct 19, 2020

I'm trying to draw a path behind. But it looks like the RenderPath can add only on top of the layers stack.

Is it possible to append a new method RenderPathBehind ? Or even better add z-index parameter to the layers and when new path is added it is inserted at the right 'z'-position.

@tdewolff
Copy link
Owner

The interfaces for the specific target file formats are in "direct" mode, meaning that issuing a draw command immediately draws the path. The only exception is the general Canvas class, which keeps a record of layers to draw. We could add functionality there so that you can either set the Z-index for the next drawing commands, or set it explicitly for the current command. Thanks for the suggestion!

@kpym
Copy link
Contributor Author

kpym commented Oct 19, 2020

@tdewolff Thanks for your fast answer. Indeed I was talking about the general Canvas. By the way, I think that PDF has z-index capabilities.

@kpym
Copy link
Contributor Author

kpym commented Oct 19, 2020

I succeeded to draw white rectangle behind like this :

func onWhite(c *canvas.Canvas) *canvas.Canvas {
	cn := canvas.New(c.W, c.H)
	ctx := canvas.NewContext(cn)
	ctx.SetFillColor(canvas.White)
	ctx.DrawPath(0, 0, canvas.Rectangle(math.Ceil(c.W), math.Ceil(c.H)))
	c.Render(cn)

	return cn
}

But this is not very nice.

@tdewolff
Copy link
Owner

I've incorporated this issue in the new roadmap from where it will be tracked: #74

tdewolff added a commit that referenced this issue Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants