Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Dave Gurnell
    @davegurnell
    Let the doodling commence.
    Noel Welsh
    @noelwelsh
    :pencil:
    Ilya Epifanov
    @ilya-epifanov
    hi guys, can I use doodle with scalajs? If so, what should I add to my build.sbt?
    Noel Welsh
    @noelwelsh
    Hi @ilya-epifanov. Doodle does work with Scala JS BUT the ScalaJS build is currently broken for reasons I haven't had time to look into
    Ilya Epifanov
    @ilya-epifanov
    @noelwelsh Actually, I've built and published it locally just fine
    Noel Welsh
    @noelwelsh
    Ah, ok, that's great!
    It's Maven that is rejecting the packages---the package name doesn't have the correct format or something
    Ilya Epifanov
    @ilya-epifanov
    Here's my patch, not all of it is needed, of course. https://gist.github.com/ilya-epifanov/d9a4049600010ada409d2f2aac1e0afe
    Basically, I've moved "version" to shared settings
    And BTW, the plugins I've commented out aren't reachable using standard resolvers
    Noel Welsh
    @noelwelsh
    Thanks! I don't think we use those plugins anyway, so they should definitely be removed.
    I'm working on some stuff right now. I'll try to get your patch included in the next few hours and see if I can publish an update of Doodle.)
    Ilya Epifanov
    @ilya-epifanov
    That would be great, thanks!
    Ilya Epifanov
    @ilya-epifanov
    Actually, it'd be better to make version in ThisBuild := "0.6.1"
    Noel Welsh
    @noelwelsh
    Doodle 0.6.2 published, including Scala JS artefacts. Thanks again!
    Ilya Epifanov
    @ilya-epifanov
    Also, here's a patch for monochrome colors to HSLA conversion: https://gist.github.com/ilya-epifanov/dd05208821287594cefbbb4bef69d63f
    feel free to tidy up an if condition, java.lang.Double.isNaN(hue.toRadians) would work too
    Maybe it belongs in Angle constructor, even
    Noel Welsh
    @noelwelsh
    Thanks again. Published 0.6.3 with a fix.
    Lionel Parreaux
    @LPTK
    Hey there, I stumbled on the doodle library and thought it might be cool. However, I had a hard time testing it. The example in the README.md does not work, and there is no mention of even what to import to make the basic stuff compile. Is there any doc beside the Creative Scala book (which I don't want to read)?
    For what it's worth, I managed to make the example work by changing circle to Circle and importing StandardInterpreter.interpreter and doodle.jvm.Java2DCanvas.java2DCanvas after perusing the library for a while, but that wasn't obvious at all
    Noel Welsh
    @noelwelsh
    @LPTK You can also read Creative Scala directly from the source here https://github.com/underscoreio/creative-scala/tree/feature/v2/src/raw
    I guess you didn't run the code from the sbt console? That automatically imports stuff for you
        initialCommands in console := """
          |import doodle.core._
          |import doodle.core.Image._
          |import doodle.random._
          |import doodle.syntax._
          |import doodle.jvm.FileCanvas._
          |import doodle.jvm.Java2DCanvas._
          |import doodle.backend.StandardInterpreter._
          |import doodle.backend.Formats._
          |import doodle.examples._
        """.trim.stripMargin,
    Those imports should cover everything you might want to do with Doodle.
    Noel Welsh
    @noelwelsh
    But you're right the documentation, outside of the book, is not great.
    Lionel Parreaux
    @LPTK
    Thanks for the info!
    I did actually try the console, but these were not imported for some reason
    ➜ doodle-test  cat build.sbt
    scalaVersion := "2.11.8" // Doodle is compatible with Scala 2.11 only
    
    resolvers += Resolver.bintrayRepo("underscoreio", "training")
    
    libraryDependencies += "underscoreio" %% "doodle" % "0.6.5"
    ➜ doodle-test  sbt console
    [info] Loading global plugins from /Users/lptk/.sbt/0.13/plugins
    [info] Set current project to doodle-test (in build file:/Users/lptk/work/perso/lib-tests/doodle-test/)
    [info] Starting scala interpreter...
    [info]
    Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_65).
    Type in expressions for evaluation. Or try :help.
    
    scala> (circle(10) fillColor Color.red).draw
    <console>:12: error: not found: value circle
           (circle(10) fillColor Color.red).draw
            ^
    <console>:12: error: not found: value Color
           (circle(10) fillColor Color.red).draw
                                 ^
    Ok I got it, the console imports only work if you've cloned the repo
    Lionel Parreaux
    @LPTK
    Otherwise it has to be imported manually
    Would be nice if that was stated clearly
    Stewart Stewart
    @stewSquared

    Hi, Creative Scala draws paths like so:

    val image = Path(List(
      MoveTo(Vec(0, 0)),
      LineTo(Vec(100, 0)),
      LineTo(Vec(50, 100)),
      BezierCurveTo(Vec(50, 0), Vec(0, 100), Vec(0, 0))
    ))

    MoveTo Requires a Point. Vec has a toPoint method, which needs to be called for the above example to compile. Was it formerly implicit?

    (Also, Path has no apply method. Book should be updated to use ClosedPath or OpenPath)
    Noel Welsh
    @noelwelsh
    Thanks @stewSquared! v1 of the book is old, v2 is not-quite-released but should have the correct documentation (it all goes via tut, so has to compile).
    The Point / Vec distinction is relatively new. I'm not sure how I feel about it. It's technically more correct but a bit of a PITA.
    That and normalized are two places where perhaps too much emphasis is put on types for little gain.