Class: GdiGraphics | Spider Monkey Panel

## GdiGraphics

`js/foo_spider_monkey_panel.js`, `line 2997`

### Classes

#### MeasureStringInfo
`GdiGraphics~MeasureStringInfo`

### Methods

#### CalcTextHeight(str, font) → {number}
`js/foo_spider_monkey_panel.js`, `line 3006`

  Calculates text height for GdiGraphics#GdiDrawText.
  Note: this will only calculate the text height of one line.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `str` | string |
  `font` | GdiFont |

  ##### Returns:

  number

#### CalcTextWidth(str, font) → {number}
`js/foo_spider_monkey_panel.js`, `line 3015`

  Calculates text width for GdiGraphics#GdiDrawText.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `str` | string |
  `font` | GdiFont |

  ##### Returns:

  number

#### DrawEllipse(x, y, w, h, line_width, colour)
`js/foo_spider_monkey_panel.js`, `line 3025`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `x` | number |
  `y` | number |
  `w` | number |
  `h` | number |
  `line_width` | number |
  `colour` | number |

#### DrawImage(img, dstX, dstY, dstW, dstH, srcX, srcY, srcW, srcH, angleopt, alphaopt)
`js/foo_spider_monkey_panel.js`, `line 3040`

  ##### Parameters:

  Name | Type | Attributes | Default | Description
  --- | --- | --- | --- | ---
  `img` | GdiBitmap |  |  |
  `dstX` | number |  |  |
  `dstY` | number |  |  |
  `dstW` | number |  |  |
  `dstH` | number |  |  |
  `srcX` | number |  |  |
  `srcY` | number |  |  |
  `srcW` | number |  |  |
  `srcH` | number |  |  |
  `angle` | float | <optional> | 0 |
  `alpha` | number | <optional> | 255 | Valid values 0-255.

#### DrawLine(x1, y1, x2, y2, line_width, colour)
`js/foo_spider_monkey_panel.js`, `line 3050`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `x1` | number |
  `y1` | number |
  `x2` | number |
  `y2` | number |
  `line_width` | number |
  `colour` | number |

#### DrawPolygon(colour, line_width, points)
`js/foo_spider_monkey_panel.js`, `line 3057`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `colour` | number |
  `line_width` | number |
  `points` | Array.<Array.<number>> |

#### DrawRect(x, y, w, h, line_width, colour)
`js/foo_spider_monkey_panel.js`, `line 3081`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `x` | number |
  `y` | number |
  `w` | number |
  `h` | number |
  `line_width` | number |
  `colour` | number |

#### DrawRoundRect(x, y, w, h, arc_width, arc_height, line_width, colour)
`js/foo_spider_monkey_panel.js`, `line 3093`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `x` | number |
  `y` | number |
  `w` | number |
  `h` | number |
  `arc_width` | number |
  `arc_height` | number |
  `line_width` | number |
  `colour` | number |

#### DrawString(str, font, colour, x, y, w, h, flagsopt)
`js/foo_spider_monkey_panel.js`, `line 3071`

  Should be only used when GdiGraphics#GdiDrawText is not applicable.

  ##### Parameters:

  Name | Type | Attributes | Default | Description
  --- | --- | --- | --- | ---
  `str` | string |  |  |
  `font` | GdiFont |  |  |
  `colour` | number |  |  |
  `x` | number |  |  |
  `y` | number |  |  |
  `w` | number |  |  |
  `h` | number |  |  |
  `flags` | number | <optional> | 0 | See Flags.js > StringFormatFlags

#### EstimateLineWrap(str, font, max_width) → {Array.<Array>}
`js/foo_spider_monkey_panel.js`, `line 3109`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `str` | string |
  `font` | GdiFont |
  `max_width` | number |

  ##### Returns:

  Array.<Array> - index | meaning
  [0] text line 1
  [1] width of text line 1 (in pixel)
  [2] text line 2
  [3] width of text line 2 (in pixel)
  ...
  [2n + 2] text line n
  [2n + 3] width of text line n (px)

#### FillEllipse(x, y, w, h, colour)
`js/foo_spider_monkey_panel.js`, `line 3118`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `x` | number |
  `y` | number |
  `w` | number |
  `h` | number |
  `colour` | number |

#### FillGradRect(x, y, w, h, angle, colour1, colour2, focusopt)
`js/foo_spider_monkey_panel.js`, `line 3133`

  Note: this may appear buggy depending on rectangle size. The easiest fix is to adjust the "angle" by a degree or two.

  ##### Parameters:

  Name | Type | Attributes | Default | Description
  --- | --- | --- | --- | ---
  `x` | number |  |  |
  `y` | number |  |  |
  `w` | number |  |  |
  `h` | number |  |  |
  `angle` | float |  |  |
  `colour1` | number |  |  |
  `colour2` | number |  |  |
  `focus` | float | <optional> | 1.0 | Specify where the centred colour will be at its highest intensity. Valid values between 0 and 1.

