Name |
beginRaw()开始抓取 |
||||
Examples |
import processing.pdf.*;
void setup() { size(400, 400); beginRaw(PDF, “raw.pdf”); }
void draw() { line(pmouseX, pmouseY, mouseX, mouseY); }
void keyPressed() { if (key == ‘ ‘) { endRaw(); exit(); } } |
||||
Description |
To create vectors from 3D data, use the beginRaw() and endRaw() commands. These commands will grab the shape data just before it is rendered to the screen. At this stage, your entire scene is nothing but a long list of individual lines and triangles. This means that a shape created with sphere()function will be made up of hundreds of triangles, rather than a single object. Or that a multi-segment line shape (such as a curve) will be rendered as individual segments. When using beginRaw() and endRaw(), it’s possible to write to either a 2D or 3D renderer. For instance, beginRaw() with the PDF library will write the geometry as flattened triangles and lines, even if recording from the P3D renderer. If you want a background to show up in your files, use rect(0, 0, width, height) after setting the fill() to the background color. Otherwise the background will not be rendered to the file because the background is not shape. Using hint(ENABLE_DEPTH_SORT) can improve the appearance of 3D geometry drawn to 2D file formats. See examples in the reference for the PDF and DXF libraries for more information. 要创建来自3D 数据的向量, 请使用 beginRaw () 和 endRaw () 命令。这些命令将在将形状数据呈现到屏幕之前将其抓取。在这个阶段, 你的整个场景不过是一长串的单独的线和三角形。这意味着用球形 () 函数创建的形状将由数百个三角形组成, 而不是单个对象。或者, 多线形状 (如曲线) 将呈现为单个线段。
使用 beginRaw () 和 endRaw () 时, 可以写入2D 或3D 渲染器。例如, 使用 pdf 库的 beginRaw () 将几何作为平坦的三角形和线条写入, 即使从 P3D 渲染器中进行记录也是如此。
如果要在文件中显示背景, 请在将填充 () 设置为背景色后使用矩形 (0、0、宽度、高度)。否则, 背景将不会呈现给文件, 因为背景不是形状。
使用提示 (ENABLE_DEPTH_SORT) 可以改善绘制到2D 文件格式的3D 几何图形的外观。
有关详细信息, 请参阅 pdf 和 dxf 库参考中的示例。 |
||||
Syntax |
beginRaw(renderer, filename) |
||||
Parameters |
|
||||
Returns |
PGraphics or void |
||||
Related |
- 本文固定链接: http://iprocessing.cn/2017/08/01/beginraw开始抓取/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表