首页 > 文档 > clear()清空
2017
08-08

clear()清空

Name

clear()清空

   

Examples

PGraphics pg;

 

void setup() {

size(200, 200);

pg = createGraphics(100, 100);

}

 

void draw() {

background(204);

pg.beginDraw();

pg.stroke(0, 102, 153);

pg.line(0, 0, mouseX, mouseY);

pg.endDraw();

image(pg, 50, 50);

}

 

// Click to clear the PGraphics object

void mousePressed() {

pg.beginDraw();

pg.clear();

pg.endDraw();

}

Description

Clears the pixels within a buffer. This function only works on PGraphics objects created with the createGraphics() function. Unlike the main graphics context (the display window), pixels in additional graphics areas created with createGraphics() can be entirely or partially transparent. This function clears everything in a PGraphics object to make all of the pixels 100% transparent.

清除缓冲区中的像素。此函数仅适用于使用 createGraphics () 函数创建的 PGraphics 对象。与主图形上下文 (显示窗口) 不同, 使用 createGraphics () 创建的其他图形区域中的像素可以完全或部分透明。此函数清除 PGraphics 对象中的所有内容, 以使所有像素100% 透明。

Syntax

clear()

Returns

void



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。