processing / processing/processing4

Add a PGraphics/framebuffer stack ala `createFrameBuffer()`

Ouverte
#726 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

enhancement
Langage dominant
Java
Étoiles
494
Forks
183
Merge moyen
4 h 39 min
PR mergées (30 j)
3

Description

Created by: scudly

I would like to have a PGraphics / framebuffer stack that works analogously to the matrix stack such that all the default drawing functions apply to the framebuffer currently at the top of the stack without having to reference it explicitly.

All too often, I write code that draws some complex object to the screen and then later end up wanting to draw it to a PGraphics instead so that I can, for instance, generate the image at a much higher resolution. This requires re-writing the code to pass in a PGraphics parameter (or using a global variable) and changing all of the drawing functions to use that PGraphics instead, such as line() to pg.line(). It's messy, error-prone (I always seem to miss changing a width to pg.width), and clutters up the code with all the pg. prefixes.

A far simpler mechanism would use a framebuffer stack with a pushFB( PGraphics pg ) / popFB() pair such that all drawing commands (and width and height constants) apply only to the framebuffer at the top of the stack. pushFB( pg ) would call endDraw() on the current top of stack, push pg on the stack, and then pg.beginDraw(). popFB() would endDraw() the top FB, pop it from the stack, and beginDraw() the new top. The stack is initialized with the default framebuffer and popping it either does nothing or throws an error.

All drawing functions would then be modified (entirely internally and invisible to the users, without any changes to the current API) to apply to the top-of-stack framebufffer. Anyone not using the FB stack wouldn't even know it's there, exactly analogous with the matrix stack.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par localiser la pile de matrices existante et le cycle de vie du dessin de PGraphics, en particulier beginDraw() et endDraw(). Suivez la manière dont les fonctions de dessin par défaut et width/height sélectionnent actuellement le framebuffer par défaut. Le travail est considéré comme terminé lorsqu’une pile pushFB()/popFB() applique ces opérations au framebuffer supérieur tout en préservant le comportement existant lorsqu’elle n’est pas utilisée.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
computer-graphics
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.