processing / processing/processing4
Add a PGraphics/framebuffer stack ala `createFrameBuffer()`
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 494
- Fork
- 183
- Merge trung bình
- 4 giờ 39 phút
- Pull request đã merge (30 ngày)
- 3
Mô tả
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.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách xác định ngăn xếp ma trận hiện có và vòng đời vẽ của PGraphics, đặc biệt là beginDraw() và endDraw(). Theo dõi cách các hàm vẽ mặc định và width/height hiện chọn framebuffer mặc định. Được xem là hoàn thành khi một ngăn xếp pushFB()/popFB() áp dụng các thao tác đó lên framebuffer trên cùng, đồng thời giữ nguyên hành vi hiện có khi không được sử dụng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- computer-graphics
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100