首页 > 文档 > background()背景
2017
08-08

background()背景

Name

background()背景

   

Examples

background()背景 - 第1张  | Processing编程艺术background()背景 - 第2张  | Processing编程艺术background()背景 - 第3张  | Processing编程艺术

background(51);

background()背景 - 第4张  | Processing编程艺术background()背景 - 第5张  | Processing编程艺术background()背景 - 第6张  | Processing编程艺术

background(255, 204, 0);

background()背景 - 第7张  | Processing编程艺术background()背景 - 第8张  | Processing编程艺术background()背景 - 第9张  | Processing编程艺术

PImage img;

img = loadImage(“laDefense.jpg”);

background(img);

Description

The background() function sets the color used for the background of the Processing window. The default background is light gray. This function is typically used within draw() to clear the display window at the beginning of each frame, but it can be used inside setup() to set the background on the first frame of animation or if the backgound need only be set once. 

An image can also be used as the background for a sketch, although the image’s width and height must match that of the sketch window. Images used with background() will ignore the current tint() setting. To resize an image to the size of the sketch window, use image.resize(width, height). 

It is not possible to use the transparency alpha parameter with background colors on the main drawing surface. It can only be used along with a PGraphics object and createGraphics().

背景 () 函数设置用于处理窗口背景的颜色。默认背景为浅灰色。此函数通常在绘图 () 中使用, 以在每个帧的开始处清除显示窗口, 但可以在安装程序 () 内使用它来设置动画第一帧的背景, 或者背景只需要设置一次。

 

图像也可以用作草绘的背景, 但图像的宽度和高度必须与草绘窗口的大小相匹配。与背景 () 一起使用的图像将忽略当前淡色 () 设置。要将图像调整到草绘窗口的大小, 请使用图像. 调整大小 (宽度、高度)

 

在主绘图图面上使用透明 alpha 参数和背景色是不可能的。它只能与 PGraphics 对象和 createGraphics () 一起使用。

Syntax

background(rgb)

background(rgb, alpha)

background(gray)

background(gray, alpha)

background(v1, v2, v3)

background(v1, v2, v3, alpha)

background(image)

Parameters

rgb

int: any value of the color datatype

颜色数据类型的任何值

alpha

float: opacity of the background

背景的不透明度

gray

float: specifies a value between white and black

指定介于白色和黑色之间的值

v1

float: red or hue value (depending on the current color mode)

红色或色相值 (取决于当前的颜色模式)

v2

float: green or saturation value (depending on the current color mode)

绿色或饱和值 (取决于当前颜色模式)

v3

float: blue or brightness value (depending on the current color mode)

蓝色或亮度值 (取决于当前颜色模式)

image

PImage: PImage to set as background (must be same size as the sketch window)

PImage 设置为背景 (必须与草绘窗口大小相同)

Returns

void

Related

stroke()
fill()
tint()
colorMode()



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

留下一个回复

你的email不会被公开。