Loading

Pshape

processing

Draws shapes to the display window. Shapes must be loaded with PloadShape. Processing currently works with SVG, OBJ, and custom-created shapes. WrapScript only support SVG. The shape parameter specifies the shape to display and the coordinate parameters define the location of the shape from its upper-left corner. The shape is displayed at its original size unless the c and d parameters specify a different size. The PshapeMode function can be used to change the way these parameters are interpreted.

Link to original Processing doc

Pshape is available since version 1.2.18.

See also

Signatures

Examples

// @preview image '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 313.6 313.6" style="enable-background:new 0 0 313.6 313.6;" xml:space="preserve"><g> <path d="M278.959,113.533c-12.322-9.484-30.178-7.261-39.8,4.953l-18.764,23.819l6.261-97.69 c0.963-15.03-10.482-28.042-25.513-29.006c-5.567-0.353-10.859,1-15.366,3.604c-1.125-3.628-3.007-7.012-5.592-9.948 c-4.822-5.476-11.488-8.746-18.769-9.208c-7.291-0.459-14.308,1.938-19.783,6.76s-8.746,11.487-9.209,18.769l-5.314,83.675 l-19.981-81.814c-1.73-7.088-6.118-13.078-12.354-16.865C88.539,6.791,81.2,5.662,74.113,7.39 c-7.088,1.731-13.077,6.119-16.864,12.354c-3.788,6.236-4.921,13.574-3.189,20.661l3.936,16.116 c-3.623-0.99-7.503-1.253-11.444-0.626C31.682,58.259,21.49,72.282,23.829,87.154L43.738,213.74 c3.648,23.2,15.488,44.381,33.338,59.643c0.908,0.777,1.838,1.523,2.771,2.264c-0.034,0.28-0.057,0.563-0.057,0.851V306.6 c0,3.866,3.134,7,7,7h103.001c3.866,0,7-3.134,7-7v-26.838c11.356-7.742,21.146-17.839,28.483-29.813l60.609-98.91 C293.523,138.573,290.546,122.449,278.959,113.533z M182.791,299.6H93.79v-14.707c14.437,7.907,30.724,12.156,47.384,12.156 c14.536,0,28.73-3.294,41.617-9.317V299.6z M273.946,143.724l-60.609,98.911c-15.275,24.928-42.927,40.414-72.163,40.414 c-41.93,0-77.091-30.063-83.605-71.484L37.659,84.979c-1.142-7.259,3.833-14.103,11.09-15.257 c6.313-1.001,12.304,2.628,14.513,8.365L82.266,155.9c0.78,3.198,3.643,5.341,6.794,5.341c0.55,0,1.109-0.065,1.667-0.201 c3.755-0.917,6.057-4.706,5.139-8.461L77.834,78.744c-0.007-0.054-0.009-0.107-0.017-0.161c-0.248-1.561-0.632-3.066-1.124-4.514 l-9.033-36.985c-0.844-3.455-0.291-7.032,1.555-10.072c1.847-3.04,4.767-5.178,8.222-6.022c7.129-1.741,14.351,2.644,16.094,9.775 l27.854,114.05c0.955,3.92,4.44,6.723,8.47,6.815c4.848,0.144,8.823-3.562,9.126-8.365l7.418-116.796 c0.225-3.549,1.819-6.798,4.488-9.148c2.67-2.351,6.099-3.517,9.644-3.295c3.55,0.226,6.799,1.819,9.149,4.489 c2.351,2.669,3.521,6.094,3.295,9.643l-0.792,12.474c-0.013,0.163-0.033,0.323-0.044,0.487c-0.005,0.086-0.001,0.17-0.003,0.255 l-6.697,105.433c-0.245,3.858,2.685,7.185,6.543,7.43c3.834,0.25,7.185-2.684,7.43-6.542l6.73-105.956 c0.61-7.188,6.844-12.625,14.108-12.161c7.327,0.47,12.906,6.813,12.438,14.139l-7.702,120.144 c-0.196,3.059,1.62,5.889,4.482,6.985c2.863,1.096,6.104,0.202,8.001-2.205l32.689-41.493c4.9-6.218,13.992-7.35,20.265-2.522 C276.32,129.167,277.836,137.377,273.946,143.724z"/></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g></svg>' 'svgsalute' STORE $svgsalute PloadShape 'saluteShape' STORE //load and store as a shape 200 200 '2D3' PGraphics //255 Pbackground 0 0 Ptranslate $saluteShape 0 0 200 200 Pshape //draw a big one 'CENTER' PshapeMode $saluteShape 100 120 20 20 Pshape //draw a small one Pencode $saluteShape TYPEOF //display type on the stack