<div class="meta" robots="noindex">

</div>

# iOSGraphics

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

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2020r2. Please use `Graphics</api/graphics/graphics>` as a replacement.

</div>

## Description

Used to draw text, lines, rectangle and images.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                       | Type                                        | Read-Only | Shared |
|------------------------------------------------------------|---------------------------------------------|-----------|--------|
| `Alpha</api/deprecated/iosgraphics/alpha>`                 | `Double</api/data_types/double>`            |           |        |
| `AntiAlias</api/deprecated/iosgraphics/antialias>`         | `Boolean</api/data_types/boolean>`          |           |        |
| `FillColor</api/deprecated/iosgraphics/fillcolor>`         | `Color</api/data_types/color>`              |           |        |
| `Handle</api/deprecated/iosgraphics/handle>`               | `Ptr</api/data_types/additional_types/ptr>` | ✓         |        |
| `Height</api/deprecated/iosgraphics/height>`               | `Integer</api/data_types/integer>`          | ✓         |        |
| `LineColor</api/deprecated/iosgraphics/linecolor>`         | `Color</api/data_types/color>`              |           |        |
| `LineWidth</api/deprecated/iosgraphics/linewidth>`         | `Double</api/data_types/double>`            |           |        |
| `TextFont</api/deprecated/iosgraphics/textfont>`           | `iOSFont</api/deprecated/iosfont>`          |           |        |
| `TextUnderline</api/deprecated/iosgraphics/textunderline>` | `Boolean</api/data_types/boolean>`          |           |        |
| `Width</api/deprecated/iosgraphics/width>`                 | `Integer</api/data_types/integer>`          | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                       | Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                | Returns                    | Shared |
|------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------|--------|
| `ClipToPath</api/deprecated/iosgraphics/cliptopath>`       | path As `GraphicsPath</api/graphics/graphicspath>`                                                                                                                                                                                                                                                                                                                                                                                                                        |                            |        |
| `ClipToRect</api/deprecated/iosgraphics/cliptorect>`       | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                       |                            |        |
| `DrawLine</api/deprecated/iosgraphics/drawline>`           | x1 As `Double</api/data_types/double>`, y1 As `Double</api/data_types/double>`, x2 As `Double</api/data_types/double>`, y2 As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                            |                            |        |
| `DrawOval</api/deprecated/iosgraphics/drawoval>`           | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                       |                            |        |
| `DrawPath</api/deprecated/iosgraphics/drawpath>`           | path As `GraphicsPath</api/graphics/graphicspath>`                                                                                                                                                                                                                                                                                                                                                                                                                        |                            |        |
| `DrawRect</api/deprecated/iosgraphics/drawrect>`           | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                       |                            |        |
| `DrawRoundRect</api/deprecated/iosgraphics/drawroundrect>` | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`, cornerWidth As `Double</api/data_types/double>`, cornerHeight As `Double</api/data_types/double>`                                                                                                                                                                                                    |                            |        |
| `DrawTextBlock</api/deprecated/iosgraphics/drawtextblock>` | value As `String</api/data_types/string>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, maxWidth As `Double</api/data_types/double>` = -1.0, maxHeight As `Double</api/data_types/double>` = -1.0, alignment As `iOSTextAlignment</api/deprecated/xojo.iostextalignment>` = `iOSTextAlignment.Left</api/deprecated/xojo.iostextalignment/values>`, truncateLastLine As `Boolean</api/data_types/boolean>` = `False</api/language/false>` |                            |        |
| `DrawTextLine</api/deprecated/iosgraphics/drawtextline>`   | value As `String</api/data_types/string>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, maxWidth As `Double</api/data_types/double>` = -1.0, alignment As `iOSTextAlignment</api/deprecated/xojo.iostextalignment>` = `iOSTextAlignment.Left</api/deprecated/xojo.iostextalignment/values>`, truncate As `Boolean</api/data_types/boolean>` = `False</api/language/false>`                                                               |                            |        |
| `FillOval</api/deprecated/iosgraphics/filloval>`           | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                       |                            |        |
| `FillPath</api/deprecated/iosgraphics/fillpath>`           | path As `GraphicsPath</api/graphics/graphicspath>`                                                                                                                                                                                                                                                                                                                                                                                                                        |                            |        |
| `FillRect</api/deprecated/iosgraphics/fillrect>`           | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                       |                            |        |
| `FillRoundRect</api/deprecated/iosgraphics/fillroundrect>` | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`, cornerWidth As `Double</api/data_types/double>`, cornerHeight As `Double</api/data_types/double>`                                                                                                                                                                                                    |                            |        |
| `RestoreState</api/deprecated/iosgraphics/restorestate>`   |                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |                            |        |
| `SaveState</api/deprecated/iosgraphics/savestate>`         |                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |                            |        |
| `Scale</api/deprecated/iosgraphics/scale>`                 | scaleX As `Double</api/data_types/double>`, scaleY As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                                                                                                    |                            |        |
| `TextBlockSize</api/deprecated/iosgraphics/textblocksize>` | value As `String</api/data_types/string>`, maxWidth As `Double</api/data_types/double>` = -1.0, maxHeight As `Double</api/data_types/double>` = -1.0, alignment As `iOSTextAlignment</api/deprecated/xojo.iostextalignment>` = `iOSTextAlignment.Left</api/deprecated/xojo.iostextalignment/values>`, truncateLastLine As `Boolean</api/data_types/boolean>` = `False</api/language/false>`                                                                               | `Size</api/graphics/size>` |        |
| `TextLineSize</api/deprecated/iosgraphics/textlinesize>`   | value As `String</api/data_types/string>`, maxWidth As `Double</api/data_types/double>` = -1.0, alignment As `iOSTextAlignment</api/deprecated/xojo.iostextalignment>` = `iOSTextAlignment.Left</api/deprecated/xojo.iostextalignment/values>`, truncate As `Boolean</api/data_types/boolean>` = `False</api/language/false>`                                                                                                                                             | `Size</api/graphics/size>` |        |
| `Translate</api/deprecated/iosgraphics/translate>`         | translateX As `Double</api/data_types/double>`, translateY As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                                                                                            |                            |        |

## Property descriptions

<div id="/api/deprecated/iosgraphics/alpha">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.Alpha

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

The Alpha value, which ranges from 0.0 (transparent) to 1.0 (opaque).

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
g.Alpha = 0.5
```

<div id="/api/deprecated/iosgraphics/antialias">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.AntiAlias

**AntiAlias** As `Boolean</api/data_types/boolean>`

Specifies whether anti-aliasing is used. The default is True.

From within an iOSCanvas.Paint event handler:

``` xojo
g.AntiAlias = False
```

<div id="/api/deprecated/iosgraphics/fillcolor">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.FillColor

**FillColor** As `Color</api/data_types/color>`

The color used when drawing filled shapes and text.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
g.FillColor = Color.RGB(0, 0, 255) ' Blue
```

<div id="/api/deprecated/iosgraphics/handle">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.Handle

**Handle** As `Ptr</api/data_types/additional_types/ptr>`

The handle for the CGContextRef used by the graphics object.

This property is read-only.

<div id="/api/deprecated/iosgraphics/height">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.Height

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

The height of the graphics area, in points.

This property is read-only.

From within an iOSCanvas.Paint event handler:

``` xojo
g.LineColor = Color.Blue
g.DrawLine(0, 0, g.Width, g.Height)
```

<div id="/api/deprecated/iosgraphics/linecolor">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.LineColor

**LineColor** As `Color</api/data_types/color>`

The color to use when drawing lines and shapes.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
g.LineColor = Color.Blue
g.DrawLine(0, 0, g.Width, g.Height)
```

<div id="/api/deprecated/iosgraphics/linewidth">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.LineWidth

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

The width (in points) to use when drawing lines and shapes.

``` xojo
g.LineWidth = 10
g.DrawLine(0, 20, 50, 20)
```

<div id="/api/deprecated/iosgraphics/textfont">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.TextFont

**TextFont** As `iOSFont</api/deprecated/iosfont>`

The font to use when drawing text.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
g.TextFont = New iOSFont("Helvetica Neue", 12)
g.FillColor = Color.Blue
g.DrawTextBlock("Hello, World!", 30, 30)
```

<div id="/api/deprecated/iosgraphics/textunderline">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.TextUnderline

**TextUnderline** As `Boolean</api/data_types/boolean>`

Indicates if drawn text should be underlined.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
g.TextFont = New iOSFont("Helvetica Neue", 12)
g.TextUnderline = True
g.DrawTextBlock("Hello, World!", 30, 30)
```

<div id="/api/deprecated/iosgraphics/width">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.Width

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

The width of the graphics area, in points.

This property is read-only.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
g.LineColor = Color.Blue
g.DrawLine(0, 0, g.Width, g.Height)
```

## Method descriptions

<div id="/api/deprecated/iosgraphics/cliptopath">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.ClipToPath

**ClipToPath**(path As `GraphicsPath</api/graphics/graphicspath>`)

Clips the drawing to the specified path.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
' Clip to an iOSPath
' Path is a triangle
Var p As New iOSPath
p.MoveToPoint(0, 0) ' Start location
p.LineToPoint(20, 44)
p.LineToPoint(40, 0)
p.LineToPoint(0, 0)

g.ClipToPath(p)
g.FillOval(0, 0, 50, 50)
```

<div id="/api/deprecated/iosgraphics/cliptorect">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.ClipToRect

**ClipToRect**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`)

Clips the drawing to the specified rectangle.

From within an iOSCanvas.Paint event handler:

``` xojo
' The part of the circle drawn outside the clip area
' is not displayed.
g.ClipToRect(0, 0, 50, 50)

g.FillColor = Color.Blue
g.FillOval(25, 25, 50, 50)
```

<div id="/api/deprecated/iosgraphics/drawline">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.DrawLine

**DrawLine**(x1 As `Double</api/data_types/double>`, y1 As `Double</api/data_types/double>`, x2 As `Double</api/data_types/double>`, y2 As `Double</api/data_types/double>`)

Draws a line from x1, y1 to x2, y2.

From within an iOSCanvas.Paint event handler:

``` xojo
g.LineColor = Color.Blue
g.DrawLine(0, 0, g.Width, g.Height)
```

<div id="/api/deprecated/iosgraphics/drawoval">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.DrawOval

**DrawOval**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`)

Draws an oval where x and y are the top left corner. If width and height are the same, then a circle is drawn.

From within an iOSCanvas.Paint event handler:

``` xojo
g.DrawOval(50, 50, 25, 25)

' Draw circle in center of graphics area
Const kSize As Integer = 100
g.DrawOval((g.Width - kSize) / 2, (g.Height - kSize) / 2, kSize, kSize)
```

<div id="/api/deprecated/iosgraphics/drawpath">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.DrawPath

**DrawPath**(path As `GraphicsPath</api/graphics/graphicspath>`)

Draws the specified path.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
' Draw a triangle
Var p As New iOSPath
p.MoveToPoint(0, 0) ' Start location
p.LineToPoint(20, 44)
p.LineToPoint(40, 0)
p.LineToPoint(0, 0)

g.LineColor = Color.Blue
g.DrawPath(p)
```

<div id="/api/deprecated/iosgraphics/drawrect">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.DrawRect

**DrawRect**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`)

Draws a rectangle.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
g.LineColor = Color.Blue
g.DrawRect(10, 10, 20, 20)
```

<div id="/api/deprecated/iosgraphics/drawroundrect">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.DrawRoundRect

**DrawRoundRect**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`, cornerWidth As `Double</api/data_types/double>`, cornerHeight As `Double</api/data_types/double>`)

Draws a rounded rectangle.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
g.LineColor = Color.Blue
g.DrawRoundRect(10, 10, 50, 50, 5, 5)
```

<div id="/api/deprecated/iosgraphics/drawtextblock">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.DrawTextBlock

**DrawTextBlock**(value As `String</api/data_types/string>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, maxWidth As `Double</api/data_types/double>` = -1.0, maxHeight As `Double</api/data_types/double>` = -1.0, alignment As `iOSTextAlignment</api/deprecated/xojo.iostextalignment>` = `iOSTextAlignment.Left</api/deprecated/xojo.iostextalignment/values>`, truncateLastLine As `Boolean</api/data_types/boolean>` = `False</api/language/false>`)

Draws a block of text.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
g.FillColor = Color.Blue
Var t As Text
t = "How much wood would a woodchuck chuck if a woodchuck could chuck wood?"
g.DrawTextBlock(t, 0, 10, g.Width, g.Height, iOSTextAlignment.Left, False)
```

<div id="/api/deprecated/iosgraphics/drawtextline">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.DrawTextLine

**DrawTextLine**(value As `String</api/data_types/string>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, maxWidth As `Double</api/data_types/double>` = -1.0, alignment As `iOSTextAlignment</api/deprecated/xojo.iostextalignment>` = `iOSTextAlignment.Left</api/deprecated/xojo.iostextalignment/values>`, truncate As `Boolean</api/data_types/boolean>` = `False</api/language/false>`)

Draws a single line of text.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
g.FillColor = Color.Blue
Var t As Text
t = "Hello, World!"
g.DrawTextLine(t, 0, 10, -1, iOSTextAlignment.Left, False) ' Left-aligned
g.DrawTextLine(t, 0, 10, -1, iOSTextAlignment.Center, False) ' Centered
g.DrawTextLine(t, 0, 10, 100, iOSTextAlignment.Right, False) ' Right-aligned
```

<div id="/api/deprecated/iosgraphics/filloval">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.FillOval

**FillOval**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`)

Draws an oval, filling it with the FillColor.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
g.FillColor = Color.Blue
g.FillOval(10, 10, 20, 20)
```

<div id="/api/deprecated/iosgraphics/fillpath">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.FillPath

**FillPath**(path As `GraphicsPath</api/graphics/graphicspath>`)

Draws a path, filling it with the FillColor.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
' Draw a triangle
Var p As New iOSPath
p.MoveToPoint(0, 0) ' Start location
p.LineToPoint(20, 44)
p.LineToPoint(40, 0)
p.LineToPoint(0, 0)

g.FillColor = Color.Blue
g.FillPath(p)
```

<div id="/api/deprecated/iosgraphics/fillrect">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.FillRect

**FillRect**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`)

Draws a rectangle, filling it with the FillColor.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
g.FillColor = Color.Blue
g.FillRect(10, 10, 20, 20)
```

<div id="/api/deprecated/iosgraphics/fillroundrect">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.FillRoundRect

**FillRoundRect**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`, cornerWidth As `Double</api/data_types/double>`, cornerHeight As `Double</api/data_types/double>`)

Draws a rounded rectangle, filling it with the FillColor.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
g.FillColor = Color.Blue
g.FillRoundRect(10, 10, 50, 50, 5, 5)
```

<div id="/api/deprecated/iosgraphics/restorestate">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.RestoreState

**RestoreState**

Restores graphics context previously saved with SaveState.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
g.FillColor = Color.Blue
g.FillRect(10, 10, 20, 20)

g.SaveState
g.FillColor = Color.Red
g.FillRect(50, 50, 20, 20)

' Restore to state where FillColor is Blue
g.RestoreState
g.FillRect(10, 50, 20, 20)
```

<div id="/api/deprecated/iosgraphics/savestate">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.SaveState

**SaveState**

Saves graphics state of the graphics context so that it can be restored later.

These values are saved with SaveState and are restored when you call RestoreState:

- Translation
- Clip region
- LineWidth
- AntiAlias
- FillColor
- LineColor
- Alpha value
- TextFont
- TextUnderline
- Rotation

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
g.FillColor = Color.Blue
g.FillRect(10, 10, 20, 20)

g.SaveState
g.FillColor = Color.Red
g.FillRect(50, 50, 20, 20)

' Restore to state where FillColor is Blue
g.RestoreState
g.FillRect(10, 50, 20, 20)
```

<div id="/api/deprecated/iosgraphics/scale">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.Scale

**Scale**(scaleX As `Double</api/data_types/double>`, scaleY As `Double</api/data_types/double>`)

Sets the scale for the graphics context as specified scaleX and scaleY. This only affects subsequent drawing. Any drawing done before the Scale method is called is not scaled.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
g.Scale(2.0, 4.0)
g.FillColor = Color.Blue
g.FillRect(10, 10, 10, 10) ' The squares scales to a rectangle
```

<div id="/api/deprecated/iosgraphics/textblocksize">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.TextBlockSize

**TextBlockSize**(value As `String</api/data_types/string>`, maxWidth As `Double</api/data_types/double>` = -1.0, maxHeight As `Double</api/data_types/double>` = -1.0, alignment As `iOSTextAlignment</api/deprecated/xojo.iostextalignment>` = `iOSTextAlignment.Left</api/deprecated/xojo.iostextalignment/values>`, truncateLastLine As `Boolean</api/data_types/boolean>` = `False</api/language/false>`) As `Size</api/graphics/size>`

Calculates the size of a text as it would appear using DrawTextBlock.

Get the text block size of left-aligned text:

``` xojo
Var tbs As Size
tbs = g.TextBlockSize("Hello, world!", -1, -1, iOSTextAlignment.Left, False)
```

<div id="/api/deprecated/iosgraphics/textlinesize">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.TextLineSize

**TextLineSize**(value As `String</api/data_types/string>`, maxWidth As `Double</api/data_types/double>` = -1.0, alignment As `iOSTextAlignment</api/deprecated/xojo.iostextalignment>` = `iOSTextAlignment.Left</api/deprecated/xojo.iostextalignment/values>`, truncate As `Boolean</api/data_types/boolean>` = `False</api/language/false>`) As `Size</api/graphics/size>`

Calculates the size of a text as it would appear using DrawTextLine.

Get the text line size of left-aligned text:

``` xojo
Var tls As Size
tls = g.TextLineSize("Hello, world!", -1, iOSTextAlignment.Left, False)
```

<div id="/api/deprecated/iosgraphics/translate">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSGraphics.Translate

**Translate**(translateX As `Double</api/data_types/double>`, translateY As `Double</api/data_types/double>`)

Translates the origin point by the specified translateX and translateY values. Useful with Rotate.

From within an `iOSCanvas<ioscanvas.paint>` event handler:

``` xojo
' Rotate square in center of graphics area
Const Pi = 3.14159
g.Translate(g.Width / 2, g.Height / 2)
g.Rotate(Pi / 4) ' 45 degrees or 1/8 of a circle
g.FillColor = Color.Blue
g.FillRect(10, 10, 50, 50)
```

## Notes

You cannot instantiate <span class="title-ref">iOSGraphics</span>. You can get an <span class="title-ref">iOSGraphics</span> instance from either an `MobileCanvas</api/user_interface/mobile/mobilecanvas>` or an `Picture</api/graphics/picture>`.

Changing the graphics state only affects subsequent drawing commands.

## Compatibility

iOS projects on the iOS operating system.

## See also

`Object</api/data_types/additional_types/object>` parent class; `Picture</api/graphics/picture>`, `Picture</api/graphics/picture>`, `GraphicsPath</api/graphics/graphicspath>` classes; `MobileCanvas</api/user_interface/mobile/mobilecanvas>` control
