Loading

Pclip

processing

Limits the rendering to the boundaries of a rectangle defined by the parameters. The boundaries are drawn based on the state of the PimageMode function, either CORNER, CORNERS, or CENTER.

Link to original Processing doc

Pclip is available since version 1.0.0.

See also

Signatures

Examples

// @preview image 200 100 '2D' PGraphics DUP 'Pg' STORE //new 200x100 image 0xffff90ff Pbackground //purple background PnoFill 'CENTER' PimageMode //set Pimage mode to centered 100 50 20 20 Pclip //restrict next operation to a 20 20 square. 'CENTER' PrectMode 2 PstrokeWeight 100 50 20 20 Prect //draw the 20 20 clipping //load a klingon salute png "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAABggAAAYIBFx04PQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAMkSURBVFiFrddNqFVVFAfwn/oSv0jtKZqPkiZiHyRpIWka2ixpUpBBhZhgg2jwBk0cFCES4SCIHFQDBbWocBDiwFLoKUWDBBE0sYwSeoZlPTV86ktvg7UPd3veve/ec+/7w2GfdfZee/3PXmuvtTdjYwnWYGqDvqdxEpfwOea0mKsSJuFT1NJzAcuy/kUYxtd4C39hP1ZhA+7rlsDzyfArYhWO4/usvx/X1Ffm9YxsDdexvhsCW3E+kzekiRckeTvOZf2bUv+r6MU+sSoTWxlqNuBXzMPcJA+kdnVqZ2EoGz8LN/AxLmJvIjK/EwJLRAxMED4tCJ1rQWAIt5I8PbXDVQhMxpfC3x+mb6uz/oFMnt2EQC7fwuUqBF7CM3gRj4gt9mTWfwQPCLeUDTYidAU3qxB4EL/gE7EKO/BwmqwgULilmQtyQv+0Ml4mcBF9wv9wNPU/keQzGBRumI2/SwbLcmUCpzEF9yb5pEhAeRwcFW6ZKTJggUYrUpnAj6m9P7U1fGt0HBS7pGywTKiQF+AAroqffLYZgZ8xgsXZtwEsxYxMnpDeW+2CodR+I2JpK87iM1la78mURtKAnMCRNGYFvsIpkeHmZAYnY1oDApewWySj5WKFe0QcPYdj5RUgligncCJNXLihlv4I/siMMXoXrMc6bFR37zQRZ1c1wTsi8HLsx8FMXogXMvkO7MI9SZ4k9n8N75bmek8UsabVsig6vdm3xeopuR3cmeY4pL6lieAdwdtjKS9PyisrGGyEjbgrkyfiOxHoU8ZSLNhv6pJAGZvTvOvaGTwo6v14oRd/imNbWzgsAm+8sFNUxb52FT4Q+WA8sEqU5f4qSi+7/fjVKXpEVT0htmrb6MN/4qDZDd4Q+eDxTpT3ibNBo/tAO1iIf/FRh/oeEhnr/Q50p+IH/O72XFAZ/SIWtlTQmS5W74b6QaYrbEskvtA6KB8V1XJYl5eSMs4mEtewRxxal4nr2VN4TaTZ4la0djyNw0/J8JvpvVZ6booSXdwl5zacpQl6Wg8Bd4vDyXaxTReJonIev4nz32NVDFfBAaP/utkzqEW1K+N/QkDNWuXUcakAAAAASUVORK5CYII=" Pdecode DUP 'Pimg' STORE //decode it 100 50 Pimage //paste it in the middle of the image 'CORNER' PimageMode //change mode PnoClip //stop clipping restriction $Pimg 100 50 Pimage //paste it with top left corner in the middle of the image Pencode //render