processing / processing/processing4
Add `beginClip()` and `endClip()` masking functions
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Java
- Estrellas
- 494
- Forks
- 183
- Merge medio
- 4 h 39 min
- PR fusionados (30 d)
- 3
Descripción
Relevant sub-area for this feature?
Core/Environment/Rendering
Feature details
Feature description
Add beginClip() and endClip() to define clipping masks using drawing commands. Shapes drawn between these calls become the mask. An optional invert flag enables inverse masking.
Benefits
- More intuitive and less verbose than
mask() - Matches p5.js API and reduces cognitive load when switching from one to the other
Challenges
- Not sure
Additional context
See https://p5js.org/reference/p5/beginClip/
Example code
This mask() code...
// Create pattern graphics
pattern = createGraphics(width, height);
pattern.beginDraw();
pattern.background(255);
pattern.stroke(0);
pattern.strokeWeight(2);
for (int x = 0; x < width; x += 10) {
pattern.line(x, 0, x, height);
}
pattern.endDraw();
// Create mask graphics (white circle on black)
maskImg = createGraphics(width, height);
maskImg.beginDraw();
maskImg.background(0);
maskImg.noStroke();
maskImg.fill(255);
maskImg.ellipse(width/2, height/2, 200, 200);
maskImg.endDraw();
// Apply mask to pattern
pattern.mask(maskImg);
... becomes this using beginClip()/endClip():
// Define clipping region
beginClip();
ellipse(width/2, height/2, 200, 200);
endClip();
// Draw pattern inside the clip
stroke(0);
strokeWeight(2);
for (int x = 0; x < width; x += 10) {
line(x, 0, x, height);
}
Would you like to help implement this feature?
No, I’m just suggesting the feature
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza en el área Core/Environment/Rendering leyendo el comportamiento existente de mask() y la referencia vinculada de p5.js beginClip(). Define cómo deben funcionar beginClip(), endClip() y la bandera invert opcional, y luego verifica que los comandos de dibujo entre las llamadas produzcan el comportamiento de recorte normal e inverso esperado.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- computer-graphics
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100