(p5, fn)
| 574 | }; |
| 575 | |
| 576 | function graphics(p5, fn){ |
| 577 | /** |
| 578 | * A class to describe a drawing surface that's separate from the main canvas. |
| 579 | * |
| 580 | * Each `p5.Graphics` object provides a dedicated drawing surface called a |
| 581 | * *graphics buffer*. Graphics buffers are helpful when drawing should happen |
| 582 | * offscreen. For example, separate scenes can be drawn offscreen and |
| 583 | * displayed only when needed. |
| 584 | * |
| 585 | * `p5.Graphics` objects have nearly all the drawing features of the main |
| 586 | * canvas. For example, calling the method `myGraphics.circle(50, 50, 20)` |
| 587 | * draws to the graphics buffer. The resulting image can be displayed on the |
| 588 | * main canvas by passing the `p5.Graphics` object to the |
| 589 | * <a href="#/p5/image">image()</a> function, as in `image(myGraphics, 0, 0)`. |
| 590 | * |
| 591 | * Note: <a href="#/p5/createGraphics">createGraphics()</a> is the recommended |
| 592 | * way to create an instance of this class. |
| 593 | * |
| 594 | * @class p5.Graphics |
| 595 | * @extends p5.Element |
| 596 | * @param {Number} w width width of the graphics buffer in pixels. |
| 597 | * @param {Number} h height height of the graphics buffer in pixels. |
| 598 | * @param {(P2D|WEBGL|P2DHDR)} renderer the renderer to use, either P2D or WEBGL. |
| 599 | * @param {p5} [pInst] sketch instance. |
| 600 | * @param {HTMLCanvasElement} [canvas] existing `<canvas>` element to use. |
| 601 | * |
| 602 | * @example |
| 603 | * let pg; |
| 604 | * |
| 605 | * function setup() { |
| 606 | * createCanvas(100, 100); |
| 607 | * |
| 608 | * // Create a p5.Graphics object. |
| 609 | * pg = createGraphics(50, 50); |
| 610 | * |
| 611 | * // Draw to the p5.Graphics object. |
| 612 | * pg.background(100); |
| 613 | * pg.circle(25, 25, 20); |
| 614 | * |
| 615 | * describe('A dark gray square with a white circle at its center drawn on a gray background.'); |
| 616 | * } |
| 617 | * |
| 618 | * function draw() { |
| 619 | * background(200); |
| 620 | * |
| 621 | * // Display the p5.Graphics object. |
| 622 | * image(pg, 25, 25); |
| 623 | * } |
| 624 | * |
| 625 | * @example |
| 626 | * // Click the canvas to display the graphics buffer. |
| 627 | * |
| 628 | * let pg; |
| 629 | * |
| 630 | * function setup() { |
| 631 | * createCanvas(100, 100); |
| 632 | * |
| 633 | * // Create a p5.Graphics object. |
nothing calls this directly
no test coverage detected