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

Add an algebra for clipping #114

Open
3 tasks
noelwelsh opened this issue May 20, 2022 · 5 comments
Open
3 tasks

Add an algebra for clipping #114

noelwelsh opened this issue May 20, 2022 · 5 comments
Labels
enhancement good first issue Good issue for new contributors hacktoberfest Good for Hacktoberfest

Comments

@noelwelsh
Copy link
Contributor

noelwelsh commented May 20, 2022

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:

  • Investigate how clipping is exposed in various 2D backends. I think it's basically a single operation that requires a path
  • Define algebra for clipping operation(s)
  • Implement for at least Java 2D

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]
}
@noelwelsh noelwelsh added enhancement good first issue Good issue for new contributors labels Mar 29, 2023
@medmabcf
Copy link

medmabcf commented Mar 13, 2024

@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
Copy link
Contributor Author

@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:

  • defining the path that should be used to clip the Picture. There is aleady a ClosedPath type in Doodle that can be used for this.

  • implementing clipping on the different backends. This is where Path2D would be used (in the Java2D backend). There is alread code to do this conversion.

Does that help clear things up?

@VOSID8
Copy link
Contributor

VOSID8 commented Apr 4, 2024

I'll take this up! @noelwelsh please assign

@Shehrozkashif
Copy link

can you please assign this issue to me

@noelwelsh
Copy link
Contributor Author

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.

@noelwelsh noelwelsh added the hacktoberfest Good for Hacktoberfest label Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue Good issue for new contributors hacktoberfest Good for Hacktoberfest
Projects
None yet
Development

No branches or pull requests

4 participants