creativescala / doodle

Compositional vector graphics in Scala / Scala.JS
https://creativescala.org/doodle/
Apache License 2.0
327 stars 75 forks source link

Add an algebra for clipping #114

Open noelwelsh opened 2 years ago

noelwelsh commented 2 years ago

Overview

Most 2D backends have a notion of clipping, which basically means restricting where drawing can take place. We don't expose clipping in Doodle but it would be straightforward to define an algebra for clipping and implement it on a backend or two, and it opens up a lot of creative possibilities.

Details

Tasks:

Assuming it's a single operation, the clipping algebra could look like

trait Clip extends Algebra {
  def clip[A](img: Drawing[A], path: ClosedPath): Drawing[A]
}
medmabcf commented 6 months ago

@noelwelsh Hello, I hope that you are well , this is my first time contributing. I know about clipping from my experience in dealing with images. What I understand is that I have to implement the clipping types (points, line, ellipse, etc.) and I have an idea to use Path2D from java.awt.geom. Am I right?

noelwelsh commented 6 months ago

@noelwelsh Hello, I hope that you are well , this is my first time contributing. I know about clipping from my experience in dealing with images. What I understand is that I have to implement the clipping types (points, line, ellipse, etc.) and I have an idea to use Path2D from java.awt.geom. Am I right?

I don't think there is quite enough detail in your description that I'm confident I understand what you mean.

There are two parts to this:

Does that help clear things up?

VOSID8 commented 5 months ago

I'll take this up! @noelwelsh please assign

Shehrozkashif commented 3 weeks ago

can you please assign this issue to me

noelwelsh commented 3 weeks ago

can you please assign this issue to me

We don't assign issues to people, as the project is small enough that we don't need this formality (and, in the past, people have been assigned issues they have never completed). I've added a little section at https://www.creativescala.org/doodle/development/process.html that describes this a bit more.