I'm working on a visualization for a 7680x1080 projection.
The production company wants me to out put this as 3840x2160.
我将如何在处理中做到这一点,以便处理仍然将其视为 1 个大画布,我可以在整个宽度上拥有无缝的图形?
谢谢!Serge
在PGraphics
和PImage
对象中进行处理绘图(在此处了解更多信息:https://processing.org/reference/PImage.html)
然后,您可以读取放置在 PGraphics 画布中的像素,并将它们拆分为 2 个 PImage 对象
例子:
int w = 500;
int h = 500;
PImage topCanvas;
PImage bottomCanvas;
PGraphics mainCanvas;
void setup() {
background(255);
size(w, h, P3D);
mainCanvas = createGraphics(w, h, P2D);
mainCanvas.beginDraw();
for(int i=0; i<w; i++){
for(int j=0; j<h; j++){
mainCanvas.stroke( random(255), random(255), random(255), random(255));
mainCanvas.point(i, j);
}
}
mainCanvas.endDraw();
}
void draw(){
topCanvas = mainCanvas.get(0,0,w, h/2);
bottomCanvas = mainCanvas.get(0,h/2,w, h/2);
image(topCanvas, 0, 0);
image(bottomCanvas, 0, h/2);
}
处理已经是一个大画布。您可以控制绘制内容和绘制位置。
您可以跟踪视口的大小和位置,然后将绘图拆分为函数:
float viewportTwoX;
float viewportTwoY;
float viewportWidth;
float viewportHeight;
void setup() {
size(768, 108);
viewportTwoX = width/2;
viewportTwoY = 0;
viewportWidth = width/2;
viewportHeight = height;
}
void draw() {
background(0);
drawViewportOne();
drawViewportTwo();
}
void drawViewportOne() {
fill(64);
noStroke();
rect(0, 0, viewportWidth, viewportHeight);
fill(255);
text("viewport 1", viewportWidth/2, viewportHeight/2);
}
void drawViewportTwo() {
translate(viewportTwoX, viewportTwoY);
fill(128);
noStroke();
rect(0, 0, viewportWidth, viewportHeight);
fill(255);
text("viewport 2", viewportWidth/2, viewportHeight/2);
}
然后,如果要更改第二个视口的位置,则只需更改这些变量的值:
void setup() {
size(384, 216);
viewportTwoX = 0;
viewportTwoY = height/2;
viewportWidth = width;
viewportHeight = height/2;
}
本站系公益性非盈利分享网址,本文来自用户投稿,不代表边看边学立场,如若转载,请注明出处
评论列表(85条)