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

How to generate a flipped svg file? #101

Closed
aimerneige opened this issue Jun 6, 2022 · 2 comments
Closed

How to generate a flipped svg file? #101

aimerneige opened this issue Jun 6, 2022 · 2 comments
Assignees

Comments

@aimerneige
Copy link

aimerneige commented Jun 6, 2022

Hello! I am trying to generate a flipped SVG file for the black player.

I write code like this:

	board := pos.Board()
	if pos.Turn() == chess.Black {
		board = board.Flip(chess.UpDown).Flip(chess.LeftRight)
	}
	if err := image.SVG(f, board); err != nil {
		log.Fatal(err)
	}

But I got this, where the a1 should be at the left top

image

What should I do to generate a correct SVG file? Or is this a bug?

@notnil
Copy link
Owner

notnil commented Jun 29, 2022

Thanks for the visualization. Yeah chess/image will likely need to be updated to support "from black" view. Flipping flips the pieces, not the board.

@notnil
Copy link
Owner

notnil commented Aug 14, 2022

Fixed in #109

@notnil notnil closed this as completed Aug 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants