Class

# PixmapShape

<div class="rst-class">

forsearch

</div>

Shape

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Used to place a picture in a vector graphics environment.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                     | Type                               | Read-Only | Shared |
|------------------------------------------|------------------------------------|-----------|--------|
| `Height<pixmapshape.height>`             | `Double</api/data_types/double>`   |           |        |
| `Image<pixmapshape.image>`               | `Picture</api/graphics/picture>`   |           |        |
| `Rotation<pixmapshape.rotation>`         | `Double</api/data_types/double>`   |           |        |
| `Scale<pixmapshape.scale>`               | `Double</api/data_types/double>`   |           |        |
| `SourceHeight<pixmapshape.sourceheight>` | `Integer</api/data_types/integer>` |           |        |
| `SourceLeft<pixmapshape.sourceleft>`     | `Double</api/data_types/double>`   |           |        |
| `SourceTop<pixmapshape.sourcetop>`       | `Double</api/data_types/double>`   |           |        |
| `SourceWidth<pixmapshape.sourcewidth>`   | `Integer</api/data_types/integer>` |           |        |
| `Width<pixmapshape.width>`               | `Double</api/data_types/double>`   |           |        |
| `X<pixmapshape.x>`                       | `Double</api/data_types/double>`   |           |        |
| `Y<pixmapshape.y>`                       | `Double</api/data_types/double>`   |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                    | Parameters                                                                   | Returns                            | Shared |
|-----------------------------------------|------------------------------------------------------------------------------|------------------------------------|--------|
| `Constructor<pixmapshape.constructor0>` | image As `Picture</api/graphics/picture>`                                    |                                    |        |
| `Contains<pixmapshape.contains>`        | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>` | `Boolean</api/data_types/boolean>` |        |

## Property descriptions

<div id="pixmapshape.height">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PixmapShape.Height

**Height** As `Double</api/data_types/double>`

> The height of the rectangle.
>
> This example sets the height and width of the shape to 150 pixels.
>
> ``` xojo
> Var r As New RectShape
> r.Width = 150
> r.Height = 150
> r.BorderOpacity = 100
> r.BorderColor = Color.Black
> r.FillColor = Color.Teal
> r.BorderWidth = 2.5
> r.Rotation = -0.78
> g.DrawObject(r)
> ```

<div id="pixmapshape.image">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PixmapShape.Image

**Image** As `Picture</api/graphics/picture>`

> The source image to use.
>
> This example uses a jpeg image that has been added to the project. You can also initialize the <span class="title-ref">PixmapShape</span> to the image using the constructor. This code is is in the Paint event of a `Canvas</api/user_interface/desktop/desktopcanvas>`:
>
> ``` xojo
> Var p As Picture
> Var px As PixmapShape
> p = New Picture(640, 480)
> px = New PixmapShape(p)
> px.Image = CarImage
>
> g.DrawObject(px)
> ```

<div id="pixmapshape.rotation">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PixmapShape.Rotation

**Rotation** As `Double</api/data_types/double>`

> Clockwise rotation, in radians, around the X, Y point. Only set the rotation after you have drawn all your objects.
>
> This code rotates the arc 0.9 radians.
>
> ``` xojo
> Var a As New ArcShape
> a.Height = 150
> a.Width = 150
> a.Rotation = 0.90
> a.ArcAngle = 1.57
> a.StartAngle = -1.57
> g.DrawObject(a)
> ```

<div id="pixmapshape.scale">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PixmapShape.Scale

**Scale** As `Double</api/data_types/double>`

> The scaling factor relative to the object's original size.
>
> The following code rescales the arc by a factor of 1.5.
>
> ``` xojo
> Var a As New ArcShape
> a.Scale = 1.5
> a.Rotation = .90
> a.ArcAngle = 1.57
> a.StartAngle = -1.57
> g.DrawObject(a)
> ```

<div id="pixmapshape.sourceheight">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PixmapShape.SourceHeight

**SourceHeight** As `Integer</api/data_types/integer>`

> The height (pixels) of the source image, from *SourceTop*, *SourceLeft*. Used to define a subregion of *Image* to use.
>
> This example reports the left, top, width, and height of the image that was assigned to the <span class="title-ref">PixmapShape</span>. This image was added to the project and the coordinates are 0, 0, 558, 372.
>
> ``` xojo
> Var p As Picture
> Var px As PixmapShape
> p = New Picture(558, 372)
> px = New PixmapShape(p)
> px.Image = CarImage
>
> Label1.Text = px.SourceLeft.ToString
> Label2.Text = px.SourceTop.ToString
> Label3.Text = px.SourceWidth.ToString
> Label4.Text = px.SourceHeight.ToString
> ```

<div id="pixmapshape.sourceleft">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PixmapShape.SourceLeft

**SourceLeft** As `Double</api/data_types/double>`

> The number of pixels from the left edge of the source image. Used to define the subregion of *Image* to draw.
>
> This example reports the left, top, width, and height of the image that was assigned to the <span class="title-ref">PixmapShape</span>. This image was added to the project and the coordinates are 0, 0, 558, 372.
>
> ``` xojo
> Var p As Picture
> Var px As PixmapShape
> p = New Picture(558, 372)
> px = New PixmapShape(p)
> px.Image = CarImage
>
> Label1.Text = px.SourceLeft.ToString
> Label2.Text = px.SourceTop.ToString
> Label3.Text = px.SourceWidth.ToString
> Label4.Text = px.SourceHeight.ToString
> ```

<div id="pixmapshape.sourcetop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PixmapShape.SourceTop

**SourceTop** As `Double</api/data_types/double>`

> The number of pixels from the top edge of the source image. Used to define subregion of *Image* to draw.
>
> This example reports the left, top, width, and height of the image that was assigned to the <span class="title-ref">PixmapShape</span>. This image was added to the project and the coordinates are 0, 0, 558, 372.
>
> ``` xojo
> Var p As Picture
> Var px As PixmapShape
> p = New Picture(558, 372)
> px = New PixmapShape(p)
> px.Image = CarImage
>
> Label1.Text = px.SourceLeft.ToString
> Label2.Text = px.SourceTop.ToString
> Label3.Text = px.SourceWidth.ToString
> Label4.Text = px.SourceHeight.ToString
> ```

<div id="pixmapshape.sourcewidth">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PixmapShape.SourceWidth

**SourceWidth** As `Integer</api/data_types/integer>`

> The width (pixels) from *SourceLeft* of *Image* to draw. Used to define a subregion of *Image* to use.
>
> This example reports the left, top, width, and height of the image that was assigned to the <span class="title-ref">PixmapShape</span>. This image was added to the project and the coordinates are 0, 0, 558, 372.
>
> ``` xojo
> Var p As Picture
> Var px As PixmapShape
> p = New Picture(558, 372)
> px = New PixmapShape(p)
> px.Image = CarImage
>
> Label1.Text = px.SourceLeft.ToString
> Label2.Text = px.SourceTop.ToString
> Label3.Text = px.SourceWidth.ToString
> Label4.Text = px.SourceHeight.ToString
> ```

<div id="pixmapshape.width">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PixmapShape.Width

**Width** As `Double</api/data_types/double>`

> The width of the rectangle.

<div id="pixmapshape.x">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PixmapShape.X

**X** As `Double</api/data_types/double>`

> The horizontal position of the center or main anchor point.
>
> This example sets the horizontal position to 100 pixels from the left of the containing `Canvas</api/user_interface/desktop/desktopcanvas>`.
>
> ``` xojo
> Var a As New ArcShape
> a.Height = 150
> a.Width = 150
> a.ArcAngle = 1.57
> a.StartAngle = -1.57
> a.X = 100
> g.DrawObject(a)
> ```

<div id="pixmapshape.y">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PixmapShape.Y

**Y** As `Double</api/data_types/double>`

> The vertical position of the center or main anchor point.

## Method descriptions

<div id="pixmapshape.constructor0">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PixmapShape.Constructor

**Constructor**(image As `Picture</api/graphics/picture>`)

> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> `Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/new>` keyword and pass in the parameters above.
>
> </div>
>
> Creates a new <span class="title-ref">PixmapShape</span> that is initialized to the passed image.
>
> The following code in the Paint event of a Canvas draws a red oval using the Constructor to initialize the shape:
>
> ``` xojo
> Var p As Picture
> p = New Picture(240, 200)
> p.Graphics.DrawingColor = Color.Black
> p.Graphics.FillOval(0, 0, 240, 200)
> Var px As New PixmapShape(p)
> px.Rotation = 45 / 57.2958  ' 45 Degrees in radians
> g.DrawObject(px)
> ```

<div id="pixmapshape.contains">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PixmapShape.Contains

**Contains**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`) As `Boolean</api/data_types/boolean>`

> Tests whether the object contains the point *x*, *y*. Returns `True</api/language/true>` if the rectangle contains the point specified by *x*, *y*.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> If you want to use Contains, make sure to set the *X* and *Y* properties and **do not** pass the these to the `Graphics.DrawObject<graphics.drawobject>` method. `Graphics.DrawObject<graphics.drawobject>` parameters are the offset where the object will be drawn.
>
> </div>
>
> This code tests whether the RectShape contains the passed point:
>
> ``` xojo
> Var r As New RectShape
> r.Width = 75
> r.Height = 75
> r.BorderOpacity = 100
> r.Bordercolor = Color.Black
> r.FillColor = Color.Teal
> r.BorderWidth = 2.5
> r.Rotation = -0.78
> If r.Contains(50, 50) Then
> ' draw something here..
> End If
> g.DrawObject(r)
> ```

## Sample code

The following method in the Paint event of a Canvas draws a red oval:

``` xojo
Var p As Picture
p = New Picture(240, 200)
p.Graphics.DrawingColor = Color.Black
p.Graphics.FillOval(0, 0, 240, 200)
Var px As New PixmapShape(p)
px.Rotation = 45 / 57.2958  ' 45 Degrees in radians
g.DrawObject(px)
```

## Compatibility

|                       |                       |
|-----------------------|-----------------------|
| **Project Types**     | Console, Desktop, Web |
| **Operating Systems** | All                   |

<div class="seealso">

`RectShape</api/graphics/rectshape>` parent class; `ArcShape</api/graphics/arcshape>`, `CurveShape</api/graphics/curveshape>`, `FigureShape</api/graphics/figureshape>`, `FolderItem</api/files/folderitem>`, `Group2D</api/graphics/group2d>`, `Graphics</api/graphics/graphics>`, `Object2D</api/graphics/object2d>`, `OvalShape</api/graphics/ovalshape>`, `Picture</api/graphics/picture>`, `RectShape</api/graphics/rectshape>`, `RoundRectShape</api/graphics/roundrectshape>`, `TextShape</api/graphics/textshape>` classes.

</div>
