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

Documentation for saving SVGs is a bit unclear #180

Open
JD557 opened this issue Dec 28, 2024 · 0 comments
Open

Documentation for saving SVGs is a bit unclear #180

JD557 opened this issue Dec 28, 2024 · 0 comments

Comments

@JD557
Copy link

JD557 commented Dec 28, 2024

Asked in Discord, but adding an issue to track this here.

The SVG documentation reads:

On the JVM you can't draw SVG to the screen. Use the java2d backend for that instead. However you can write SVG output in the usual way.

But there's no example. Since it mentions "in the usual way", the next logical step seems to be the "Writing to a File" docs, where the example looks like:

import doodle.core.*
import doodle.syntax.all.*
import doodle.java2d.*
import cats.effect.unsafe.implicits.global

import doodle.core.format.*

val circle = Picture.circle(100)
  .strokeWidth(10.0)
  .fillColor(Color.crimson)
  
circle.write[Png]("circle.png")

Intuitively, one would just change import doodle.java2d.* to import doodle.svg.* and circle.write[Svg]("circle.svg"). However, this triggers an error:

No given instance of type doodle.effect.DefaultFrame[Frame] was found for parameter f of method apply in class FileWriterOpsHelper

Which is not clear if:

  • There's an import missing
  • SVG exports require an explicit Frame

Maybe the documentation could have a bit more examples and the implicit not found message could be improved?

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

1 participant