# Filling a PShape

**URL:** <https://discourse.processing.org/t/filling-a-pshape/33644>\
**Category:** Coding Questions\
**Created:** [November 21, 2021, 7:22am UTC](https://discourse.processing.org/t/filling-a-pshape/33644 "2021-11-21T07:22:15Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [November 21, 2021, 12:26pm UTC](https://discourse.processing.org/t/filling-a-pshape/33644/2 "2021-11-21T12:26:41Z")

</div>

Hello,

Here is an example using the existing `circle()` shape:

```auto
PImage img1, img2;
PGraphics pg;

void setup()
  {
  size(300, 300);
  //img1 = loadImage("https://processing.org/img/processing-web.png");
  img1 = loadImage("https://raw.githubusercontent.com/processing/processing-website/main/content/examples/Basics/Image/LoadDisplayImage/data/moonwalk.jpg");
  
  img2 = createImage(100, 100, RGB);
  img2 = img1.get(360, 100, 100, 100);
  
  pg = createGraphics(100, 100);
  pg.beginDraw();
  //pg.background(0);
  pg.noStroke();
  pg.fill(0, 0, 255); // Look this up in the references
  pg.circle(50, 50, 100);
  pg.endDraw();
  
  // The "pg image" is masking the "img2 image"
  img2.mask(pg); //Look this up in the references 
  
  background(255, 128, 0, 255);
  image(img2, 100, 100);
  noLoop();
  }

```

Look up all the tutorials and references related to the example:

> **[Welcome to Processing!](https://processing.org)**
>
> Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts. Since 2001, Processing has promoted software literacy within the visual arts…

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/0/0be026607b6f273fac32c7f85f97523602a9a05b.png)

You will have to use `createShape()` to create a shape with your vertices to replace the `circle()` shape in the example with your shape.

This may also be of interest:

> **[Reference](https://processing.org/reference/texture_.html)**
>
> Sets a texture to be applied to vertex points. The texture() function must be called between beginShape() and endShape() and before any calls to vertex(). This function onl…

`:)`

---

_[View the full topic](https://discourse.processing.org/t/filling-a-pshape/33644)._