#### FillPolygon(colour, fillmode, points)
`js/foo_spider_monkey_panel.js`, `line 3140`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `colour` | number |
  `fillmode` | number | 0 alternate, 1 winding.
  `points` | Array.<Array.<number>> |

#### FillRoundRect(x, y, w, h, arc_width, arc_height, colour)
`js/foo_spider_monkey_panel.js`, `line 3151`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `x` | number |
  `y` | number |
  `w` | number |
  `h` | number |
  `arc_width` | number |
  `arc_height` | number |
  `colour` | number |

#### FillSolidRect(x, y, w, h, colour)
`js/foo_spider_monkey_panel.js`, `line 3160`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `x` | number |
  `y` | number |
  `w` | number |
  `h` | number |
  `colour` | number |

#### GdiAlphaBlend(img, dstX, dstY, dstW, dstH, srcX, srcY, srcW, srcH, alphaopt)
`js/foo_spider_monkey_panel.js`, `line 3174`

  ##### Parameters:

  Name | Type | Attributes | Default | Description
  --- | --- | --- | --- | ---
  `img` | GdiRawBitmap |  |  |
  `dstX` | number |  |  |
  `dstY` | number |  |  |
  `dstW` | number |  |  |
  `dstH` | number |  |  |
  `srcX` | number |  |  |
  `srcY` | number |  |  |
  `srcW` | number |  |  |
  `srcH` | number |  |  |
  `alpha` | number | <optional> | 255 | Valid values 0-255.

#### GdiDrawBitmap(img, dstX, dstY, dstW, dstH, srcX, srcY, srcW, srcH)
`js/foo_spider_monkey_panel.js`, `line 3189`

  Always faster than GdiGraphics#DrawImage, does not support alpha channel.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `img` | GdiRawBitmap |
  `dstX` | number |
  `dstY` | number |
  `dstW` | number |
  `dstH` | number |
  `srcX` | number |
  `srcY` | number |
  `srcW` | number |
  `srcH` | number |

#### GdiDrawText(str, font, colour, x, y, w, h, formatopt) → {Array.<number>}
`js/foo_spider_monkey_panel.js`, `line 3220`

  Provides faster and better rendering than GdiGraphics#DrawString.
  Do not use this to draw text on transparent background or with GdiGraphics other than the one passed in on_paint callback: this will result in visual artifacts caused by ClearType hinting.
  Use GdiGraphics#DrawString instead in such cases.
  To calculate text dimensions use GdiGraphics#CalcTextHeight, GdiGraphics#CalcTextWidth or DT_CALCRECT flag.
  Note: uses special rules for `&` character by default, which consumes the `&` and causes the next character to be underscored. This behaviour can be changed (or disabled) via `format` parameter.

  ##### Parameters:

  Name | Type | Attributes | Default | Description
  --- | --- | --- | --- | ---
  `str` | string |  |  |
  `font` | GdiFont |  |  |
  `colour` | number |  |  |
  `x` | number |  |  |
  `y` | number |  |  |
  `w` | number |  |  |
  `h` | number |  |  |
  `format` | number | <optional> | 0 | See Flags.js > DT_*

  ##### Returns:

  Array.<number> - index | meaning
  [0] left (DT_CALCRECT)
  [1] top (DT_CALCRECT)
  [2] right (DT_CALCRECT)
  [3] bottom (DT_CALCRECT)
  [4] characters drawn

#### MeasureString(str, font, x, y, w, h, flagsopt) → {MeasureStringInfo}
`js/foo_spider_monkey_panel.js`, `line 3234`

  Calculates text dimensions for GdiGraphics#DrawString.

  ##### Parameters:

  Name | Type | Attributes | Default | Description
  --- | --- | --- | --- | ---
  `str` | string |  |  |
  `font` | GdiFont |  |  |
  `x` | number |  |  |
  `y` | number |  |  |
  `w` | number |  |  |
  `h` | number |  |  |
  `flags` | number | <optional> | 0 | See Flags.js > StringFormatFlags

  ##### Returns:

  MeasureStringInfo

#### SetInterpolationMode(modeopt)
`js/foo_spider_monkey_panel.js`, `line 3300`

  ##### Parameters:

  Name | Type | Attributes | Default | Description
  --- | --- | --- | --- | ---
  `mode` | number | <optional> | 0 | See Flags.js > InterpolationMode

#### SetSmoothingMode(modeopt)
`js/foo_spider_monkey_panel.js`, `line 3305`

  ##### Parameters:

  Name | Type | Attributes | Default | Description
  --- | --- | --- | --- | ---
  `mode` | number | <optional> | 0 | See Flags.js > SmoothingMode

#### SetTextRenderingHint(modeopt)
`js/foo_spider_monkey_panel.js`, `line 3310`

  ##### Parameters:

  Name | Type | Attributes | Default | Description
  --- | --- | --- | --- | ---
  `mode` | number | <optional> | 0 | See Flags.js > TextRenderingHint