> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/flatredball/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flatredball.com/flatredball/glue-reference/objects/object-types/glue-reference-layer/glue-reference-objects-layers-destinationrectangle.md).

# DestinationRectangle

### Introduction

The DestinationRectangle can be used to make a Layer only draw to part of a Screen. This is often referred to as "masking" or "creating a mask". The DestinationRectangle property in Glue functions the same as in code. For a technical discussion on destination rectangles for Layers, see [this page](https://github.com/flatredball/FlatRedBallDocs/blob/main/frb/docs/index.php).

### Example Usage

The DestinationRectangle can control the area of the screen where a Layer is drawn. By default the DestinationRectangle is blank in Glue, meaning that the Layer will occupy the same area on screen as the main Camera.

&#x20;&#x20;

<figure><img src="/files/QeiauQw4KKHK77b0CkuQ" alt=""><figcaption></figcaption></figure>

This destination rectangle can be changed in Glue. To do this:

1. Right-click on "DestinationRectnagle" in Glue.
2. An option for "Use Custom Rectangle" should appear<br>

   <figure><img src="/files/XhMPTVSGmL29tJta0oVH" alt=""><figcaption></figcaption></figure>
3. Select this option and the Layer will be given a custom rectangle:

   <figure><img src="/files/Xoqn5hOTy8NPDjDhWZaR" alt=""><figcaption></figcaption></figure>

Now that the DestinationRectangle value is there, we can modify it easily by changing one of the four values, or by expanding the DestinationRectangle and modifying each value independently: &#x20;

<figure><img src="/files/tPpbKTrjMtiQJ4zFuC5P" alt=""><figcaption></figcaption></figure>

Consider a Sprite which takes up nearly the entire screen:

<figure><img src="/files/TT96z2U5qkgoD2SlJt17" alt=""><figcaption></figcaption></figure>

If this Sprite were put on the Layer, it would look like this:

<figure><img src="/files/hKyluplukWFCgNkrMDCY" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flatredball.com/flatredball/glue-reference/objects/object-types/glue-reference-layer/glue-reference-objects-layers-destinationrectangle.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
